Mathematica Asked on April 14, 2021
I have solved a SDE with ParametricNDSolve:
s = ParametricNDSolve[
{p1, m1, p0, m0}, {P, m}, {r, 0, 1}, {m, k, e, Cnew}
]
And now I want to treat the parameters m, k, e, Cnew
as variables because I want to evaluate conditions like P[m, k, e, Cnew][1] == 0
.
How can I plot the condition (for example) P[m, k, 1, 1][1] == 0
?
I have tried doing:
f[r_, m_, k_, e_, Cnew_] := Evaluate[P[m_, k_, e_, Cnew_][r] /. s]
But, using NSolve
(with k = 1
, for example):
NSolve[f[1, m, 1, 1, 1] == 0, m]
I get: {}
I have also done the plot for k=1
:
Plot[f[1, m, 1, 1, 0] , {m, 0, 11}]
getting good results for k=1
.
Edit:
Runnable code with a simpler example:
p1 = P'[r] == -m*r + k*r^2;
p0 = P[0] == 1;
s = ParametricNDSolve[{p1, p0}, {P}, {r, 0, 1}, {m, k}];
f[r_, m_, k_] := Evaluate[P[m, k][r] /. s]
NSolve[f[r, 1, 1] == 0, r] (*That's ok*)
NSolve[f[1, m, 1] == 0, m] (*But this...*)
NSolve[f[1, m, k] == 0, m] (*And this... that is what I really want*)
Plot[f[1, m, 1], {m, 0, 5}] (*But this works!*)
I’m searching the expression m = m(k) from f[1, m, k] == 0
Get help from others!
Recent Questions
Recent Answers
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP