Re: Solving Polynomial equation
- To: mathgroup at smc.vnet.net
- Subject: [mg100964] Re: Solving Polynomial equation
- From: Francesco <b.gatessucks at gmail.com>
- Date: Thu, 18 Jun 2009 20:48:16 -0400 (EDT)
- References: <h1cv3h$j9f$1@smc.vnet.net>
In[3]:= parameters = Import["/tmp/input.xls"][[1]]
Out[3]= {{1., 2., 3.}, {4., 5., 6.}, {7., 8., 9.}}
In[52]:= solution =
Flatten[#] & /@ ({#,
Solve[#.{ x^2, x, 1} == 0, x][[All, All, 2]]} & /@ parameters)
Out[52]= {{1., 2., 3., -1. - 1.41421 I, -1. + 1.41421 I}, {4., 5.,
6., -0.625 - 1.05327 I, -0.625 + 1.05327 I}, {7., 8.,
9., -0.571429 - 0.979379 I, -0.571429 + 0.979379 I}}
In[53]:= Export["/tmp/output.xls", solution]
Out[53]= "/tmp/output.xls"
-Francesco
On 06/18/2009 09:49 AM, kosal lee wrote:
> Hello
>
> I need help and I am new to Mathematica.
>
> Suppose I want to solve for the equation: aX^2 + bx +c ==0, however
> I have a list of parameters a and b in my microsoft excel where a and b are columns and its value are in rows.
>
> I dont want to key every a and b each time to find the root of above equation.
>
> Are there anyway to tell Mathematica to import each a and b value from excel, put it in the above equation, and find its root
> and it export the list of results back to excel?
>
>
> Thank you.
> Best Regards,
> Kosal
>
>