Basic discretization techniques: Difference between revisions
From charlesreid1
(Created page with "* Discretization methods for ODEs (simplest case) ** Finite differences ** Quadrature-based methods ** General form of numerical schemes ** Application/example ** Stability * Mod...") |
No edit summary |
||
| Line 1: | Line 1: | ||
== What is a derivative? == | |||
** | |||
* | Limit definition of a derivative: | ||
** | |||
** | <math> | ||
\frac{d u(x)}{dx} = \displaystyle{ \lim_{\Delta x \rightarrow 0} } \frac{ u(x_0 + \Delta x) - u(x_0) }{ \Delta x } | |||
* | </math> | ||
** | |||
** | This is saying, when <math>\Delta x</math> is "small enough", the algebraic difference <math>\frac{ u(x_0 + \Delta x) - u(x_0) }{ \Delta x}</math> is a good approximation for the derivative; if <math>\Delta x</math> is small enough, the representation becomes exact. | ||
** | |||
OK, so naturally we want to know: how small? How small does <math>\Delta x</math> have to be? | |||
Using a Taylor series expansion for <math>u(x_0 + \Delta x)</math> in terms of <math>u(x_0)</math>: | |||
<math> | |||
u(x_0 + \Delta x) | |||
= u(x_0) | |||
+ \left. \frac{\partial u}{\partial x} \right|_{0} \Delta x | |||
+ \left. \frac{\partial^2 u}{\partial x^2} \right|_{0} \frac{(\Delta x)^2}{2!} | |||
+ \dots | |||
+ \left. \frac{\partial^n u}{\partial x^n} \right|_{\xi} \frac{ (\Delta x)^n }{ n! } \qquad x_0 \leq \xi \leq x_0 + \Delta x | |||
</math> | |||
''What does the Taylor series tell us about how small <math>\Delta x</math> needs to be?'' | |||
Rearrange the Taylor series to look like the limit definition of the derivative... | |||
<math> | |||
\left. \frac{\partial u}{\partial x} \right|_{x_0} = \frac{ u(x_0 + \Delta x) - u(x) }{ \Delta x } - \left. \frac{\partial^2 u}{\partial x^2} \right|_0 \frac{\Delta x}{2!} - \dots | |||
</math> | |||
For a discrete representation, values of <math>u</math> can be indexed at each discrete point using some index <math>i</math>, so that <math>u_i = u(x_0)</math>, <math>u_{i+1} = u(x_0 + \Delta x)</math>, etc... | |||
<math> | |||
\left. \frac{\partial u}{\partial x} \right|_{i} = \frac{ u_{i+1} - u_{i} }{ \Delta x } - \left. \frac{\partial^2 u}{\partial x^2} \right|_0 \frac{\Delta x}{2!} - \dots | |||
</math> | |||
Let's look at this last term... | |||
Tells us two things: | |||
1. For the difference approximation of the derivative to be accurate, we have to have <math>\Delta x</math> become really small. | |||
2. We ALSO have to have <math>\frac{\partial^2 u}{\partial x^2}</math> be really small. | |||
That means if we're trying to approximate a function with a large second derivative, we need an even smaller <math>\Delta x</math>. | |||
(Two images... one a nice 3rd or 5th order polynomial, the other the complex 100th order polynomial... "Just to make sure this concept makes sense.... which one has a larger second derivative? Which one requires a smaller <math>\Delta x</math>?) | |||
We didn't get an ''exact'' answer to the question "how big should <math>\Delta x</math> be, but we've got an idea now | |||
What if the last term looked like this? | |||
<math> | |||
\left. \frac{\partial^2 u}{\partial x^2} \right|_0 \frac{(\Delta x)^2}{2} | |||
</math> | |||
What does that tell us? | |||
1. The value of <math>\Delta x</math> can be bigger to approximate this function | |||
* What we're trying to do with it - i.e. discretize it (define it, explain it) | |||
* Definition of limit | |||
* Derivative is to continuous function what algebraic difference is to discrete function | |||
** i.e. imagine a limit for a discrete function...... it wouldn't turn into a derivative! | |||
** <math>\lim_{\Delta x \rightarrow \delta}</math> versus <math>\lim_{\Delta x \rightarrow 0}</math> | |||
* Taylor series | |||
** Expand a nearby point <math>(x+\Delta x)</math> about another point <math>(x)</math> | |||
** Rearrange to put difference in terms of derivative | |||
** Truncation error, order of error | |||
Revision as of 02:28, 6 November 2010
What is a derivative?
Limit definition of a derivative:
$ \frac{d u(x)}{dx} = \displaystyle{ \lim_{\Delta x \rightarrow 0} } \frac{ u(x_0 + \Delta x) - u(x_0) }{ \Delta x } $
This is saying, when $ \Delta x $ is "small enough", the algebraic difference $ \frac{ u(x_0 + \Delta x) - u(x_0) }{ \Delta x} $ is a good approximation for the derivative; if $ \Delta x $ is small enough, the representation becomes exact.
OK, so naturally we want to know: how small? How small does $ \Delta x $ have to be?
Using a Taylor series expansion for $ u(x_0 + \Delta x) $ in terms of $ u(x_0) $:
$ u(x_0 + \Delta x) = u(x_0) + \left. \frac{\partial u}{\partial x} \right|_{0} \Delta x + \left. \frac{\partial^2 u}{\partial x^2} \right|_{0} \frac{(\Delta x)^2}{2!} + \dots + \left. \frac{\partial^n u}{\partial x^n} \right|_{\xi} \frac{ (\Delta x)^n }{ n! } \qquad x_0 \leq \xi \leq x_0 + \Delta x $
What does the Taylor series tell us about how small $ \Delta x $ needs to be?
Rearrange the Taylor series to look like the limit definition of the derivative...
$ \left. \frac{\partial u}{\partial x} \right|_{x_0} = \frac{ u(x_0 + \Delta x) - u(x) }{ \Delta x } - \left. \frac{\partial^2 u}{\partial x^2} \right|_0 \frac{\Delta x}{2!} - \dots $
For a discrete representation, values of $ u $ can be indexed at each discrete point using some index $ i $, so that $ u_i = u(x_0) $, $ u_{i+1} = u(x_0 + \Delta x) $, etc...
$ \left. \frac{\partial u}{\partial x} \right|_{i} = \frac{ u_{i+1} - u_{i} }{ \Delta x } - \left. \frac{\partial^2 u}{\partial x^2} \right|_0 \frac{\Delta x}{2!} - \dots $
Let's look at this last term...
Tells us two things:
1. For the difference approximation of the derivative to be accurate, we have to have $ \Delta x $ become really small.
2. We ALSO have to have $ \frac{\partial^2 u}{\partial x^2} $ be really small.
That means if we're trying to approximate a function with a large second derivative, we need an even smaller $ \Delta x $.
(Two images... one a nice 3rd or 5th order polynomial, the other the complex 100th order polynomial... "Just to make sure this concept makes sense.... which one has a larger second derivative? Which one requires a smaller $ \Delta x $?)
We didn't get an exact answer to the question "how big should $ \Delta x $ be, but we've got an idea now
What if the last term looked like this?
$ \left. \frac{\partial^2 u}{\partial x^2} \right|_0 \frac{(\Delta x)^2}{2} $
What does that tell us?
1. The value of $ \Delta x $ can be bigger to approximate this function
- What we're trying to do with it - i.e. discretize it (define it, explain it)
- Definition of limit
- Derivative is to continuous function what algebraic difference is to discrete function
- i.e. imagine a limit for a discrete function...... it wouldn't turn into a derivative!
- $ \lim_{\Delta x \rightarrow \delta} $ versus $ \lim_{\Delta x \rightarrow 0} $
- Taylor series
- Expand a nearby point $ (x+\Delta x) $ about another point $ (x) $
- Rearrange to put difference in terms of derivative
- Truncation error, order of error