Re: Chaotic Equation NDSolve....

*To*: mathgroup at smc.vnet.net*Subject*: [mg3153] Re: Chaotic Equation NDSolve....*From*: withoff (David Withoff)*Date*: Fri, 9 Feb 1996 03:00:42 -0500*Organization*: Wolfram Research, Inc.*Sender*: owner-wri-mathgroup at wolfram.com

In article <4f4hts$cpu at dragonfly.wolfram.com> aspuru at servidor.dgsca.unam.mx writes: > Greetings from Mexico City, > > We are a pair of students of chemistry doing some exercises on chaotic systems. > So we are not too keen on math as a mathematician would be. > > We programmed this system and get this error: > "Differential Equation does not evaluate as a number at t=1" Tried with > different values of t with no success: > > The system we programmed is as follows: > > NDSolve[ {q1'[t] == p1[t], > q2'[t] == p2[t], > p1'[t] == ((1-f) q1[t])/((1 - q2[t]) ^ 2 + (q1[t]) ^ 2 ) ^ 0.5, > p2'[t] == (1-f) - q2[t] - ((1-f) (1-q2[t]))/((1-q2[t]) ^ 2 + (q1[t]) ^ 2) ^ 0.5 , > q1 [1] == q2[1] == p1[1] == 1, p2[1] == 2}, > {p1, q1, p2, q2}, {t, 1, 20}, MaxSteps->3000 ] > > And we dont know what is wrong on it... I hope any one of you can guide/help > us in our quest of solving this system. > > Thanks a lot in advance. > > Alan Aspuru & Octavio Paniagua... > > Chemistry Faculty, > Universidad Nacional Autonoma de Mexico You will get this message if f (or any other expressions in your input) doesn't have numerical values. A trick that I often use when confronted with a large set of differential equations and the "Differential Equation does not evaluate as a number" message is to insert random numerical values for the things that I know to be numbers, and look for anything in the result that isn't numerical. In[1]:= equations = {q1'[t] == p1[t], q2'[t] == p2[t], p1'[t] == ((1-f) q1[t])/((1 - q2[t]) ^ 2 + (q1[t]) ^ 2 ) ^0.5, p2'[t] == (1-f) - q2[t] - ((1-f) (1-q2[t]))/((1-q2[t]) ^ 2 + (q1[t]) ^ 2) ^ 0.5} Out[1]= {q1'[t] == p1[t], q2'[t] == p2[t], (1 - f) q1[t] > p1'[t] == --------------------------, 2 2 0.5 (q1[t] + (1 - q2[t]) ) (1 - f) (1 - q2[t]) > p2'[t] == 1 - f - -------------------------- - q2[t]} 2 2 0.5 (q1[t] + (1 - q2[t]) ) In[2]:= equations /. {p1[t] -> Random[], p2[t] -> Random[], q1[t] -> Random[], q2[t] -> Random[], p1'[t] -> Random[], p2'[t] -> Random[], q1'[t] -> Random[], q2'[t] -> Random[]} Out[2]= {False, False, 0.404791 == 0.00145649 (1 - f), > 0.862479 == 0.710355 - 0.999999 (1 - f) - f} This exposes the non-numerical symbols quite readily. Dave Withoff Research and Development Wolfram Research ==== [MESSAGE SEPARATOR] ====