Re: Newbie question

*To*: mathgroup at smc.vnet.net*Subject*: [mg18300] Re: Newbie question*From*: "P.J. Hinton" <paulh at wolfram.com>*Date*: Fri, 25 Jun 1999 22:24:10 -0400*Organization*: "Wolfram Research, Inc."*References*: <7ku1ga$9bi@smc.vnet.net>*Sender*: owner-wri-mathgroup at wolfram.com

On 24 Jun 1999, Alexander Sirotkin wrote: > Can anybody here explain what mathematica wants from me ? It's error > messages (as always) does not contain any helpfull information and > there is no way (as far as I know) to at least see where the error > occured. On the contrary, the last printed error message is _very_ useful. NDSolve::"ndnum": "The right-hand side of the differential equation does not evaluate to a number at r == 0.` If you go look at result that is echoed back by the kernel. 2 2 G M[r] rho[r] NDSolve[{M'[r] == 4 Pi r rho[r] , P'[r] == -(-------------), 2 r T'[r] == -((3 L[r] rho[r] 22 25 4.50432 10 Null rho[r] 2.06584 10 Null rho[r] (0.34 + ------------------------ + ------------------------))\ 7/2 Sqrt[T[r]] T[r] 2 3 2 2 n / (16 a c Pi r T[r] )), L'[r] == 4 Pi r rho[r] Eps T[r] , 0 M[0] == 0, P[0] == 1, T[0] == 1, L[0] == 0}, {M, P, T, L}, {r, 0, 100}] You will notice that there are several instance of the symbol Null in the third ODE. That should raise a red flag as to why NDSolve[] couldn't get a particular equation to evaluate to a number. If you run a stack trace on the evaluation of the third equation for the case where r = 0: Trace[diffEqT /. r ->0] You'll find that 1) The right hand side of the equation blows up to infinity because you've zeroed out a denominator. 2) This evaluation is giving rise to the Null {g , g := t := 1, Null} bf ff There is no reason for you to use SetDelayed (:=) for this operation as is the case for any of your expressions that are not defined in terms of rules with patterns. The bigger issue is that you need to reformulate your problem so that it is not singular at t = 0. -- P.J. Hinton Mathematica Programming Group paulh at wolfram.com Wolfram Research, Inc. Disclaimer: Opinions expressed herein are those of the author alone.