I want to solve and visualize system with a parameter using the following code:
L = 10
sol = ParametricNDSolve[{y'[t] == Sqrt[(k^4)/(y[t]^4) - 1],
y[0] == 0, Integrate[y[x]^(-2), {x, 0, L0}] == L/(k^2)}, {y[t],
k}, {t, 0, L0}, {L0}]
Manipulate[Plot[Evaluate[y[L0][t] /. sol], {t, 0, L}], {L0, 2, 3}]
However, I got an empty plot and no error or warning message. Why can it happen?
If there is no solution, should not there be an error message?
hdolhaine
(Hans Dolhaine)
2
What is the value of k? Did you define it somewhere?
It should be defined from the second equation.
Integrate[y[x]^(-2), {x, 0, L0}] == L/(k^2)
On the other hand, it can be defined as y(L0), but with this expression it does not work either.
hdolhaine
(Hans Dolhaine)
4
Well, I have Mma 7, it doesn’t know PrametricNDSolve. But may be you should give the Parameter explicitly according th the synthax
sol = ParametricNDSolve[{y'[t] == Sqrt[(k^4)/(y[t]^4) - 1], y[0] == 0}, {y[t], k}, {t, 0, L0}, {L0, k /. Flatten[
Solve[Integrate[y[x]^(-2), {x, 0, L0}] == L/(k^2), k]]}]
But I can’t test ihat with my old version.
Unfortunately this does not work.
The error is: << expression for k >> cannot be used as a parameter.