# Constraint Problem with NDSolve

I have a problem concerning an NDSolve solution, the code is the following:

Quintessence2[V1_]:=Module[
{x1,x2,x3,λ,ϕ,V,Γ,N1,κ,G=6.67259*10^-11,α=1},
κ=Sqrt[8 π G];
λ[N1]=(ϕ[N1])^-1/κ;
Γ=-2;
NDSolve[
{
D[x1[N1,ϕ],N1]==-3 x1[N1,ϕ]+Sqrt[6]/2 λ[N1] (x2[N1,ϕ])^2+1/2 x1(3+3(x1[N1,ϕ])^2-3(x2[N1,ϕ])^2+(x3[N1,ϕ])^2),
D[x2[N1,ϕ],N1]==-(Sqrt[6]/2)λ[N1] x1[N1,ϕ] x2[N1,ϕ]+1/2 (x2[N1,ϕ])(3+3(x1[N1,ϕ])^2-3(x2[N1,ϕ])^2+(x3[N1,ϕ])^2),
D[x3[N1,ϕ],N1]==-2(x3[N1,ϕ])+1/2 (x3[N1,ϕ])(3+3(x1[N1,ϕ])^2-3(x2[N1,ϕ])^2+(x3[N1,ϕ])^2),
D[λ[N1],N1]==-Sqrt[6] (λ[N1])^2 (Γ-1)(x1[N1,ϕ]),

x1[Log[1/(1+2*10^7)]]==5*10^-5,
x2[Log[1/(1+2*10^7)]]==10^-8,
x3[Log[1/(1+2*10^7)]]==0.9999,
ϕ[Log[1/(1+2*10^7)]]==1/(κ 10^9)

},
{x1,x2,x3,ϕ},
{N1,0.0000000000001,N[Log[1/(1+2*10^7)]]}
]
]


The module part does nothing in particular, it mostly is there to protect the symbols, but when I evaluate this code by:

NDSolve::ndnco: The number of constraints (1) (initial conditions) is not equal to the total differential order of the system plus the number of discrete variables (4).


Which I don't really understand since it looks like a simple ruleset as expected, but it is clearly heaving issues, any help would be appreciated

• I'm not sure what precisely is going on with NDSolve, but if you just look at the generated equations, there's the use of \[Lambda] as a function (it's just a number, specifically 0) and a division by zero (Indeterminate) in the ODE for \[Lambda], probably since it's just a number. Commented Apr 3, 2018 at 13:51
• Thanks for the heads up, lambda was indeed not a function of N1, which it should be, but the problem is that I still get the same error. will update the question Commented Apr 3, 2018 at 13:57
• You did not mention the division by zero error. That's the one you have to track down, first. Commented Apr 3, 2018 at 13:57
• Thanks for the comments! devision by zero is solved now, but now there are initial condition problems(it say there 1 constraint, and 4 discrete variables), edited the thing again Commented Apr 3, 2018 at 14:18
• You don't parameterize x1, x2, and x3 consistently; get rid of the \[Phi] for the xs in the first four equations, and make sure that x1 appears as x1[N1] in that first equation. NDSolve will work (though the equation is badly behaved and it blows up after a few steps). Commented Apr 3, 2018 at 14:56