NDSolve emitting error NDSolve:: ndnum [closed]

s =
NDSolve[
{m'[r] == α*r^2 ϵ[r],
p'[r] == -(r0/r)*((p[r] + ϵ[r]) (m[r] + α r^3* p[r]))/(r - 2 r0*m[r]),
m == 1, p[10.] == 1},
{m, p},
{r, 10, 100}]

I have given all the values of the parameters. Need solution for p[r], m[r]. But it is showing :

NDSolve:: ndnum, r, 10.] NDSolve:Encountered non-numerical value for a derivative at r == 10.

Can any one solve the problem?

closed as off-topic by Michael E2, m_goldberg, MarcoB, Henrik Schumacher, user21Jun 12 at 7:40

This question appears to be off-topic. The users who voted to close gave this specific reason:

• "This question cannot be answered without additional information. Questions on problems in code must describe the specific problem and include valid code to reproduce it. Any data used for programming examples should be embedded in the question or code to generate the (fake) data must be included." – Michael E2, m_goldberg, MarcoB, Henrik Schumacher, user21
If this question can be reworded to fit the rules in the help center, please edit the question.

• If my answer works for you, please consider upvoting and accepting it! – Rebel-Scum Jun 1 at 19:21
• What happens when you plug in r = 10 and the initial condition into the DE and solve for r’? Do you get a numeric value? Or are there undefined symbols? – Michael E2 Jun 1 at 20:37
• It is writing the same equation replacing every parameter with there values except p[r], m[r] and r. – Sovan Jun 2 at 20:47
• You should post complete code that will reproduce the problem. – Michael E2 Jun 5 at 21:17

You need to give values to both of the parameters and define $$\epsilon[r]$$. Doing so, works nicely:

a=1;
r0=1/100;
e[r_]:=1/r
s=NDSolve[{m'[r]==a*r^2 e[r],p'[r]==-(r0/r)*((p[r]+e[r])
(m[r]+a r^3*p[r]))/(r-2r0*m[r]),m==1,p==1},{m,p},{r,10,100}][];

LogPlot[{m[r],p[r]}/.s//Evaluate,{r,10,100},Frame->True,PlotLegends->{"m(r)", "p(r)"}]

Feel free to adapt this to your problem.

• Ok. Thanks for your reply. I will do this and let you know tomorrow. – Sovan Jun 2 at 20:48
• Actually my e[r_] is a little complicated. e[r_]:=3p[r]+4B-(16/27)*mu*T(mu^2-2 mu*T+T^2). where B :=160 and mu := 10^19 – Sovan Jun 5 at 8:25
• I have posted my problem in the answer section of the post. Please check and give me a solution if possible – Sovan Jun 5 at 8:27
• Thee problem in this case is that mu (the Planck mass?) is too large and then Mathematica complains about stiffness. Also, you don't give the value of T in your problem. One possible solution would be to redefine all quantities in terms of mu (ie absorb it), so that you don't have huge numbers. – Rebel-Scum Jun 5 at 15:35
• Btw, for future reference, please always try to post questions will fully working code (=all definitions and values for all parameters) as otherwise we cannot fix the code. – Rebel-Scum Jun 5 at 15:36