The on-line help for the files FirstOrderODES.mthOA7SLO and SecondOrderODES.mthOB7SLO describes methods for finding exact solutions to ordinary differential equations.  Sometimes none of these methods is applicable to your equation or the results of these methods cannot be converted to an explicit form.  Perhaps your differential equation is unsolvable in terms of Derive's functions, or you need to solve a system of differential equations.  Don't give up if this happens!


The file ODEApproximation.mth defines functions for solving most ordinary differential equations and systems of such equations using truncated series approximations and approximate numerical methods.  The function definitions in the file are automatically loaded when any of its functions are first used.



Series Solutions to First Order Equations and Systems


TAYLOR_ODE1(r, x, y, x0, y0, n) simplifies to an nth order truncated Taylor series solution of the equation y' = r(x, y) given the initial condition y=y0 and x=x0.  For example,

TAYLOR_ODE1(EXP(x·y), x, y, 0, 1, 4)

simplifies to

    4      3      2          
 5·x      x      x           
—————— + ———— + ———— + x + 1 
  12       2      2          


To verify that this is an approximate series solution to the differential equation, substitute this series solution for y in the unsimplified difference between the two sides of the equation.  Then use the Calculus Taylor Series commandMRJ3J4 to verify that the third order Taylor series approximation of that difference is 0.  The reason for using a third rather than fourth order Taylor series approximation is that differentiation reduces the order of the truncated series by 1.


TAYLOR_ODE1 simplifies to ? if r is not sufficiently differentiable for an nth order truncated series.  Try a smaller value for n if this happens.


PICARD(r, p, x, y, x0, y0) expands to an improved approximate series solution of the equation y' = r(x, y), given the approximate series solution p(x).  Expanding with respect to x often gives a more useful form than just simplifying the expression.  


The Picard method involves integrating r(x, p(x)).  If no integrals remain in the simplified result, you can try another iteration using the improved approximation for p, and so on.  If you have no better first approximation, use the constant y0.


For example, suppose y' = y²+SQRT(x) and y=1 at x=0.  Use of TAYLOR_ODE1 indicates that the right side of the equation is sufficiently differentiable only for a first order truncated Taylor-series solution x+1.  Consequently, using this as a first approximation,

PICARD(y^2+SQRT(x), x + 1, x, y, 0, 1)

expands to

  3             3/2          
 x      2    2·x             
———— + x  + ———————— + x + 1 
  3             3            


You can then use this second approximation as the second argument of PICARD to obtain a third approximation, and so on.  


Note that the highest order terms generated by the Picard method are often incorrect.  For example, the coefficient of the above x³ term should be 1.  Distrust terms whose coefficients are not the same for two successive iterates.  For this reason and for efficiency, it is wise to discard all but the next higher order term after each iteration.  For example, you should discard the above x³ and x² terms for the next iteration.


If any iterate yields a result containing an integral, you can try approximating r(x, p(x)) to make it integrable.


PICARD can also be used to find series solutions of systems of first order differential equations.  Given a monic quasi-linear system of first order equations of the form

y1' = r1(x, y1, y2, ..., ym)

y2' = r2(x, y1, y2, ..., ym)

...

ym' = rm(x, y1, y2, ..., ym)

let r=[r1, r2, ..., rm], y=[y1, y2, ..., ym], and y=y0=[y1,0, y2,0, ..., ym,0] at x=x0.  Then PICARD(r, p, x, y, x0, y0) expands to an improved series solution of the system, given the series solution p=[p1, p2, ..., pm].


TAYLOR_ODES(r, x, y, x0, y0, n) simplifies to the nth order truncated Taylor series solution of the above system of differential equations, provided vector r is sufficiently differentiable.



Series Solutions to Second Order Equations


TAYLOR_ODE2 (r, x, y, v, x0, y0, v0, n)  simplifies to an nth order truncated Taylor series solution of the equation y" = r(x, y, v).  Here v represents y', and v0 is the value of v at x = x0.  For example, TAYLOR_ODE2 (2·x·v + x²·y + 3·x, x, y, v, 0, 0, 1, 5) simplifies to

    5        3      
 3·x      5·x       
—————— + —————— + x 
  10        6       


To verify that this is an approximate series solution to the differential equation, substitute this series solution for y and substitute the derivative of this expression for v into the unsimplified difference between the two sides of the equation.  Then use the Calculus Taylor Series commandMRJ3J4 to verify that the third order Taylor series approximation of that difference is 0.  The reason for using a third rather than fifth order Taylor series approximation is that the second derivative of the truncated series reduces its order by 2.


TAYLOR_ODE2 simplifies to ? if r is not sufficiently differentiable for an nth order truncated series.  Try a smaller value for n if this happens.



Approximate Numerical Solutions to First Order Equations


