Re: NDsolve with a quasi random scource
- To: mathgroup at smc.vnet.net
- Subject: [mg107616] Re: NDsolve with a quasi random scource
- From: Albert Retey <awnl at gmx-topmail.de>
- Date: Fri, 19 Feb 2010 07:33:04 -0500 (EST)
- References: <hllibo$o3$1@smc.vnet.net>
Hi, > I have a quick question regarding the use of a pseudo-random scource > inside NDsolve. > > Suppose you have the following: > > scource[z_,]:= RandomReal[{-5,5}] > > Then in NDsolve we have > > NDsolve[f'[z] + f[z] == scource[z],f,{z,0.5}] > > My question is as the integrator works to solve this system within > NDsolve is it really putting in a random number at each z-step? or is > it just evaluated scource[z] once and returning a number, and then > going into the integrator?' It is pulling a random number at each time step. The problem is that by default NDSolve uses a variable time step solver and for a random right hand side it will choose the steps size to be so small that you will either not see the desired effect or it will stop with error messages because the step size will "effectively be zero" (you might probably see different messages). I think that strictly speaking the equation as you have written down does not even make much sense when interpreted in a "continous" way. In a differential equation there is nothing like a time step, time steps iare just artifacts of the numerical algorithms to solve differential equations. > Nevertheless, How can I keep the algorithm that is actually solving > this system to pull random numbers at each z step? The question has come up more than once and you should find various ways to get a result that reflects what you need in the archives, see e.g. this thread: <http://groups.google.at/group/comp.soft-sys.math.mathematica/browse_thread/thread/c5be1fabf6496c3b/4296c62cc35373d0?hl=de&lnk=gst&q=NDSolve+Random#4296c62cc35373d0> or just search for NDSolve and Random in e.g. google groups. hth, albert