I've got a set of equations of motion here (describing the interior of a charged black hole, if you're interested). It's just four first order ODEs, so Mathematica should be able to solve this easily but I'm not really sure how to interpret the errors it's giving me.
Here is my code:
Q = .0025;
M = 1;
bi = .127;
xi = Q/(4*3.1416);
deqns = {eps1'[T] == 32*3.1416/bi (eps3[T]*a3[T]/(eps1[T]) + a1[T]),
eps3'[T] == 16*3.1416 (eps3[T]*a1[T]/eps1[T]),
a1'[T] == 32*3.1416/bi*(eps3[T]*a3[T]*a1[T]/(eps1[T])^2),
a3'[T] == 16*3.1416 (a3[T]*a1[T]/(eps1[T]*bi) - 3.1416*bi*(xi^2 + 4)/eps3[T]^2)};
T0 = M + (M^2 - Q^2)^.5 - .0001;
Tf = M - (M^2 - Q^2)^.5 + .0001;
B0 = 2 M/T0 - 1 - Q^2/T0^2;
Bdot0 = 2 Q^2/T0^3 - 2 M/T0^2;
N0 = T0^2/(Abs[T0^2*B0])^.5;
ics = {eps3[T0] == T0^2,
eps1[T0] == (T0^2*B0)^.5,
a1[T0] == -bi/N0,
a3[T0] == -bi*Bdot0/(2*N0*(B0)^.5)};
sol = NDSolve[{deqns, ics}, {eps1, eps3, a1, a3}, {T, Tf, T0}]
To which Mathematica replies with:
NDSolve::nlnum: The function value {112.87,5.21436,-3554.23,6.38373 +16 pi} is not a list of numbers with dimensions {4} at {T, a1[T], a3[T], eps1[T], eps3[T], (a1^[Prime])[T], (a3^[Prime])[T], (eps1^[Prime])[T], 16 pi} = {1.9999, -.000449047, 0.0158774, 0.0141418, 3.99959, 0., 0., 0., 0.}.
NDSolve::icfail: Unable to find initial conditions that satisfy the residual function within specified tolerances. Try giving initial conditions for both values and derivatives of the functions. >>
These error messages are disturbing to me for two reasons:
I'm not sure why there's a
16 piin there. Whenever I put in π, I put it in as 3.1516, not as a symbol like what appears in that error message.It's asking that I "Try giving initial conditions for both values and derivatives of the functions" but these are first order differential equations! I should not need to give initial values of the derivative, only the function.
Can anyone spot what went wrong? Am I just using NDSolve wrong?
The singularity at T=1.9998948863867934 is fine, that's the event horizon of the black hole
– Mason Apr 07 '16 at 00:50Quit[]command. – MarcoB Apr 07 '16 at 00:54ClearandRemove. Maybe read the "Lingering Definitions: when calculations go bad" part of this link: http://mathematica.stackexchange.com/questions/18393/what-are-the-most-common-pitfalls-awaiting-new-users (btw this link is awesome, read it!) – MathX Apr 07 '16 at 00:56Is that a problem in mathematica?
– Mason Apr 07 '16 at 01:19Plot[eps3[T] /. sol, {T, Tf, T0}]are meaningless, becausesolis valid only very nearT = 2. – bbgodfrey Apr 07 '16 at 01:36