Re: Solve and Reduce
- To: mathgroup at smc.vnet.net
- Subject: [mg52150] Re: [mg52128] Solve and Reduce
- From: DrBob <drbob at bigfoot.com>
- Date: Fri, 12 Nov 2004 02:14:09 -0500 (EST)
- References: <200411100834.DAA10359@smc.vnet.net> <200411110953.EAA28876@smc.vnet.net>
- Reply-to: drbob at bigfoot.com
- Sender: owner-wri-mathgroup at wolfram.com
Possibly this is the function you need:
eq = 2500*c^2 - 25*c^3 + 3500*c*q -
320*c^2*q - 1104*c*q^2 - 1152*q^3 == 0;
qroot[c_] = Which @@
Cases[Reduce[{eq, c >
0, q > 0}, q], And[a_, Equal[q, c_]] :> Sequence[a, c]]
Which[Inequality[0, Less, c,
LessEqual,
(5*(-109199 + 1497*
Sqrt[5489]))/2744],
Root[-2500*c^2 + 25*c^3 -
3500*c*#1 + 320*c^2*#1 +
1104*c*#1^2 + 1152*#1^3 & ,
3],
(5*(-109199 + 1497*
Sqrt[5489]))/2744 < c <
100, Root[-2500*c^2 +
25*c^3 - 3500*c*#1 +
320*c^2*#1 + 1104*c*#1^2 +
1152*#1^3 & , 1]]
Plot[qroot@c, {c, 0, 100}]
Bobby
On Thu, 11 Nov 2004 04:53:03 -0500 (EST), Carol Ting <tingyife at msu.edu> wrote:
>
> Hello list,
>
> I want to find q as a function of c, q(c), given the following
> equation:
>
> 2500*c^2 - 25*c^3 + 3500*c*q - 320*c^2*q - 1104*c*q^2 - 1152*q^3 == 0
>
> However, each of the following three methods gives different results.
> I check the Mathematica Book but still cannot figure out why there are
> such differences. Could someone please explain this to me? Thanks a
> lot!
>
> (1) Use "Reduce"
>
> In[5]:=
> q1[c_] = Reduce[{2500*c^2 - 25*c^3 +3500*c*q - 320*c^2*q -1104*c*q^2
> -1152*q^3 == 0, c > 0,q > 0}, q]
>
> Out[5]=
> 0<c<=(5*(-109199 + 1497*Sqrt[5489]))/2744] &&q == Root[-2500*c^2 +
> 25*c^3 - 3500*c*#1 + 320*c^2*#1 + 1104*c*#1^2 + 1152*#1^3 & ,3] ||
> (5*(-109199 + 1497*Sqrt[5489]))/2744 < c < 100 && q ==Root[-2500*c^2 +
> 25*c^3 -3500*c*#1 + 320*c^2*#1 + 1104*c*#1^2 + 1152*#1^3 & , 1]
>
> In[6]:=
> Plot[Root[-2500*c^2 + 25*c^3 - 3500*c*#1 + 320*c^2*#1 + 1104*c*#1^2 +
> 1152*#1^3 & ,1], {c, 0, 100}]
> Plot[Root[-2500*c^2 + 25*c^3 - 3500*c*#1 + 320*c^2*#1 + 1104*c*#1^2 +
> 1152*#1^3 & ,3], {c, 0, 100}]
>
> Out[6]=
> Graphics[]
>
> Out[7]=
> Graphics[]
>
>
> (2) Use "Solve" and Immediate assignment
>
> In[32]:=
> qdroot1[c_] = q /. Solve[2500*c^2 - 25*c^3 + 3500*c*q - 320*c^2*q -
> 1104*c*q^2 - 1152*q^3 == 0,q][[1]]
> qdroot3[c_] = q /. Solve[2500*c^2 - 25*c^3 + 3500*c*q - 320*c^2*q -
> 1104*c*q^2 - 1152*q^3 == 0,q][[3]]
>
> In[34]:=
> Plot[qiroot1[c], {c, 0, 100}]
>
> Out[34]=
> Graphics[]
>
> In[35]:=
> Plot[qiroot3[c], {c, 0, 100}]
>
> Out[35]=
> Graphics[]
>
> (3) Use "Solve" and delayed assignment
>
> In[28]:=
> qdroot1[c_] := q /. Solve[2500*c^2 - 25*c^3 + 3500*c*q - 320*c^2*q -
> 1104*c*q^2 - 1152*q^3 == 0,q][[1]]
> qdroot3[c_] := q /. Solve[2500*c^2 - 25*c^3 + 3500*c*q - 320*c^2*q -
> 1104*c*q^2 - 1152*q^3 == 0,q][[3]]
>
> In[30]:=
> Plot[qdroot1[c], {c, 0, 100}]
>
> Out[30]=
> Graphics[]
>
> In[31]:=
> Plot[qdroot3[c], {c, 0, 100}]
>
> Out[31]=
> Graphics[]
>
>
> Carol
>
>
>
>
--
DrBob at bigfoot.com
www.eclecticdreams.net
- References:
- Solve and Reduce
- From: "Carol Ting" <tingyife@msu.edu>
- Solve and Reduce