- #1

hunt_mat

Homework Helper

- 1,741

- 25

[tex]

\frac{f(i+1)-2*f(i)+f(i-1)}{h^{2}}=\textrm{gradient}(\textrm{gradient}(f,h),h)

[/tex]

So the code I wold use is:

[tex]

T=T+dt*D*\textrm{gradient}(\textrm{gradient}(f,h),h)

[/tex]

When I do this, I get erroneous results from my initial condition of a Gaussian for example. values start becoming negative which wrong. I don't know where I am going wrong.