Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.soft-sys.math.mathematica > #7824
| From | gac <g.crlsn@gmail.com> |
|---|---|
| Newsgroups | comp.soft-sys.math.mathematica |
| Subject | NDSolve for BVP: Increasing MaxIterations, reverse direction |
| Date | 2012-01-14 22:14 +0000 |
| Organization | Steven M. Christensen and Associates, Inc and MathTensor, Inc. |
| Message-ID | <jesunh$cjb$1@smc.vnet.net> (permalink) |
I am trying to solve a boundary value problem with NDSolve. I have two questions:
1. How do I increase MaxIterations?
2. Can I reverse the direction of integration of NDSolve?
My Mathematica 8 notebook to solve the modified spherical Bessel equation is appended below. I am comparing the NDSolve solution to the exact solution BesselI[2,r]/Sqrt[r]. In fact, for this exercise, I'm trying to force NDSolve to give me the exact solution. I also include a parameter sigma that should evaluate to 1.
I can't seem to get around the error message: "FindRoot::cvmit: Failed to converge to the requested accuracy or precision within 100 iterations." How do I increase MaxIterations in NDSolve?
Also, I think I might get a better result if NDSolve would integrate from rEnd to r0 instead of r0 to rEnd. Can I specify that NDSolve should solve the problem in the reverse direction?
Thanks very much.
gac
rTiny = 10^-12;
r0 = rTiny;
rEnd = 1;
\[Phi]Exact[r_] := Sqrt[Pi/(2 r)] BesselI[2, r];
\[Phi]0 = \[Phi]Exact[r0];
\[Phi]p0 = D[\[Phi]Exact[r], r] /. r -> r0;
\[Phi]End = \[Phi]Exact[rEnd];
sol = NDSolve[{r^2 \[Phi]''[r] + 2 r \[Phi]'[r] - r^2 \[Phi][r] == 2 \[Sigma][r] \[Phi][r], \[Sigma]'[r] == 0, \[Phi][r0] == \[Phi]0, \[Phi]'[r0] == \[Phi]p0, \[Phi][rEnd] == \[Phi]End}, {\[Phi], \[Sigma]}, r, WorkingPrecision -> 20];
Plot[{\[Phi][r] /. First[sol], \[Phi]Exact[r]}, {r, 0, rEnd}, PlotStyle -> {Red, Blue}]
\[Sigma][0] /. First[sol]
Back to comp.soft-sys.math.mathematica | Previous | Next | Find similar | Unroll thread
NDSolve for BVP: Increasing MaxIterations, reverse direction gac <g.crlsn@gmail.com> - 2012-01-14 22:14 +0000
csiph-web