MathGroup Archive 2009

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Solving Polynomial equation

  • To: mathgroup at smc.vnet.net
  • Subject: [mg101000] Re: [mg100901] Solving Polynomial equation
  • From: kosal lee <leekosal at yahoo.com>
  • Date: Fri, 19 Jun 2009 20:49:03 -0400 (EDT)
  • References: <200906180850.EAA19763@smc.vnet.net> <4A3AB85F.5010306@math.umass.edu>

Thank you for your answer.

Kosal





________________________________
From: Murray Eisenberg <murray at math.umass.edu>
To: mathgroup at smc.vnet.net
Sent: Friday, June 19, 2009 6:57:51 AM
Subject: [mg101000] Re: [mg100901] Solving Polynomial equation

Let's say your Excel spreadsheet is abc.xls and it's in directory e:\temp.  Assume it has column headers a, b, c in row 1 and then the data in columns below. (You didn't mention values of the constant c in your quadratic, but I'll assume you have those, too; if not, you can readily modify the following.)

  (* say where file is *)
  SetDirectory[e:/temp]

  (* import spreadsheet data *)
  abc = Import["abc.xls",{"Data",1}]

  (* strip off first element, which is column headers *)
  abc = Rest[abc]

  (* set up form of quadratic eq'n in pure function... *)
  (* ... and map onto the abc values *)
  Solve[#[[1]] x^2+#[[2]] x + #[[3]]==0,x]&/@abc

As usual in Mathematica, you'll get the solutions in the form of lists of rules, one list for each {a,b,c} triple.

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
> 
> 

-- Murray Eisenberg                    murray at math.umass.edu
Mathematics & Statistics Dept.
Lederle Graduate Research Tower      phone 413 549-1020 (H)
University of Massachusetts                413 545-2859 (W)
710 North Pleasant Street            fax   413 545-1801
Amherst, MA 01003-9305



  • Prev by Date: Re: Plotting surface with thickness
  • Next by Date: extract coefficients
  • Previous by thread: Re: Solving Polynomial equation
  • Next by thread: Re: Solving Polynomial equation