Re: Solvability sensitive to small changes in numerical input
- To: mathgroup at smc.vnet.net
- Subject: [mg47534] Re: Solvability sensitive to small changes in numerical input
- From: drbob at bigfoot.com (Bobby R. Treat)
- Date: Thu, 15 Apr 2004 03:40:17 -0400 (EDT)
- References: <c5j7sp$r29$1@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
I don't know if this gets you all the solutions you want, but here goes... First, here's a simplifying transformation (and its inverse): b/(1 + (a1*n)^c) + b/(1 + (a2*n)^c) == 2 % /. {n -> nn/a1, a2 -> a*a1} % /. {nn -> a1*n, a -> a2/a1} (outputs suppressed) Here's a solver and a check routine: Clear[f, check] f[a1_, a2_, b_] := FullSimplify[ Block[{Message}, Solve[b/(1 + nn^c) + b/(1 + a^c*nn^c) == 2, nn]] //. {(nn -> y_) -> n -> y/a1, a -> a2/a1, c -> 2*(b/(b - 1))}] f[x_List] := f @@ x check[a1_, a2_, b_] := Print[TableForm[Chop[{a1, a2, b, c, n, b/(1 + (a1*n)^c) + b/(1 + (a2*n)^c) - 2} /. f[a1, a2, b] /. c -> 2*(b/(b - 1))], TableHeadings -> {None, {"a1", "a2", "b", "c", "n", "error"}}, TableAlignments -> Center]]; check[x:{__List}] := Scan[check, x] check[x_List] := check @@ x Here's a test for the inputs you mentioned: args = {2., 0.05, #} & /@ {6.19, 6.2, 6.21}; check@args[[1]] check@args (output suppressed) Bobby "Gareth J. Russell" <gjr2008 at columbia.edu> wrote in message news:<c5j7sp$r29$1 at smc.vnet.net>... > 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