- #1
- 1,796
- 33
Hi,
We all know that the finite difference formulae for the derivatives are given by:
[tex]
\frac{dy}{dx}_{i}=\frac{y_{i}-y_{i-1}}{\delta x}
[/tex]
and
[tex]
\frac{d^{2}y}{dx^{2}}=\frac{y_{i-1}-2y_{i}+y_{i+1}}{\delta x^{2}}
[/tex]
What would be the formulae for the boundary terms? when i=1? I think I can show that:
[tex]
\frac{dy}{dx}_{0}=\frac{4y_{1}-y_{2}}{3}
[/tex]
Are there any other formulae? What about the second order derivative?
This is for a numerical code in matlab, I can use inbuilt functions but I want my code to run as fast as possible.
Mat
We all know that the finite difference formulae for the derivatives are given by:
[tex]
\frac{dy}{dx}_{i}=\frac{y_{i}-y_{i-1}}{\delta x}
[/tex]
and
[tex]
\frac{d^{2}y}{dx^{2}}=\frac{y_{i-1}-2y_{i}+y_{i+1}}{\delta x^{2}}
[/tex]
What would be the formulae for the boundary terms? when i=1? I think I can show that:
[tex]
\frac{dy}{dx}_{0}=\frac{4y_{1}-y_{2}}{3}
[/tex]
Are there any other formulae? What about the second order derivative?
This is for a numerical code in matlab, I can use inbuilt functions but I want my code to run as fast as possible.
Mat