MathGroup Archive 2004

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

Search the Archive

Re: Solvability sensitive to small changes in numerical input

  • To: mathgroup at smc.vnet.net
  • Subject: [mg47516] Re: [mg47494] Solvability sensitive to small changes in numerical input
  • From: Oleksandr Pavlyk <pavlyk at phys.psu.edu>
  • Date: Thu, 15 Apr 2004 03:39:22 -0400 (EDT)
  • Organization: Penn State University; Department of Physics
  • References: <200404141116.HAA27286@smc.vnet.net>
  • Reply-to: pavlyk at phys.psu.edu
  • Sender: owner-wri-mathgroup at wolfram.com

Hi Gareth,

I think you should use FindRoot instead of Solve.
It is also better suited for numerics. I took
the liberty to  transform your equation slightly

Clear[f];
f[a1_, a2_, b_, prec_:30] := Module[
    {c, t1, t2, t3, n0},
      c = 2*(b/(b - 1));
      t1 = 1/a1^c;
      t2 = 1/a2^c;
      n0 = (b*(t1+t2))^(1/c);
      SetPrecision[
            n /. Assuming[n \[Element] Reals,
                 FindRoot[
                   0 == b*t1*(t2 + n^c) +
                   b*t2*(t1 + n^c) -
                   2*(t1 + n^c)*(t2 + n^c)
                 , {n, n0}]],
      prec]
];

f[2., 0.05, 6.21]

27.3331323380492889896231645253

I have chosen the initial point for the FindRoot, by assuming,
in the first approximation that t1 and t2 are small compared
to n^c.

Best regards,
Sasha

Gareth J. Russell wrote:
> Hi,
> 
> I have a function that includes the Solve command
> 
> f[a1_, a2_, b_] := Module[{c},
>     
>     c = 2*b/(b - 1);
>     
>     Solve[b/(1 + (a1*n)^c) + b/(1 + (a2*n)^c) == 2, n]
>     
> ]    ]
> 
> but it seems very sensitive to the numerical input. For example,
> 
> f[2., 0.05, 6.19]
> 
> and
> 
> f[2., 0.05, 6.21]
> 
> Produce the error "The equations appear to involve the variables to be 
> solved for in an essentially non-algebraic way."
> 
> Whereas
> 
> f[2., 0.05, 6.20]
> 
> produces the solutions
> 
> {{n -> -23.8725 - 13.2503i]}, {n -> -23.8725 + 13.2503i}, {
>   n -> 0.183281 - 0.707873i}, {n -> 0.183281 + 0.707873i]}, {n -> 27.
> 3032}}
> 
> Can anyone enlighten me as to what is going on here? Other peoples' work 
> suggests that, given a1 = 2., it should be possible to get numerical 
> solutions for a large range of values of a2 and b.
> 
> If it makes a differences we make the assumptions a1 > 0, a2 > 0, a2 < 
> a1 and b >= 1.
> 
> Oh, and v5.0.1.0 on Mac OS X
> 
> Thanks!
> 
> Gareth Russell
> 
> Columbia University


  • Prev by Date: Re: Question: ABS and \[Prime]
  • Next by Date: Critical memory leak with J/Link
  • Previous by thread: Re: Solvability sensitive to small changes in numerical input
  • Next by thread: Re: Solvability sensitive to small changes in numerical input