Mathematica 9 is now available
Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2004
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

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: [mg47510] Re: [mg47494] Solvability sensitive to small changes in numerical input
  • From: Daniel Lichtblau <danl at wolfram.com>
  • Date: Thu, 15 Apr 2004 03:39:12 -0400 (EDT)
  • References: <200404141116.HAA27286@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

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
> 

When presented with approximate exponents Solve uses heuristics based on 
denominator size to determine whether or not to rationalize (and later 
numericize the resulting exponents). There can be advantages and 
disadvantages to rationalizing these, and trhe goal is to strike a 
balance between obtaining reasonable solutions and not hanging.

If you change the function to print the rationalized exponent it may 
become more clear.

f[a1_, a2_, b_] := With[{c=2*b/(b-1)},
     Print[InputForm[{Rationalize[c,0]}]];
	Solve[b/(1 + (a1*n)^c) + b/(1 + (a2*n)^c) == 2, n]
     ]

InputForm[f[2., 0.05, 6.19]]

{1238/519}

Solve::tdep: The equations appear to involve the variables to be solved 
for in
     an essentially non-algebraic way.

Out[22]//InputForm=
Solve[6.19/(1 + 0.0007880970503582654*n^2.3853564547206165) +
    6.19/(1 + 5.224729892085899*n^2.3853564547206165) == 2, n]

In contrast:

InputForm[f[2., 0.05, 6.20]]

{31/13}

Out[23]//InputForm=
{{n -> -23.872497527916014 - 13.250317078942366*I},
  {n -> -23.872497527916014 + 13.250317078942366*I},
  {n -> 0.18328095526493268 - 0.7078727572270465*I},
  {n -> 0.18328095526493268 + 0.7078727572270465*I}, {n -> 
27.3032423150231}}

If you try

InputForm[Timing[f[2., 0.05, 619/100]]]

you will get an idea of how long it can take with a large denominator. 
What you might instead do is use FindRoot with starting values given by 
the solutions for "nearby" exponents of more modest denominator. Though 
you may lose some solutions this way (I think). If you are only 
interested in the real-valued solution this will not be a problem. For 
example:

InputForm[
   FindRoot[6.19/(1+0.0007880970503582654*n^2.3853564547206165) +
     6.19/(1 + 5.224729892085899*n^2.3853564547206165) == 2,
     {n,27.3032423150231}, PrecisionGoal->12]]

Out[2]//InputForm= {n -> 27.273328531648822}


Daniel Lichtblau
Wolfram Research


  • Prev by Date: Re: Adding hyperlinks to help browser files in function::usage
  • Next by Date: Feynman
  • Previous by thread: Solvability sensitive to small changes in numerical input
  • Next by thread: Re: Solvability sensitive to small changes in numerical input