| 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: , |
|