$$
\newcommand{\uex}{{u_{\small\mbox{e}}}}
\newcommand{\Aex}{{A_{\small\mbox{e}}}}
\newcommand{\half}{\frac{1}{2}}
\newcommand{\Oof}[1]{\mathcal{O}(#1)}
$$
Memory-saving implementation
- Note 1: we store the entire array
u
, i.e., \( u^n \) for \( n=0,1,\ldots,N_t \)
- Note 2: the formula for \( u^{n+1} \) needs \( u^n \) only, not \( u^{n-1} \), \( u^{n-2} \), ...
- No need to store more than \( u^{n+1} \) and \( u^{n} \)
- Extremely important when solving PDEs
- No practical importance here (much memory available)
- But let's illustrate how to do save memory!
- Idea 1: store \( u^{n+1} \) in
u
, \( u^n \) in u_1
(float
)
- Idea 2: store
u
in a file, read file later for plotting