Finite Differencing Methods (Method 1): Explicit Forward Differences

Approximation to "index_18.gif"= f(y)
"index_19.gif"
If all the time steps are the same size, Δt, then use the short-hand "index_20.gif" = y(n × Δt)

Approximate f(y) with f("index_21.gif"); then solving the finite difference equation above,
"index_22.gif"= "index_23.gif"+ Δt f("index_24.gif"): the right-hand side depends only on "index_25.gif", and therefore we can apply a recursion method to find any "index_26.gif"

PushMethod1 takes an arbitrary f for the right-hand-side, the current point and the size of the time step Δt

"index_27.gif"

Here is an example right-hand-side function:

"index_28.gif"

Applying it once "pushes" the current point (the second argument) forward one increment in time.

"index_29.gif"

"index_30.gif"

Applying it twice "pushes" the current point (the second argument) forward two increments in time. We have "nested" one function call inside the other.

"index_31.gif"

"index_32.gif"

Nest is a useful function for these kinds of operatons: Nest[g,x,3] is g[g[g[x]]]. However, in our case, PushMethod1 takes three arguments, we need to use a Pure Function methods to specify that the PushMethod1 operates only on the point represented by the second argument.  This should provide a useful example of what Nest does: # plays the role of the functions argument and the & indicates that the function is to interpreted as a pure function.

"index_33.gif"

"index_34.gif"

We can use NestList to build up the trajectory,very similar to our method above that used AppendTo, but this is more efficient.

"index_35.gif"

"index_36.gif"

NestListWhile to build up the trajectory while a "test" evaluates to True.  We have to use a pure function for the test, which operates on the current point (or the last point entered into the list).

"index_37.gif"

"index_38.gif"


Created by Wolfram Mathematica 6.0  (06 November 2007) Valid XHTML 1.1!