Finite Difference Method - Exercises 1-3

Exercise 1.1: The forward difference formulas make use of the values of the function to the right of the base grid point. Thus the first derivative at point i(t = t_i) is defined as:

$$\frac{dx}{dt}=\frac{x(t+\Delta t)-x(t)}{\Delta t}=\frac{{{x}_{i+1}}-{{x}_{i}}}{\Delta t}$$
Derive the forward difference formulas for:

$$\frac{{{d}^{2}}x}{d{{t}^{2}}},\frac{{{d}^{3}}x}{d{{t}^{3}}}\text{ and }\frac{{{d}^{4}}x}{d{{t}^{4}}}\text{ at }{{t}_{i}}.$$

Solution:

$${{\left. \frac{{{d}^{2}}x}{d{{t}^{2}}} \right|}_{i}}=\frac{{{\left. \frac{dx}{dt} \right|}_{i+1}}-{{\left. \frac{dx}{dt} \right|}_{i}}}{\Delta t}=\frac{\left( \frac{{{x}_{i+2}}-{{x}_{i+1}}}{\Delta t} \right)-\left( \frac{{{x}_{i+1}}-{{x}_{i}}}{\Delta t} \right)}{\Delta t}=\frac{{{x}_{i+2}}-2{{x}_{i+1}}+{{x}_{i}}}{{{\left( \Delta t \right)}^{2}}}$$ $${{\left. \frac{{{d}^{3}}x}{d{{t}^{3}}} \right|}_{i}}=\frac{{{\left. \frac{{{d}^{2}}x}{d{{t}^{2}}} \right|}_{i+1}}-{{\left. \frac{{{d}^{2}}x}{d{{t}^{2}}} \right|}_{i}}}{\Delta t}=\frac{\left( \frac{{{x}_{i+3}}-2{{x}_{i+2}}+{{x}_{i+1}}}{{{\left( \Delta t \right)}^{2}}} \right)-\left( \frac{{{x}_{i+2}}-2{{x}_{i+1}}+{{x}_{i}}}{{{\left( \Delta t \right)}^{2}}} \right)}{\Delta t}=\frac{{{x}_{i+3}}-3{{x}_{i+2}}+3{{x}_{i+1}}-{{x}_{i}}}{{{\left( \Delta t \right)}^{3}}}$$ $$\begin{align} & {{\left. \frac{{{d}^{4}}x}{d{{t}^{4}}} \right|}_{i}}=\frac{{{\left. \frac{{{d}^{3}}x}{d{{t}^{3}}} \right|}_{i+1}}-{{\left. \frac{{{d}^{3}}x}{d{{t}^{3}}} \right|}_{i}}}{\Delta t}=\frac{\left( \frac{{{x}_{i+4}}-3{{x}_{i+3}}+3{{x}_{i+2}}-{{x}_{i+1}}}{{{\left( \Delta t \right)}^{3}}} \right)-\left( \frac{{{x}_{i+3}}-3{{x}_{i+2}}+3{{x}_{i+1}}-{{x}_{i}}}{{{\left( \Delta t \right)}^{3}}} \right)}{\Delta t}= \\ & {{\left. \frac{{{d}^{4}}x}{d{{t}^{4}}} \right|}_{i}}=\frac{{{x}_{i+4}}-4{{x}_{i+3}}+6{{x}_{i+2}}-4{{x}_{i+1}}+{{x}_{i}}}{{{\left( \Delta t \right)}^{4}}} \\ \end{align}$$

Exercise 1.2: The backward difference formulas make use of the values of the function to the right of the base grid point. Thus the first derivative at point i(t = t_i) is defined as:

$$\frac{dx}{dt}=\frac{x(t)-x(t-\Delta t)}{\Delta t}=\frac{{{x}_{i}}-{{x}_{i-1}}}{\Delta t}$$

Derive the forward difference formulas for:

$$\frac{{{d}^{2}}x}{d{{t}^{2}}},\frac{{{d}^{3}}x}{d{{t}^{3}}}\text{ and }\frac{{{d}^{4}}x}{d{{t}^{4}}}\text{ at }{{t}_{i}}.$$+
Solution:

$${{\left. \frac{{{d}^{2}}x}{d{{t}^{2}}} \right|}_{i}}=\frac{{{\left. \frac{dx}{dt} \right|}_{i}}-{{\left. \frac{dx}{dt} \right|}_{i-1}}}{\Delta t}=\frac{\left( \frac{{{x}_{i}}-{{x}_{i-1}}}{\Delta t} \right)-\left( \frac{{{x}_{i-1}}-{{x}_{i-2}}}{\Delta t} \right)}{\Delta t}=\frac{{{x}_{i}}-2{{x}_{i-1}}+{{x}_{i-2}}}{{{\left( \Delta t \right)}^{2}}}$$ $${{\left. \frac{{{d}^{3}}x}{d{{t}^{3}}} \right|}_{i}}=\frac{{{\left. \frac{{{d}^{2}}x}{d{{t}^{2}}} \right|}_{i}}-{{\left. \frac{{{d}^{2}}x}{d{{t}^{2}}} \right|}_{i-1}}}{\Delta t}=\frac{\left( \frac{{{x}_{i}}-2{{x}_{i-1}}+{{x}_{i-2}}}{{{\left( \Delta t \right)}^{2}}} \right)-\left( \frac{{{x}_{i-1}}-2{{x}_{i-2}}+{{x}_{i-3}}}{{{\left( \Delta t \right)}^{2}}} \right)}{\Delta t}=\frac{{{x}_{i}}-3{{x}_{i-1}}+3{{x}_{i-2}}-{{x}_{i-3}}}{{{\left( \Delta t \right)}^{3}}}$$ $$\begin{align} & {{\left. \frac{{{d}^{4}}x}{d{{t}^{4}}} \right|}_{i}}=\frac{{{\left. \frac{{{d}^{3}}x}{d{{t}^{3}}} \right|}_{i}}-{{\left. \frac{{{d}^{3}}x}{d{{t}^{3}}} \right|}_{i-1}}}{\Delta t}=\frac{\left( \frac{{{x}_{i}}-3{{x}_{i-1}}+3{{x}_{i-2}}-{{x}_{i-3}}}{{{\left( \Delta t \right)}^{3}}} \right)-\left( \frac{{{x}_{i-1}}-3{{x}_{i-2}}+3{{x}_{i-3}}-{{x}_{i-4}}}{{{\left( \Delta t \right)}^{3}}} \right)}{\Delta t}= \\ & {{\left. \frac{{{d}^{4}}x}{d{{t}^{4}}} \right|}_{i}}=\frac{{{x}_{i}}-4{{x}_{i-1}}+6{{x}_{i-2}}-4{{x}_{i-3}}+{{x}_{i-4}}}{{{\left( \Delta t \right)}^{4}}} \\ \end{align}$$

Exercise 1.3: Derive the formula for the fourth derivative according to the central difference method.
Solution:

$${{\left. \frac{{{d}^{2}}x}{d{{t}^{2}}} \right|}_{i}}=\frac{{{x}_{i+1}}-2{{x}_{i}}+{{x}_{i-1}}}{{{\left( \Delta t \right)}^{2}}}$$ $$\begin{align} & {{\left. \frac{{{d}^{4}}x}{d{{t}^{4}}} \right|}_{i}}=\frac{{{\left. \frac{{{d}^{2}}x}{d{{t}^{2}}} \right|}_{i+1}}-2{{\left. \frac{{{d}^{2}}x}{d{{t}^{2}}} \right|}_{i}}+{{\left. \frac{{{d}^{2}}x}{d{{t}^{2}}} \right|}_{i-1}}}{{{\left( \Delta t \right)}^{2}}}=\frac{\left( \frac{{{x}_{i+2}}-2{{x}_{i+1}}+{{x}_{i}}}{{{\left( \Delta t \right)}^{2}}} \right)-2\left( \frac{{{x}_{i+1}}-2{{x}_{i}}+{{x}_{i-1}}}{{{\left( \Delta t \right)}^{2}}} \right)+\left( \frac{{{x}_{i}}-2{{x}_{i-1}}+{{x}_{i-2}}}{{{\left( \Delta t \right)}^{2}}} \right)}{{{\left( \Delta t \right)}^{2}}} \\ & {{\left. \frac{{{d}^{4}}x}{d{{t}^{4}}} \right|}_{i}}=\frac{{{x}_{i+2}}-4{{x}_{i+1}}+6{{x}_{i}}-4{{x}_{i-1}}+{{x}_{i-2}}}{{{\left( \Delta t \right)}^{4}}} \\ \end{align}$$

Nema komentara:

Objavi komentar