Re: Solve

• To: mathgroup at smc.vnet.net
• Subject: [mg57907] Re: Solve
• From: "Jean-Marc Gulliet" <jeanmarc.gulliet at gmail.com>
• Date: Sun, 12 Jun 2005 04:34:31 -0400 (EDT)
• References: <d8e56e\$gp1\$1@smc.vnet.net>
• Sender: owner-wri-mathgroup at wolfram.com

Hi Rick,

Solve[] tries to get all solutions assuming that the variables and
coefficients are complexes. Therefore

In[1]:=
eqn = -0.13249751088801667 + 0.06632187456026009*r^1 +
0.06629492661634433*r^2 - 0.00005387198125569*
r^3 - 0.00002692675947693*r^4 +
1.324872853*^-8*r^5 + 4.3598855*^-9*r^6 -
3.7184*^-13*r^7 - 4.3768*^-13*r^8 + 1.72*^-15*r^9;

In[2]:=
answer = Solve[eqn == 1.83303, r]

Out[2]=
{{r -> -61.90357130844081 - 40.91171644953396*I},
{r -> -61.90357130844081 + 40.91171644953396*I},
{r -> -59.82559087206599},
{r -> -6.0000033545518106},
{r -> 4.999998407310261}, {r -> 73.55788661519043},
{r -> 82.3157609927675 - 32.39241011754585*I},
{r -> 82.3157609927675 + 32.39241011754585*I},
{r -> 200.90844611453358}}

In[3]:=

Out[3]=
{1.83303000000015 - 5.684341886080802*^-14*I,
1.83303000000015 + 5.684341886080802*^-14*I,
1.8330300000000328, 1.8330300000000006,
1.8330300000000004, 1.8330299999997948,
1.8330300000008037 + 4.831690603168681*^-13*I,
1.8330300000008037 - 4.831690603168681*^-13*I,
1.833030000096187}

In[4]:=
Chop[%]

Out[4]=
{1.83303000000015, 1.83303000000015,
1.8330300000000328, 1.8330300000000006,
1.8330300000000004, 1.8330299999997948,
1.8330300000008037, 1.8330300000008037,
1.833030000096187}

the rules returned by Solve are all correct solutions up to a certain
degree of precision. Solve does not have any ideas about the
restrictions you want to impose to the variable r, corresponding to the
constraints of your model indeed, so it returns all nine solutions.

You can use Reduce to impose some condition on the variable r

In[5]:=
Reduce[{eqn == 1.83303, 0 <= r <= 16}, r]

Out[5]=
r == 4.999998407310261

although you will bet a warning message about the usage of non-exact
coefficients, or

In[6]:=
FindInstance[{eqn == 1.83303, 0 <= r <= 16}, r]
Out[6]=
{{r -> 4.999998407310261}}

• Prev by Date: Re: Mathematica equivalent complexplot
• Next by Date: Re: Portable Notebooks and Filenames[]
• Previous by thread: Re: Solve
• Next by thread: Plot3D slice