# NDSolve with Piecewise : an initial value problem? [closed]

I'm working on differential equations and I first used a potential without Piecewise. But given that I wanted to constrain the values between 0 and 1, I started to use Piecewise in the potential, making walls at 0 and 1.

Mathematica asked me for a new thing then : an initial value problem, that was not needed before. I do not understand what changed. And is there a way to go around that issue ?

Here is the code before :

PotentielPhi4[x_] = -f[x]^2 + alpha*f[x]^4
e=10^(-10)
alpha=2
R=1
sol = NDSolveValue[{Div[f[x] (1 - f[x]) Grad[D[PotentielPhi4[x], f[x]], {x, y, z}, "Spherical"
], {x, y, z},"Spherical" ] == 0, f'[e] == e, f[R] == Sqrt[1/(2*alpha)]}, f, {x, e, R}]


And after :

PotentielPhi4[x_] = Piecewise[{{-f[x]^2 + alpha*f[x]^4, 1 >= x >= 0}, {100, x > 1},
{100, x < 0}}]
e=10^(-10)
alpha=2
R=1
sol = NDSolveValue[{Div[f[x] (1 - f[x]) Grad[D[PotentielPhi4[x], f[x]], {x, y, z}, "Spherical"
], {x, y, z},"Spherical" ] == 0, f'[e] == e, f[R] == Sqrt[1/(2*alpha)]}, f, {x, e, R},
Method -> {"EquationSimplification" -> "Residual"}]


NDSolveValue::bvdae: Differential-algebraic equations must be given as initial value problems. >>

Thx in advance

• (1) The first code throws lots of errors. (2) The specification Method -> {"EquationSimplification" -> "Residual"} tells NDSolve to solve the DE as a DAE, for which an IVP is required. The first case, when it is fixed presumably, will be solved with the shooting method. One might implement a shooting method by hand, instead. – Michael E2 May 23 '18 at 0:38