Re: Solving equation and applying solution(s) expression.
- To: mathgroup at smc.vnet.net
- Subject: [mg84559] Re: Solving equation and applying solution(s) expression.
- From: mattadspam at gmail.com
- Date: Thu, 3 Jan 2008 20:31:23 -0500 (EST)
- References: <flidj5$fcc$1@smc.vnet.net>
On Jan 3, 5:32=A0am, KP <MathematicaU... at gmail.com> wrote:
> Hi Everybody. I am a new subscriber to this group and looking forward
> to learning from folks who use Mathematica. I have a question and some
> help will be appreciated.....
>
> I want to solve an equation and then apply the solution(s) of the
> equation to an expression. For example, I want to solve =A03 x^2 - 2 x +
> 8 =0. Then I want to apply the solutions to the expression =A03 x / (x^3=
> +2).
>
> The equation and the expression above are examples I used to
> illustrate my question. Please use the equation and the expression to
> help me out. Thank you and happy new year!
>
> --KP
You can solve the equation by using the Solve function:
In[1]:= Solve[3 x^2 - 2 + 8 == 0, x]
Out[1]= {{x -> -\[ImaginaryI] Sqrt[2]}, {x -> \[ImaginaryI] Sqrt[2]}}
Then, using the ReplaceAll function, you can replace the instances of
x with the values you found:
In[2]:= ReplaceAll[(3 x/(x^3 + 2)), Solve[3 x^2 - 2 + 8 == 0, x]]
Out[2]= {-(3 \[ImaginaryI] Sqrt[2])/(2 + 2 \[ImaginaryI] Sqrt[2]), (
3 \[ImaginaryI] Sqrt[2])/(2 - 2 \[ImaginaryI] Sqrt[2])}
Or, you could use the shorthand notation for ReplaceAll, "/.":
In[3]:= (3 x/(x^3 + 2)) /. Solve[3 x^2 - 2 + 8 == 0, x]
Out[3]= {-(3 \[ImaginaryI] Sqrt[2])/(2 + 2 \[ImaginaryI] Sqrt[2]), (
3 \[ImaginaryI] Sqrt[2])/(2 - 2 \[ImaginaryI] Sqrt[2])}
Hope that helps!