Tuesday, 13 August 2013

finite difference on non-uniform grid

finite difference on non-uniform grid

Given three data points $(x_{0},y_{0})$, $(x_{1},y_{1})$ and
$(x_{2},y_{2})$, I wanted to estimate the $y^{\prime}(x_{1})$ and
$y^{\prime \prime}(x_{1})$. Given the taylor expansion of $y(x)$ around
$x_{1}$ $$ y(x)=y_{1}+y^{\prime}(x-x_{1})+\frac{1}{2}y^{\prime
\prime}(x-x_{1})^{2}+... $$ and the two conditions that $y(x_{0})=y_{0}$
and $y(x_{2})=y_{2}$, I solved for $y^{\prime}(x_{1})$ and $y^{\prime
\prime}(x_{1})$ and got the following: $$ y^{\prime
\prime}(x_{1})=\frac{2\left(y_{0}(x_{2}-x_{1})+y_{2}x_{1}-y_{1}x_{2}\right)}{
x_{1}x_{2}(x_{2}-x_{1})} $$ and $$
y^{\prime}(x_{1})=\frac{y_{1}+\frac{1}{2}y_{1}^{\prime
\prime}x_{1}^{2}-y_{0}}{x_{1}} $$
When it is a centred difference i.e $ h= x_{2}-x_{1}=x_{1}-x_{0}$, I get
convergence as the step size $h\rightarrow 0$. However parameters of
interest don't converge to anything sensible for the general
case(uncentered). Can you any one give me suggestions how to fix this or
how it might arise in this context? Thanks, abiyo

No comments:

Post a Comment