MHB Implicit finite difference method

Click For Summary
The discussion revolves around the implementation of an implicit finite difference method for solving the wave equation. Participants clarify the initialization of variables at different steps, particularly the indices used in the calculations, noting that at step 1, the index \( j \) should range from 1 to \( J-1 \) to avoid undefined values. There are also discussions about the formulation of the linear system used to compute the approximations \( W_j^{n+1} \) and the correct calculation of the vector \( b \). Errors in the initial results are identified and corrected, leading to agreement on the computed values for various iterations. The importance of proper indexing in programming is emphasized, with caution against accessing out-of-bounds array elements.
  • #31
I like Serena said:
Yep. That is correct.

Great! (Yes) Thank you for your help! (Happy)

I like Serena said:
Btw, any reason that the return value is "void *" instead of "void"?
And that you execute "pointer++" when you make no use of the incremented value?

I used pointers to return the array and use it in the main function..
 

Similar threads

  • · Replies 8 ·
Replies
8
Views
2K
  • · Replies 36 ·
2
Replies
36
Views
7K
  • · Replies 16 ·
Replies
16
Views
4K
Replies
5
Views
3K
  • · Replies 4 ·
Replies
4
Views
1K
  • · Replies 3 ·
Replies
3
Views
1K
  • · Replies 1 ·
Replies
1
Views
839
  • · Replies 2 ·
Replies
2
Views
1K
Replies
2
Views
1K
  • · Replies 31 ·
2
Replies
31
Views
6K