+ Reply to Thread
Results 1 to 4 of 4

Finding roots of polynomials

  1. #1
    Registered User
    Join Date
    02-07-2015
    Location
    Pennsylvania, US
    MS-Off Ver
    2007
    Posts
    4

    Question Finding roots of polynomials

    Is there a code to program an excel spreadsheet so that if someone typed in the coefficients for a polynomial of up to 4 exponents, excel would be able to find the roots?
    For example:
    f(x)=x^3+9x^2-4x-36
    I would plug 1, 9, -4, -36 into excel and the roots -2, 2, and -9 would show up in the cell

  2. #2
    Forum Guru
    Join Date
    04-13-2005
    Location
    North America
    MS-Off Ver
    2002/XP, 2007, 2024
    Posts
    16,436

    Re: Finding roots of polynomials

    Looks like an extension of this thread: http://www.excelforum.com/excel-gene...ial-roots.html

    Short but useless answer, yes there are several different ways to code -- whether in VBA or with Excel worksheet formulas -- the roots of a polynomial.

    1) If your polynomial will always be 4th degree or less, and you are willing to venture into the realm of complex numbers, there are formulas (similar to the quadratic formula that you learned in your secondary level algebra classes). These formulas, though they exist, tend to be quite complex, so it is not always desirable to use them.
    http://en.wikipedia.org/wiki/Quartic_function
    http://en.wikipedia.org/wiki/Cubic_function

    2) As noted in the other thread, one can readily use Solver or Goal seek to find the roots of polynomials. These methods can be automated through VBA, and we have many examples on this site.

    3) My personal preference with polynomials, is to code a numeric root finding algorithm (Newton Raphson, bisection, or false position, depending on my mood that day) into a User Defined function. With simple polynomials, I personally find it easier to code my own algorithm than to coax Solver to run from VBA. A UDF also has the advantage of being flexible enough to call from any worksheet cell. Since it can be used like any other Excel function, it naturally fits into automated spreadsheet calculations.

    How would you prefer to proceed?
    Quote Originally Posted by shg
    Mathematics is the native language of the natural world. Just trying to become literate.

  3. #3
    Registered User
    Join Date
    02-07-2015
    Location
    Pennsylvania, US
    MS-Off Ver
    2007
    Posts
    4

    Re: Finding roots of polynomials

    Thank you that was very helpful and I think the formulas will be the most helpful in my case.

  4. #4
    Forum Guru
    Join Date
    04-13-2005
    Location
    North America
    MS-Off Ver
    2002/XP, 2007, 2024
    Posts
    16,436

    Re: Finding roots of polynomials

    If you are unfamiliar with them, you will need to be aware of Excel's built in complex number functions (such as IMSQRT(), IMPOWER(), etc.). I am not real familiar with the solutions for the cubic and quartic equations, but, at least the cubic solution, will require complex numbers as part of the computation, and you will need these Excel functions to compute the complex numbers. See a list of IM...() functions here: https://support.office.com/en-US/art...rs=en-US&ad=US

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Finding Polynomial Roots
    By Ruiyisun in forum Excel General
    Replies: 3
    Last Post: 02-07-2015, 07:41 PM
  2. Help with a formula for finding the roots of an equation
    By adam640 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 03-09-2012, 12:10 PM
  3. 3rd degree polynomials
    By ChemistB in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 09-30-2009, 01:33 PM
  4. Polynomials (LINEST)
    By mgaworecki in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 10-24-2008, 02:43 PM
  5. Finding Roots of a Polynomial
    By BigKahuna in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-01-2007, 12:55 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1