**Problem Detail:**

I'm studying with "Numerical Solution of Partial Differential Equations by K.W.Morton and D.F.Mayers". On page 25, it says "2(add) + 2(multiply) operations per mesh point for the explicit algorithm (2.19)", but it seems 3(add) + 2(multiply) to me, how did I get wrong?

(2.19) $U_j^{n+1}=U_j^{n}+\mu(U_{j+1}^{n}-2U_j^{n}+U_{j-1}^{n})$

My counting is

2(add) and 1(multiply) inside the bracket

1(multiply) for $\mu$ and the brackets

1(add) for $U_j^{n}$ and the rest

###### Asked By : user26767

###### Answered By : Tom van der Zanden

Note that

$U^n_j + \mu (U^n_{j+1}-2U^n_j+U^n_{j-1}) = (1-2\mu)U^n_j+\mu(U^n_{j+1}+U^n_{j-1})$

$1-2\mu$ may be precomputed.

Question Source : http://cs.stackexchange.com/questions/37321

**3200 people like this**

## 0 comments:

## Post a Comment

Let us know your responses and feedback