1

I'm not going to debug your code, but since $$(1-x)u_{xx}$$ can be discretized, using second order, centered, finite differences with: $$(1-x_i) \frac{u_{i+1}-2u_i+u_{i-1}}{h^2}$$ where $x_i$ is one of the grid points, $h$ your discretization parameter, this means that the $i$-th row of the second derivative matrix is multiplied by the factor $1-x_i$ The $i-$...


Only top voted, non community-wiki answers of a minimum length are eligible