+ Reply to Thread
Results 1 to 7 of 7

Calculate Max Valuem from Polynomial Chart

  1. #1
    Registered User
    Join Date
    05-04-2015
    Location
    Viana do Castelo
    MS-Off Ver
    Microsoft Office 2011 (MAC)
    Posts
    17

    Calculate Max Valuem from Polynomial Chart

    Hello,

    I have 5 points with X and Y known.
    After that I need to create a polynomial trendline to fit those 5 points.

    After the polynomial line is created I need to calculate the maximum of the trendline. Basically I need the X and Y coordinates!

    I need it to be automatic so I can change the X and Y data and keep me giving the max value.
    I send u a pic to better understand the problem.

    Could you help me with this??

    ex.png

    Greetings,
    DNA

  2. #2
    Forum Expert dflak's Avatar
    Join Date
    11-24-2015
    Location
    North Carolina
    MS-Off Ver
    365
    Posts
    7,920

    Re: Calculate Max Valuem from Polynomial Chart

    Please provide a sample workbook with some data. It's a matter of calculating the coefficients of the quadratic and applying a bit of calculus.

  3. #3
    Forum Expert dflak's Avatar
    Join Date
    11-24-2015
    Location
    North Carolina
    MS-Off Ver
    365
    Posts
    7,920

    Re: Calculate Max Valuem from Polynomial Chart

    I took a shot anyway. First I used a linest trick mentioned here: http://stackoverflow.com/questions/1...ssion-in-excel. To get the coordinates of the quadratic.

    The X-Values are in Cells A1:A5 (I gave this a name My_X)
    The Y-Values are in Cells B1:B5 (I gave this a name My_Y)

    The Coefficients are in cells E2:G2. This is the linest equation entered as an array formula.

    Basic Calculus. The first derivate of Ax^2 + Bx + C is 2Ax +B. Where this is Zero is the maximum or minimum of the quadratic. Solving for Zero gives =-B/2A. That's the formula in Cell F4. Cell F5 contains the Y value at that point.
    Attached Files Attached Files

  4. #4
    Registered User
    Join Date
    05-04-2015
    Location
    Viana do Castelo
    MS-Off Ver
    Microsoft Office 2011 (MAC)
    Posts
    17

    Re: Calculate Max Valuem from Polynomial Chart

    There you go!

    Thanks so much for the help!!
    Attached Files Attached Files

  5. #5
    Registered User
    Join Date
    05-04-2015
    Location
    Viana do Castelo
    MS-Off Ver
    Microsoft Office 2011 (MAC)
    Posts
    17

    Re: Calculate Max Valuem from Polynomial Chart

    I couldn't follow your logic 'cause I have a 4th order polynom!

    Thanks

    Quote Originally Posted by dflak View Post
    I took a shot anyway. First I used a linest trick mentioned here: http://stackoverflow.com/questions/1...ssion-in-excel. To get the coordinates of the quadratic.

    The X-Values are in Cells A1:A5 (I gave this a name My_X)
    The Y-Values are in Cells B1:B5 (I gave this a name My_Y)

    The Coefficients are in cells E2:G2. This is the linest equation entered as an array formula.

    Basic Calculus. The first derivate of Ax^2 + Bx + C is 2Ax +B. Where this is Zero is the maximum or minimum of the quadratic. Solving for Zero gives =-B/2A. That's the formula in Cell F4. Cell F5 contains the Y value at that point.

  6. #6
    Forum Expert Pepe Le Mokko's Avatar
    Join Date
    05-14-2009
    Location
    Belgium
    MS-Off Ver
    O365 v 2402
    Posts
    13,448

    Re: Calculate Max Valuem from Polynomial Chart

    Do not crosspost your question on multiple forums without including links here to the other threads on other forums.

    Cross-posting is when you post the same question in other forums on the web. The last thing you want to do is waste people's time working on an issue you have already resolved elsewhere. We prefer that you not cross-post at all, but if you do (and it's unlikely to go unnoticed), you MUST provide a link (copy the url from the address bar in your browser) to the cross-post.

    Expect cross-posted questions without a link to be closed and a message will be posted by the moderator explaining why. We are here to help so help us to help you!

    Read this to understand why we ask you to do this, and then please edit your first post to include links to any and all cross-posts in any other forums (not just this site).

    http://www.excelguru.ca/forums/showt...lynomial-Chart

  7. #7
    Forum Guru
    Join Date
    04-13-2005
    Location
    North America
    MS-Off Ver
    2002/XP and 2007
    Posts
    15,829

    Re: Calculate Max Valuem from Polynomial Chart

    Note discussion at t he end of this old thread: http://www.excelforum.com/excel-prog...ml#post4306979 (note that this forum prefers when users not resurrect old threads, preferring, as you've done here, to start your own thread)

    As I note in the other thread, dflak's solution proposed in 3 is "correct" for a 2nd order polynomial, so we only need to extend it to higher order polynomials. The basic idea:

    1) Regress polynomial (4th order in this case)
    2) Take 1st derivative of polynomial (which will be a 3rd order)
    3) Find the roots or zeros of the 1st derivative to find the x values at the potential maxima.
    4) Compute y at each root and determine which is the maximum.
    5) Check the endpoints of your desired interval to make sure none of them is higher than the maximum in 4.

    The key steps are 2 and 3 -- taking the 1st derivative and then finding the roots of the resulting cubic. Can I assume you recall the basic calculus needed to get the first derivative?

    Finding the roots of anything above a 2nd order polynomial gets more challenging. There is a "closed form" solution for the roots of a cubic polynomial, but it passes through complex space on its way to getting the real roots (https://en.wikipedia.org/wiki/Cubic_polynomial ). If you decide to go this route, you will need to use the IM...() functions to perform the desired calculations in complex space (see brief discussion here and associated spreadsheet that illustrates the use of the IM...() functions http://www.excelforum.com/groups/mat...lex-roots.html ).

    Personally, I prefer to use numerical root finding algorithms for these (https://en.wikipedia.org/wiki/Root-finding_algorithm ). The Newton Raphson method is fairly easy to program into a spreadsheet, especially if you are willing to allow circular references (see this discussion and example for NR algorithms: http://www.excelforum.com/tips-and-t...ml#post4229595 )

    That should get you started. Let us know where you get stuck.
    Quote Originally Posted by shg
    Mathematics is the native language of the natural world. Just trying to become literate.

+ 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. Replies: 31
    Last Post: 02-06-2016, 06:09 AM
  2. Replies: 11
    Last Post: 07-25-2015, 02:06 PM
  3. Using the chart equation to calculate formula for a 6th order polynomial
    By Daedalus1 in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 10-28-2014, 04:58 PM
  4. [SOLVED] how do I calculate a polynomial curve fit?
    By Joe Miller in forum Excel Programming / VBA / Macros
    Replies: 18
    Last Post: 04-22-2012, 07:13 AM
  5. Replies: 3
    Last Post: 02-23-2012, 12:04 PM
  6. [SOLVED] Calculate polynomial curve
    By ronbrosh111 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 06-06-2006, 01:15 PM
  7. [SOLVED] How to calculate polynomial regression coefficients
    By Joham Shason via OfficeKB.com in forum Excel General
    Replies: 8
    Last Post: 08-08-2005, 07:05 PM

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