MathGroup Archive 2005

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: How to cope with tiny numbers in FindRoot

  • To: mathgroup at smc.vnet.net
  • Subject: [mg63195] Re: How to cope with tiny numbers in FindRoot
  • From: Jean-Marc Gulliet <jeanmarc.gulliet at gmail.com>
  • Date: Sat, 17 Dec 2005 03:46:35 -0500 (EST)
  • Organization: The Open University, Milton Keynes, UK
  • References: <dnrn37$pvo$1@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

dkjk at bigpond.net.au wrote:
> Hi group,
> 
> I'm trying to numerically determine the solution of an equation whose
> coefficients are of the order 10^-100 or less. I've been running into
> all sorts of errors relating to MaxIterations and step size but so far
> I haven't been able to find any useful information in the Mathematica
> book. If you're interested in the notebook i'm using, you can find it
> here:
> 
> http://users.bigpond.net.au/jdstokes/theory2.nb
> 
> Thanks
> 
> James.
> 

Hi James,

You might try Ted Ersek's package _RootSearch_ 
(http://library.wolfram.com/infocenter/MathSource/4482/)

You will have to tweak the min-, max-values (I have just added + or - 1 
to Q/50 in the following example)

In[24]:=
Needs["Ersek`RootSearch`"]
a = 0.5*λ;
ϵ = 8.85418782/10^12;
M = 1500*(4/3)*Pi*(10^(-6))^3;
Q = (8*10^3*1.6)/10^19;
λ = ScientificForm[6.06992/10^4];
l = 1.5*λ;
δ = l;
z0w = (l*q*Q)/(3*((-q)*Q - 4*a^3*M*Pi*ϵ*Ï?z^2)) + 
(2^(1/3)*l^2*q^2*Q^2)/(3*((-q)*Q - 4*a^3*M*Pi*ϵ*Ï?z^2)*
       (2*l^3*q^3*Q^3 + 54*a^3*q^2*Q^4 + 432*a^6*M*Pi*q*Q^3*ϵ*Ï?z^2 + 
864*a^9*M^2*Pi^2*Q^2*ϵ^2*Ï?z^4 +
         Sqrt[-4*l^6*q^6*Q^6 + (2*l^3*q^3*Q^3 + 54*a^3*q^2*Q^4 + 
432*a^6*M*Pi*q*Q^3*ϵ*Ï?z^2 + 864*a^9*M^2*Pi^2*Q^2*ϵ^2*Ï?z^4)^2])^(1/3)) +
     (1/(3*2^(1/3)*((-q)*Q - 4*a^3*M*Pi*ϵ*Ï?z^2)))*(2*l^3*q^3*Q^3 + 
54*a^3*q^2*Q^4 + 432*a^6*M*Pi*q*Q^3*ϵ*Ï?z^2 + 
864*a^9*M^2*Pi^2*Q^2*ϵ^2*Ï?z^4 +
        Sqrt[-4*l^6*q^6*Q^6 + (2*l^3*q^3*Q^3 + 54*a^3*q^2*Q^4 + 
432*a^6*M*Pi*q*Q^3*ϵ*Ï?z^2 + 864*a^9*M^2*Pi^2*Q^2*ϵ^2*Ï?z^4)^2])^(1/3);
z01w = Q^2/(4*Pi*ϵ*M*Ï?z^2*z0w^2);
z02w = z0w + z01w;
Ï?0 = ((Q^2 - q*Q)/(2*Pi*ϵ*M*Ï?Ï?^2))^(1/3);
matrix = Table[(q /. RootSearch[Q^2/(4*Pi*ϵ*Abs[z0w]) - 
((q*Q)/(4*Pi*ϵ*a))*(3/2 - (z0w + l)^2/(2*a^2)) + (1/2)*M*Ï?z^2*(z01w^2 + 
z02w^2) ==
        Q^2/(4*Pi*ϵ*Abs[Ï?0]) - (2*q*Q)/(4*Pi*ϵ*Sqrt[Ï?0^2 + l^2]) + 
(1/4)*M*Ï?Ï?^2*Ï?0^2, {q, Q/50 - 1, Q/50 + 1}])/Q, {Ï?Ï?, 1, 100, 10},
    {Ï?z, 1, 100, 10}]

Out[36]=
{{{0.}, {-0.0016111152916347766}, {-0.005740528887216293}, 
{-0.012460605830061125}, {0.349097510366331}, {0.29373557160929825}, 
{0.2884984538041865},
    {0.3038207893314299}, {0.33038020615288166}, {0.3646755778063625}}, 
{{-0.00007883601728810849, 0.00006939859831010466},
    {-0.002803602057857448, 7.499458679787099*^-19}, 
{-0.008220077206347664}, {-0.01635135577818561}, 
7.812500000000001*^14*q, {0.23787111178066903},
    {0.23643585847957038}, {0.25542542492143594}, {0.2854806387928775}, 
{0.3235450575953669}}, {{-0.00010879816094036117, 0.0001094716453960563},
    {-0.003603942180656794, 0.002275281457182907}, 
{-0.009966753710831833, 3.500440770241344*^-18}, 
{-0.019071958853723786}, {-0.030963450349193178},
    {0.18703291645704367}, {0.1909230918436405}, {0.21326087798840074}, 
{0.2456693108748114}, {0.2858279837328008}},
   {{-0.0001318702050215466, 0.00014121586912823375}, 
{-0.0042282503838544806, 0.004210932610281858}, {0.008073470613731475}, 
{-1.0585359450960141*^-17},
    {0.17314362860986238}, {0.13318026426216859}, {0.14507169213263565}, 
{0.17112117999294835}, {0.20546680730589917}, {0.2469205771980049}},
   {{-0.00015127952559178557, 0.00016845716065659534}, 
{0.005959932134658161}, {0.015844853411969142}, {-0.023152953420261354, 
0.02829692844857287},
    {-2.327607751188553*^-17}, {0.07326722215804862}, 
{-0.07201328131822787}, {-0.09412827017644837}, {-0.1192374072285775}, 
{-0.14738642441648844}},
   {{-0.0001683258592438477, 0.00019275792339164296}, 
{-0.005211201966165235, 0.007587152907123183}, {-0.013582751694732375, 
0.02357245002852207},
    {0.0667272969750249}, 7.812500000000001*^14*q, 
{1.9406576145175606*^-17}, {0.04984314392466543}, {0.0858247246161567}, 
{0.12355436786509688},
    {0.16609677013508073}}, {{-0.0001836867027999669, 
0.00021494092875478293}, {-0.005622304354225106, 0.009127401923420007},
    {-0.014515345940576163, 0.031371239260005755}, 
{-0.026302641230778953, 0.14420208670723567}, {-0.04092971300440222}, 
7.812500000000001*^14*q,
    {-0.07881179579985417}, {0.042912257026061586}, 
{0.08229697532667143}, {0.12483730833065236}}, 
{{-0.00019776799112002896, 0.0002355032124546064},
    {0.010601929501706612}, {-0.015366502283537843, 
0.039317382332850745}, 7.812500000000001*^14*q, {-0.042820510828263714}, 
{-0.06084159847512572},
    7.812500000000001*^14*q, {-2.006482319606745*^-18}, 
{0.041076416376020115}, {0.0833130840482211}},
   {{-0.00021083554882544327, 0.0002547725107744279}, 
{-0.006343549145695646, 0.012024836554728474}, {0.04747079142306803}, 
{-0.02892747766025695},
    7.812500000000001*^14*q, {-0.06308457169236885}, 
7.812500000000001*^14*q, {-0.042656178154645834}, 
{-1.2456618362686068*^-16}, {0.04166023768945603}},
   {{-0.0002230745934504934, 0.0002729785522948341}, 
{-0.006666410943481994, 0.01340604525412351}, {0.0558842165827395}, 
{-0.03010326920831393},
    7.812500000000001*^14*q, {-0.06517837496761948}, 
{-0.08706358908126399}, 7.812500000000001*^14*q, {-0.04086114388024784}, 
{-1.5194800356148773*^-17}}}

Hope this helps,
/J.M.


  • Prev by Date: Re: EUREKA Re: Types in Mathematica, a practical example
  • Next by Date: EUREKA Re: Types in Mathematica, a practical example
  • Previous by thread: How to cope with tiny numbers in FindRoot
  • Next by thread: Re: How to cope with tiny numbers in FindRoot