I am trying to solve a differential equation numerically. So I have
zSolutionRule = NDSolve[
{
z''[x]*z[x] - z'[x]^2 - z[x]^2 - p0[x]*z[x]^3 == 0,
p0'[x] == 0,
z'[0]*E == z'[1],
z[0] == 1,
z[1] == E
},
{z, p0}, {x, 0, 1}
];
When I run this, though, I get an "infinite expression $\frac{1}{0}$ encountered" error, but I want to get the solution to the differential equation. How do I get NDSolve to give me the solution like it does with other differential equations? (I am using Mathematica 9.0.0.0.)
Background
At first I solved a related differential equation
ySolutionRule = NDSolve[
{y''[x] - 1 - p0[x]*Exp[y[x]] == 0,
p0'[x] == 0,
y'[0] == y'[1],
y[0] == 0,
y[1] == 1
},
{y, p0}, {x, 0, 1}
];
ySolution = y /. ySolutionRule[[1, 1]];
chargeNormalization = (p0 /. ySolutionRule[[1, 2]])[.5];
and this worked just fine, but I figured I could try to change variables to see if eliminating the exponential would change how good the solution is if I change boundary conditions when y[1] is big.
So I rewrote the equation in terms of $z=e^y$. I can check that the exponential of ySolution satisfies the transformed differential equation and boundary conditions:
zSol[x_] := Exp[ySolution[x]];
zSol[1]/zSol[0] - E
zSol[0] - 1
zSol[1] - E
and
Plot[zSol''[x]*zSol[x] - zSol'[x]^2 - zSol[x]^2 -chargeNormalization*zSol[x]^3, {x, 0, 1}]
It does, up to some accuracy. So then I tell it to find my solution but instead, it gives me an infinite expression error.
p0
is a constant ... $\endgroup$p0
is a constant because I have the equationp0'[x]==0
. However, I don't know what the value of the constant is before I call NDSolve; NDSolve is supposed to figure that out for me. I think you are with me in wishing there were a better way of telling NDSolve thatp0
was just a constant, but I couldn't find one. I think there might not be one because the pattern I used is given in the documentation: http://reference.wolfram.com/mathematica/tutorial/NDSolveBVP.html#3518691 $\endgroup$