text: San José State University
  Department of Economics
  
  applet-magic.com
  Thayer Watkins
  Silicon Valley
  USA
  
   The Use of Forward Finite Differences in the Solution of Nonlinear Differential Equations
  
  The analysis starts with the simplest case: dy/dt = -y2. The use of a forward difference approximation of dy/dt at t, i.e., (y(t+h)-y(t))/h; gives more accurately an approximation of dy/dt at t+h/2. Thus the finite difference scheme is really an attempt to find an approximate solution to:
  
  #### (dy/dt)|t+h/2 = -y2(t) which is equivalent to (dy/dt) = -y2(t-h/2)
  
  After dealing with this case an extention to the more general problem will be presented.
  
  ## The Solution of the Differential-Difference Equationdy/dt = - y2(t-h/2)
  
  As stated above this equation arises in the use of a forward difference of size h as an approximation of the first derivative dy/dt.
  
  Let y(t-h/2) be approximated by y(t)-(h/2)(dy/dt) so
  
  #### dy/dt = -(y(t)-(h/2)(dy/dt))2= - y2 + hy(dy/dt) -(h2/4)(dy/dt)2
  
  This differential equation can be written as
  
  #### (h2/4)(dy/dt)2 + (1 - hy)(dy/dt) + y2 = 0
  
  The solution for dy/dt, using the formula for the solution of a quadratic equation, is
  
  #### dy/dt = ( -(1-hy) ± ((1-hy)2 - h2y2)1/2 )/(h2/2)
  
  The Taylor series approximation of the square root term is
  
  #### ((1-hy)2 - h2y2)1/2 = (1-hy) - h2y2/(2(1-hy)) <
  
  Thus the solution for dy/dt using the plus form of the square root term is
  
  #### dy/dt = - y2/(1-hy)
  
  This differential equation has the solution
  
  #### 1/y(t) - 1/y(0) + hln(y(t)/y(0)) = t
  
  This transcendental equation does not have an explicit solution for y as a function of t, but having t as a function of y is just as good.
  
  The solution for the backward differences is obtained by making h a negative value; i.e.,
  
  ## Numerical Solution to the Differential Equation
  
  The numerical approach uses the scheme
  
  #### (y(t+h)-y(t))/h = -y2which reduces to y(t+h) = y(t) - hy2(t)
  
  An example with h=1 yields the results shown below.
  
  As can be seen from the graph above, the numerical solution using forward differences tracks not the solution to the differential equation but instead it is an approximation to the solution of the corresponding differential-difference equation. Thus the numerical solution provides a good approximation to the solution of the differential equation only to the extent that the solution to the corresponding differential-difference equation appoximates the solution to the differential equation.
  
  ## The More General Case
  
  The preceding analyis generalizes to the case
  
  #### dy/dt = f(y) which has the solution F(y) - F(y0) = ∫y0y(dz/f(z)) = t
  
  where y0 is the value of y at t=0.
  
  For the forward difference the corresponding differential-difference equation is:
  
  #### dy/dt = f(y(t-h/2)) which is approximately dy/dt = f(y(t)-(h/2)(dy/t)) which in turn is approximately equal to dy/dt = f(y(t)) - f'(y(t))(h/2)(dy/dt)
  
  Putting this equation in differential form gives
  
  #### (1+f'(y)(h/2))(dy/f(y)) = dy/f(y) + (h/2)(f'(y)dy/f(y)) = dt which, upon integration from 0 to t gives F(y) - F(y0) + (h/2)ln(f(y)/f(y0)) = t
  
  The backward difference approximation leads to the same expression except for a negative sign for the logarithmic term.
  
  Thus the effect of forward or backward differencing in the solution of a differential equation of the type dy/dt = f(y) is to shift the time at which a particular level of y is achieved by an amount proportional to the timestep and a logarithmic term; i.e., (h/2)ln(f(y)/f(y0)). The logarithmic term is a function of the ratio of dy/dt at time t to what it was at t=0.
metadata: {"found_math": false, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 0, "mathjax_display_tex": 0, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0}