New answers tagged

4

Introduction This uses implicit finite difference method. Using standard centered difference scheme for both time and space. To make it more general, this solves $u_{tt} = c^2 u_{xx}$ for any initial and boundary conditions and any wave speed $c$. It also shows the Mathematica solution (in blue) to compare against the FDM solution in red (with the dots on ...


3

This question should be brilliantly answered by Mathematica documentation. Have a close look at: The Numerical Method of Lines This is an introduction to Mathematica NDSolve'FiniteDifferenceDerivative and has several examples starting with the heat equation and the asked 1D wave equation of this very question. It shows how to do the tables and lists and ...


4

This is basic explicit method finite difference. An implicit method will be better and left as an exercise. This is described in https://en.wikipedia.org/wiki/Finite_difference_method#Explicit_method makeA[n_] := Module[{A, i, j}, A = Table[0, {i, n}, {j, n}]; Do[ Do[ A[[i, j]] = If[i == j, -2, If[i == j + 1 || i == j - 1, 1, 0]], {j, 1,...


Top 50 recent answers are included