Sage Math Tutorial - Finite Differences
This page contains interactive Sage widgets - edit and re-evaluate them!
Finite Difference Methods can be used to approximate the solutions of systems of differential equations: Wikipedia - Finite Difference Methods. The Sage Cells in this page are linked, so variables and calculations carry over from one Cell to the next.
First, we define a simple finite difference method. In this example, all sides are perfectly insulated and one of them contains a heating wire:
Then, we execute the difference method in a 'while' loop for the desired number of steps:
Then, we create an @Interact plot to visualize the results. If you have Java/Jmol installed, try checking the box to generate a zoomable, rotatable plot: