Finite differences on arbitrary 1D grids

1DFiniteDifferenceMethods.nb: here you find a pretty nice implementation with Mathematica of the finite difference method on arbitrary one-dimensional grids. It is based on the excellent work of Bengt Fornberg: Generation of Finite Difference Formulas on Arbitrarily Spaced Grids. Mathematics Computation 51 (184), 1988.

Arbitrary means that you do not need equally-spaced points: this turns to be particularly useful when you want refine the mesh around some special point (for instance at the boundaries). As an example here it is the stencil for the forward approximation of the 4-order derivative using 5 points not equally spaced:

The function FDDiscretize does all the job for you in order to discretize a given ODEs system with the desidered stencil.

About these ads

~ by svidoli on March 7, 2011.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s

 
Follow

Get every new post delivered to your Inbox.

%d bloggers like this: