Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

I apologize for how messy this explanation will be.

I would like to take a differential equation and iterate that solution over a range of coefficient values. The second part of this is that the coefficient is a function of a third variable (which is not involved, and should be (mostly) decoupled from the PDE. Thus, the output from the NDSolve should (I believe) be a list of InterpolatingFunctions with the same index as fRCP.

Is there a way to perform this? Here is my code at the moment.

Dif = 2300; aB = 9.81; rmin = 10^-8; rmax = 10*aB;
fRCP[z_] = Exp[(.00001*Range[1, 30])*z]
pde := D[IIz[r, t], t] == Dif/r*D[IIz[r, t]*r, r, r] - 
 (.366529*fRCP[1][[30]] Exp[(4 r)/aB])^-1*(IIz[r, t] + -1.16107)
iv = {IIz[r, 0] == 0}
bcs = {IIz[rmax, t] == 0, Derivative[1, 0][IIz][rmin, t] == 0}
soln = NDSolve[{pde, iv, bcs}, IIz, {r, rmin, rmax}, {t, 0, 10}, 
 PrecisionGoal -> 8]

I have managed to do this with a ReplaceAll in a DSolve situation by leaving f as an undefined variable (same problem, with Dif = 0), but that trick doesn't work in the NDSolve case… non-numeric argument and whatnot.

fRCP[z] is a list of equations of the form Exp[-a*z], where each a is an element of a previously defined list. I've populated it with a sample list at the moment.

Bonus points if you can show me a way to define the first boundary for all $r ≥ rmax$… It seems to choke when I define it over a range, or at multiple points, since those are no longer "boundaries".

For reference, the solution with Dif=0 looks like this:

$$1.16107 \left(1 - e^{(-2.7283t\cdot e^{\ (-0.407747\ r\ -\ 0.0003\ z)}} \right)$$

Thus, going to $\infty$, the solution should decay to $0$ in $r$ and $z$, and cap out at 1.16107 in $t$.

share|improve this question
It will be best to set up the problem as a Module. If you define a Module in the following form: sols[parameters_,initialvalueparameters_,boundarparameters]:=Module[{},IIz[r,t]‌​/.NDSolve[{{pde[parameters], iv[initialvalueparameters],bcs[boundarparameters]}}, IIz,{r,rmin,rmax},{t,0,10}][[1]]] or similar where you can pass the parameters into your equation, your initial values and your boundary conditions (as you need them), that will allow you to call the solution with whatever inputs you want. If this is what you want but the syntax above doesn't make sense, please ask. –  Jonathan Shock May 30 '13 at 23:56
add comment

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.