| Author |
Comment/Response |
Michael
|
07/27/12 7:09pm
Perhaps something like this:
Clear[y];
eqn[a_, b_, c_] := a $y''[r] + b $y'[r] + c $y[r] == 0;
init[a_, b_, c_] := a + b + c;
dinit[a_, b_, c_] := a b c;
y[a_, b_, c_] := y[a, b, c] = First[$y /. NDSolve[Evaluate@{eqn[a, b, c], $y[0] == init[a, b, c], $y'[0] == dinit[a, b, c]}, $y, {r, 2, 10000}]]
Test:
Plot[Evaluate[y[2.7, -0.1, 0.1][r]], {r, 2, 155}]
Note the different symbols for the solution y[a,b,c] and the DE function $y. Also note the use of patterns y[a_, b_, c_] (the underscores, that is).
URL: , |
|