Author 
Comment/Response 
John Barber

10/25/01 11:30am
Many Thanks to Henry Lamb for his help and attached notebook. But there is still a problem. In the attached notebook, I saw that the solution generated was jagged (as it should be) but seemed TOO jagged. The reason is that the solution is generated by dividing a 20 second interval into .01 second segments, and then solving the ODE in each segment separately with the random term held constant. This seems fine, and should work if the time interval is divided into small enough pieces. But the problem with what has been done in the attached notebook is that the solution to the ODE in one small time segment does not use the information generated about the solution in the previous time segment. In other words, continuity of the solution at the boundaries of the segements is not ensured. What is instead done is that each calling of NDSolve uses the same initial conditions (at t=0) q[0]==1 and p[0]==0, regard of the actual time interval over which the ODE is being solved in that segment. In other words, in this method, when I solve the ODE in the t=19.99 to 20.00 segemnt, for example, NDSolve has to extrapolate all the way back to t=0 (instead of t=19.99) to get the initial conditions. Naturally, this introduces a large error, and causes the solution to be more discontinuous than it should be.
What I need is for NDSolve to use as its initial condition in one small time segment the final value of the solution at the boundary of the previous segment. I can think of ways to do this, but not in a way that's "nice". Any help would be appreciated.
Also, one more question (sorry):
If I have a known function that appears in a set of ODE's, that is defined ahead of time, such as Q[t_]:=Sin[t], NDSolve evaluates the function many times, at each value of t, UNLESS the function is something like Q[t_]:=Random[]. Then it only evaluates it once. Other functions, such as Plot, evaluate Q[t] many times in this case, and generates a correct picture of the function. Is there any way to define Q[t] ahead of time (for example as a numerical function that is randomly generated prior to each solution of the ODE with NDSolve) so that NDSolve doesn't know that what it is evaluating is in fact Random[], but thinks that it is just a very jaggedlooking numerical function? If this could be done, it would bypass all of the above problems, and would allow me to call NDSolve once, and generate an acceptable solution.
Thanks again for all and any help!
John Barber
URL: , 
