## Solving "Impossible" Differential Equations with Mathematica

(continued from last page...)

Your little session with Mathematica should have gone like this:

sol1/.x->0

1.

sol1/.x->1

1.41348

sol1/.x->1.5

1.19654

sol1/.x->3

0.193762

sol1/.x->4

0.067613

sol1/.x->5

0.0414129

sol1/.x->6

InterpolatingFunction::dmval: Input value {6} lies outside the range of data in the interpolating function. Extrapolation will be used. >>

0.0278086

sol1/.x->-1

InterpolatingFunction::dmval: Input value {-1} lies outside the range of data in the interpolating function. Extrapolation will be used. >>

-5248.72

The last two of the x-values generated error messages, and rightly so! In fact the error message even makes sense—after all, didn't we tell Mathematica to solve the differential equation on the interval {x,0,5} in the original NDSolve command?

Anyway, what you should have realized from the previous problem is that the solution we have found using approximation is almost as good as having an actual formula for the "proper" solution. We can plug in x-values to our heart's content, and pull out the corresponding y-values. We could even do it with decimal values for x like x = 2.718281828459045 if we liked. What we cannot do is use x-values that lie outside the domain specified in the original NDSolve command.

You may ask "why not make the original range huge and cover all the bases?" But think about it! The bigger the range, the more ground the approximation has to cover. We would either have to come up with an approximate solution at a huge number of points, or spread the points waaaay far apart to cover the range. Both of these actions have drawbacks. The first would be slow, and use a lot of computer memory. The second would be inaccurate since when you make large jumps between points you have a tendency to wander further away from the proper solution. (To guard against errors of this kind Mathematica restricts it's NDSolve command to 500 points, though this can be overridden if necessary.)

Well, we have found that NDSolve gives us a solution that we can substitute values into quite nicely! What about the other requirement that we had?

 If you're lost, impatient, want an overview of this laboratory assignment, or maybe even all three, you can click on the compass button on the left to go to the table of contents for this laboratory assignment.

ODE Laboratories: A Sabbatical Project by Christopher A. Barker

©2009 San Joaquin Delta College, 5151 Pacific Ave., Stockton, CA 95207, USA
e-mail:
cbarker@deltacollege.edu