EULER_ODE(r, x, y, x0, y0, h, n) approximates to a vector of n+1 solution points of the equation y' = r(x, y) with y=y0 at x=x0 beginning with x=x0 using a step size of h.  EULER_ODE uses Euler's method to produce a vector of n+1 coordinate pairs of the form

[[x0,  y0],  [x0+h,  y1],  [x0+2·h,  y2],  ...,  [x0+n·h,  yn]]


This vector plots as a set of points that approximates the solution curve of the equation.  For example, to generate five points of an approximate solution of the equation  y' = 26/(3+(x+y)²)  from x = 1 to x = 2 with y(1) = 2, approximate

EULER_ODE(26/(3+(x+y)^2), x, y, 1, -2, 1/4, 4)

giving

  1       -2      
                 
1.25    -0.375    
                 
 1.5  1.351141078
                 
1.75  1.935200456
                 
  2   2.327222449


Euler's method has educational value as the simplest numerical method for solving systems of simultaneous first order ordinary differential equations, but it typically has the largest error of any standard method.  Thus, the more accurate Runge-Kutta method should generally be used to solve such systems numerically.


RK(r, v, v0, h, n) uses the classic fourth order Runge-Kutta method to approximate the solution of the system of first order differential equations  yi' = ri(x, y).  r is the vector [r1, r2, ..., rm],  v is the vector [x, y1, y2, ..., ym],  v0 is the corresponding vector of initial values, h is the desired step size, and n is the desired number of steps.  RK returns a data matrix of n+1 approximate solution points.  Each row of the matrix consists of an x value and the corresponding approximate values of y1 through ym.


When given a single differential equation, RK returns a data matrix that plots in a 2D-plot window as the solution of the equation.  For example, to plot the solution of y = sin(x·y) for x=0 to 10 having an initial value of y=1 at x=0, enter the expression

RK([SIN(x·y)], [x, y], [0, 1], 0.1, 100)

Then switch to a 2D-plot window and plot the expression after using the Options > Display > Points command7CKH0ZT to connect data points and the Options > Approximate Before Plotting commandEVZ132 to approximate expressions before plotting them.


When given m differential equations, RK returns a m+1 column matrix.  To plot y1 versus x, extract the first two columns of the matrix by appending COL [1,2] to the RK function call.  To plot y2 versus x, extract the first and third columns by appending COL [1,3], etc.  Alternatively, to plot y2 versus y1 ¾ a parametric phase-plane plot ¾ extract the second and third columns by appending COL [2,3], etc.  For example, to plot the solutions of the system y = sin(x·y·z) and z = cos(x·y·z) for x=0 to 5 having initial values of y=1 and z=1 at x=0, enter and plot the expressions

(RK([SIN(x·y·z),COS(x·y·z)], [x,y,z], [0,1,1], 0.1, 50)) COL [1,2]

(RK([SIN(x·y·z),COS(x·y·z)], [x,y,z], [0,1,1], 0.1, 50)) COL [1,3]

(RK([SIN(x·y·z),COS(x·y·z)], [x,y,z], [0,1,1], 0.1, 50)) COL [2,3]


DIRECTION_FIELD(r, x, x0, xm, m, y, y0, yn, n) approximates to a matrix of 2-component vectors that when plotted displays as a direction field for the equation y'=r(x,y).  x varies from x0 through xm in m steps, and y varies from y0 through yn in n steps.  Before plotting, use the 2D-plot window Options > Display > Points command7CKH0ZT to connect the endpoints of the tangent segments and to make their endpoints small dots.


For example,  to plot a direction field for the equation y=y-x, approximate the expression

DIRECTION_FIELD(y - x, x, -3, 3, 6, y, -3, 3, 6)

and then plot the result in a 2D-plot window using connected segments and small dots.



Higher Order Differential Equations


A second or higher order ordinary differential equation can always be transformed into an equivalent system of first order differential equations as follows:


       First, introduce a unique new variable for each derivative except the highest.

       Next, replace the highest order derivative with the first derivative of the variable that represents the next-highest order derivative.

       Finally, for each of the other variables, add to the system an equation that equates its first derivative to the variable that represents the next higher order derivative.  


For example, this procedure transforms a second order equation of the form f (x, y", y', y) = 0 into the system of first order equations f (x, v', v, y) = 0 and y' = v.


This procedure can also be used to transform a system of higher order ordinary differential equations into an equivalent system of first order equations.  Simply transform each equation in turn, consistently using the same variable for a derivative everywhere it occurs.


After transforming a higher order equation or system of equations into a system of first order equations, the methods described earlier in this section can be used to solve the system.


Other Utility File LibraryG5BS2R 

Created with the Personal Edition of HelpNDoc: Free CHM Help documentation generator