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
0.0278086
sol1/.x->-1
-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.
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?