Mathematica 9 is now available
Student Support Forum
-----
Student Support Forum: 'Stochastic ODE' topicStudent Support Forum > General > Archives > "Stochastic ODE"

< Previous Comment | Next Comment >Help | Reply To Comment | Reply To Topic
Author Comment/Response
Forum Moderator
email me
10/05/01 3:26pm

My guess is that this message is transitory, i.e. when the distribution expression is first
encountered, it is non numerical but NDSolve persists and generates a result.

In[31]:= soln=NDSolve[{q'[t]\[Equal]p[t],
p'[t]\[Equal]-(1+(Random[NormalDistribution[0,Sqrt[1/(1+q[t]^2)]]])^2)q[
t],q[0]\[Equal]1,p[0]\[Equal]0},{q,p},{t,0,20}]
From In[31]:=
\!\(CompiledFunction::"cfsa" \(\(:\)\(\ \)\)
"Argument \!\(\@\(1\/\(1 + \(q[t]\)\^2\)\)\) at position \!\(2\) should \
be a \!\(\"machine-size real number\"\)."\)


Out[31]= {{q\[Rule]InterpolatingFunction[{{0.,20.}},<>],
p\[Rule]InterpolatingFunction[{{0.,20.}},<>]}}

You can see the result by plotting the functions:

In[32]:=
Plot[{q[t]/.soln,p[t]/.soln}, {t,0, 20}]

There may be a trick that could prevent NDSolve from trying to evaluate the
integral before the random number is known. I've seen things where the entire
NDSolve is made into a function that only evaluates if the argument is numerical
but the details elude me. You could also just turn the message off.

Tom Zeller
Forum Moderator

URL: ,

Subject (listing for 'Stochastic ODE')
Author Date Posted
Stochastic ODE John Barber 09/13/01 3:47pm
Re: Stochastic ODE Forum Modera... 10/05/01 3:26pm
Re: Stochastic ODE John Barber 10/05/01 7:15pm
Re: Stochastic ODE Henry Lamb 10/15/01 03:45am
Re: Stochastic ODE John Barber 10/25/01 11:30am
Re: Stochastic ODE Henry Lamb 10/28/01 01:17am
Re: Stochastic ODE John Barber 10/29/01 10:45am
< Previous Comment | Next Comment >Help | Reply To Comment | Reply To Topic