Hi All,(adsbygoogle = window.adsbygoogle || []).push({});

I'm trying to solve a set of three coupled ODES. I have given initial values for all functions, and I believe I have entered in the code correctly but I still get this error telling me that the derivative operator is not the same length as the number of arguments. What does that mean? And how I fix it? Any and all help is greatly appreciated.

I've included all of my code below. Along with some comments in the lines I think need it. Previously mathematica was giving me an error about the stepsize at r =1, so I just added the option for the first step.

Oh, in case it helps, I'm trying to model a relativistic star. By solving the TOV equations.

In[1]:= n = 1 (*polytropic index*)

Out[1]= 1

In[2]:= \[CapitalGamma] = 1 + 1/n

Out[2]= 2

In[3]:= K1 = 5.3802*10^9 (*polytropic contant in cgs units*)

Out[3]= 5.3802*10^9

In[4]:= Clear[P]

In[5]:= \[Rho]c = 1*10^(15) (*central density of the star, i guessed*)

Out[5]= 1000000000000000

In[6]:= pc = K1 * \[Rho]c^(\[CapitalGamma]) (*central pressure*)

Out[6]= 5.3802*10^39

In[7]:= \[Rho][r_] = (P[r]/K1)^(1/\[CapitalGamma]) (*polytropic equation. different than it usually look because I'm solving it for ρ instead of P. Because I will substitute in ρ for P in the equations below*)

Out[7]= 0.0000136333 Sqrt[P[r]]

In[8]:= M0 = 1.98892*10^33 (*one solar mass in grams*)

Out[8]= 1.98892*10^33

In[9]:= M = 1.4*M0 (*mass of my star*)

Out[9]= 2.78449*10^33

sol = NDSolve[ {D[\[Nu][r], r] == 2*(m[r] + 4*\[Pi]*r^3*P[r])/(r (r - 2*M)),

D[P[r], r] == -(\[Rho][r] + P[r])* ((m[r] + 4*\[Pi]*r^3*P[r])/(r (r - 2*M))),

D[m[r], r] == 4*\[Pi]*r^2*\[Rho][r],

P[1] == pc, m[1] == 0, \[Nu][1] == 11}, {\[Nu], P, m}, {r, 1, 12000},

StartingStepSize → 10]

During evaluation of In[13]:= NDSolve::derlen: The length of the derivative operator Derivative[1] in (\[Nu]^\[Prime])[r] is not the same as the number of arguments. >>

**Physics Forums | Science Articles, Homework Help, Discussion**

The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

# NDSolvederlen: - Mathematica error - TOV equations

Loading...

Similar Threads for NDSolvederlen Mathematica error |
---|

Mathematica Storing Mathematica output |

Mathematica Mathematica to MATLAB |

Mathematica Cannot do the integral of the Hyper-geometric function? |

Mathematica Cannot Plot This Function in Mathematica |

Mathematica While Loop in Mathematica |

**Physics Forums | Science Articles, Homework Help, Discussion**