Re: intermittent crash on numeric solution of elliptic integral

*To*: mathgroup at smc.vnet.net*Subject*: [mg62718] Re: [mg62653] intermittent crash on numeric solution of elliptic integral*From*: Renan <renan.birck at gmail.com>*Date*: Fri, 2 Dec 2005 05:53:22 -0500 (EST)*References*: <200511300507.AAA00132@smc.vnet.net>*Sender*: owner-wri-mathgroup at wolfram.com

On 11/30/05, Chris Chiasson <chris.chiasson at gmail.com> wrote: > MathGroup, > > The code below shuts down my kernel at seemingly different points in > the plotting process every time I run it. What does it do for you? For me (Mathematica 5.0, Linux) it gives me this: renan@nightfall:~$ math Mathematica 5.0 for Linux Copyright 1988-2003 Wolfram Research, Inc. -- Motif graphics initialized -- In[1]:= f[x_,m_]=Sqrt[(1+0.176*Sin[m]^2*Sin[x]^2)*(1+1.01769*Sin[m]^2*Sin[x]^2)/(1- Sin[m]^2*Sin[x]^2)] g[W_,m_]=W*46381*10^(-6)*Sqrt[1/(-0.0012245+Sin[m]^2)] h[m_?NumericQ]:=NIntegrate[f[x,m],{x,ArcSin[0.002/Sin[m]],Pi/2}] Plot[m[1]/.FindRoot[h[m[1]]\[Equal]g[1,m[1]],{m[1],guess}],{guess,0,1}] 2 2 2 2 (1 + 0.176 Sin[m] Sin[x] ) (1 + 1.01769 Sin[m] Sin[x] ) Out[1]= Sqrt[---------------------------------------------------------] 2 2 1 - Sin[m] Sin[x] In[2]:= 1 46381 W Sqrt[--------------------] 2 -0.0012245 + Sin[m] Out[2]= ---------------------------------- 1000000 In[3]:= In[4]:= 1.000000000000000 Divide::infy: Infinite expression ----------------- encountered. 0 FindRoot::jsing: -8 Encountered a singular Jacobian at the point {m[1]} = {4.16667 10 } . Try perturbing the initial point(s). 1.000000000000000 Divide::infy: Infinite expression ----------------- encountered. 0 FindRoot::jsing: -8 Encountered a singular Jacobian at the point {m[1]} = {4.16667 10 } . Try perturbing the initial point(s). General::ovfl: Overflow occurred in computation. General::ovfl: Overflow occurred in computation. General::ovfl: Overflow occurred in computation. General::stop: Further output of General::ovfl will be suppressed during this calculation. FindRoot::nlnum: The function value {Underflow[] + 266 NIntegrate[f[x, <<6>>2 10 + <<1>>], <<1>>]} is not a list of numbers 266 266 with dimensions {1} at {m[1]} = {-1.2252 10 + 1.33843 10 I}. FindRoot::nlnum: The function value {Underflow[] + 266 NIntegrate[f[x, <<7>>5 10 + <<1>>], <<1>>]} is not a list of numbers 266 266 with dimensions {1} at {m[1]} = {-1.25415 10 + 2.1084 10 I}. FindRoot::nlnum: The function value {Underflow[] + 266 NIntegrate[f[x, <<7>>5 10 + <<1>>], <<1>>]} is not a list of numbers 266 266 with dimensions {1} at {m[1]} = {-1.24295 10 + 1.5737 10 I}. General::stop: Further output of FindRoot::nlnum will be suppressed during this calculation. 1.000000000000000 Divide::infy: Infinite expression ----------------- encountered. 0 General::stop: Further output of Divide::infy will be suppressed during this calculation. FindRoot::jsing: Encountered a singular Jacobian at the point {m[1]} = {0.0325085} . Try perturbing the initial point(s). General::stop: Further output of FindRoot::jsing will be suppressed during this calculation. FindRoot::lstol: The line search decreased the step size to within tolerance specified by AccuracyGoal and PrecisionGoal but was unable to find a sufficient decrease in the merit function. You may need more than MachinePrecision digits of working precision to meet these tolerances. FindRoot::lstol: The line search decreased the step size to within tolerance specified by AccuracyGoal and PrecisionGoal but was unable to find a sufficient decrease in the merit function. You may need more than MachinePrecision digits of working precision to meet these tolerances. FindRoot::lstol: The line search decreased the step size to within tolerance specified by AccuracyGoal and PrecisionGoal but was unable to find a sufficient decrease in the merit function. You may need more than MachinePrecision digits of working precision to meet these tolerances. General::stop: Further output of FindRoot::lstol will be suppressed during this calculation. Plot::plnr: m[1] /. FindRoot[h[m[1]] == g[1, m[1]], {m[1], guess}] is not a machine-size real number at guess = 0.671108. Plot::plnr: m[1] /. FindRoot[h[m[1]] == g[1, m[1]], {m[1], guess}] is not a machine-size real number at guess = 0.648969. Plot::plnr: m[1] /. FindRoot[h[m[1]] == g[1, m[1]], {m[1], guess}] is not a machine-size real number at guess = 0.637992. General::stop: Further output of Plot::plnr will be suppressed during this calculation. but doesn't seem to quit the kernel, instead it produces a seeming strange (to me, but I don't have a deep knowledge of differential equations) graph that can be seen here: http://img528.imageshack.us/img528/7104/graphofmathgroup3sa.jpg What do you think?