Student Support Forum: 'Smart way to deal with NDSolve variable paramet...' topicStudent Support Forum > General > Archives > "Smart way to deal with NDSolve variable paramet..."

 < Previous Comment | Next Comment > Help | Reply To Comment | Reply To Topic
 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: ,

 Subject (listing for 'Smart way to deal with NDSolve variable paramet...') Author Date Posted Smart way to deal with NDSolve variable paramet... fpghost 07/24/12 06:19am Re: Smart way to deal with NDSolve variable par... Michael 07/27/12 7:09pm Re: Re: Smart way to deal with NDSolve variable... fpghost 07/30/12 10:45am Re: Smart way to deal with NDSolve variable par... fpghost 07/28/12 03:54am
 < Previous Comment | Next Comment > Help | Reply To Comment | Reply To Topic