1. Limited time only! Sign up for a free 30min personal tutor trial with Chegg Tutors
    Dismiss Notice
Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Need help solving 3rd order polynomial

  1. Mar 1, 2013 #1
    hi i need some help solving this equation for x

    y=0.0001x^3-0.0409x^2+4.6716x+280.32

    can someone please help me, i really need to solve this for x!!! full layout would be great

    many thanks!!
     
  2. jcsd
  3. Mar 1, 2013 #2
    What part of the problem do you need help with? Please show how far you've gotten.
     
  4. Mar 1, 2013 #3
    sorry the whole thing

    i do not know how to solve this equation

    for a particular y value i need to find out what the x is? basically solving for equation =0

    so if i have y=100 what is x=?
     
    Last edited: Mar 1, 2013
  5. Mar 1, 2013 #4
    i for got to add

    I have a set of Y values between (275-475)and I need to back calculate a set of x values

    X values should be between 0-180
     
  6. Mar 1, 2013 #5
  7. Mar 1, 2013 #6

    rcgldr

    User Avatar
    Homework Helper

    If the X values are restricted to integers, you could create a program with a loop that cycles X from 0 to 180, and chooses the values of X closest to target values of Y. If X values are real, how precise do the X values need to be? For example .001 is accurate enough, you could loop through 0.000, 0.001, ... 179.999, 180.000 for X values. If you need more precision, you could use Newtons method starting with the closest X value for a target Y value. Otherwise, use the cubic method mentioned in the wiki article linked to by Whovian.

    I tried finding roots for Y = 0 from wolfram and it returns: x = -42.5259, x = 225.763+122.265 i, x = 225.763-122.265 i , so not much help there.
     
    Last edited: Mar 1, 2013
  8. Mar 1, 2013 #7

    SammyS

    User Avatar
    Staff Emeritus
    Science Advisor
    Homework Helper
    Gold Member

    Hello aziqbal. Welcome to PF !

    Have you graphed this function? It's a typical cubic function, with a local minimum and a local maximum.

    Its y-intercept is 280.32 .

    This function is not invertible in general.

    The local maximum is approximately y ≈ 443.5 at approximately x ≈ 81.4 .

    The local minimum is approximately y ≈ 377.3 at approximately x ≈ 191.2 .

    So for any data point with y-value between about 377.3 and 443.5, there are three different possible x values that will work with this function. Note: If y = 400, then x could be about 35.9, 148.0, or 225.0 .

    However, if the data were collected for increasing (or decreasing) values of x, then there is a good possibility that you could pick the correct value for x from the three possibilities.

    You state that your y-values run from 275 to 475. For any y-value less than 280.32 (the y-intercept) the x-value is negative.
     
  9. Mar 1, 2013 #8

    rcgldr

    User Avatar
    Homework Helper

  10. Mar 1, 2013 #9
    Yes basically I have plotted the graph but want to have it so I can enter in the y values and read out the x values

    I am restricted by using excel only so I don't know if that will hinder the progress

    The wiki page that is posted in the link, I don't really get, is that saying that I can reverse the equation?

    I have got all the y values in a column in excel and want to enter some kind of equation so the next column can just calculate out all the corresponding x values using this polynomial

    Rcgldr I can use your way of doing it but really I want to be able to enter my y value and read out a exact and accurate x value, infact up till now that is the way I have been doing it and it just doesn't give the kind of accuracy I want
     
  11. Mar 1, 2013 #10

    rcgldr

    User Avatar
    Homework Helper

    Correct, as pointed out, for many of the y values, there are 3 possible x values. As seen in the wolfram link, you can separate the cubic into a product of a linear and quadratic function of x. You may be able to produce 3 reversed equations for the 3 possible values of x, one for the linear root, one for the quadratic root x + sqrt(...), and one for the quadratic root x - sqrt(...).

    Why was this thread moved to homework?
     
  12. Mar 2, 2013 #11
    Ok great I used Wolfram a great website to get this part but I don't get what the n=z part means


    4024514b976efcb5b7d3f4f863d53770_zps4c3c7149.jpg


    So I guess this is telling me there is 3 possible solutions to this equation, in my case I know what my y values are and need to back calculate my x values
     
  13. Mar 2, 2013 #12

    HallsofIvy

    User Avatar
    Staff Emeritus
    Science Advisor

    What you have posted makes no sense at all. You originally said that you were trying to solve a specific cubic equation. Then you said you were trying to solve a number of cubic equations, for "a set of Y values between (275-475)". Now it appears that you are requiring that both x and y be integer. This is the first time you have mentioned that!

    Essentially, what Wolfram is telling you is that in order that x and y both be integer, x must be one of those given values and then y is calculated from that. There are in fact, an infinite number of solutions. When it says that "x= 5000n+ 4080" "[itex]n\in Z[/itex]" (NOT n= Z), it means that you get a different integer solution, x, for any interger n. For example, taking n= 0, x= 4080 is a solution, taking n= 1, x= 9080 is a solution, taking n= -1, x= -920 is a solution, etc. But not a solution to any of the problems, with the values of y that you posted. The integer solutions only work for the particular y given by putting those values of x into the original function. (And none of the give a value of x between 0 and 180.)
     
  14. Mar 2, 2013 #13
    My bad I got confused with the integer issue ok ignore that!

    My problem still stands, yes I need to calculate a series of x values based on a series of y values ranging from 275-475, I can not believe how hard this has turned out to be

    How come I can put in a x value and read out a y value but not do the opposite??? Arrgghhhh I would have thought it was so easy!!

    I am still no further forward, help!

    PS:I looked again at the cubic function on wiki and it says x1, x2 and x3, does that mean x^3, x^2 and x?
     
  15. Mar 2, 2013 #14

    HallsofIvy

    User Avatar
    Staff Emeritus
    Science Advisor

    No, x1, x2, and x3 are the three possible roots to a general cubic.

    Are you looking only for integer values of x and y? You still haven't answered that.
     
  16. Mar 2, 2013 #15
    No, no integers

    Ok so that means I have 3 possible roots for this equation which means for each y I wil, have 3 values of x??

    That's ok because I know what range my x values need to be so I can just take which x value I need

    That's a long way and a lot of calculations I need to enter but I will give that a go, my only worry is I think I might get negative root in some of those calculations which will be no good for solving the polynomial
     
  17. Mar 2, 2013 #16

    Ray Vickson

    User Avatar
    Science Advisor
    Homework Helper

    There seem to be some issues you are not addressing, or else do not understand. Letting p(x) be the polynomial you write originally, we have: p(0) = 280.32 and p is increasing near x = 0, so to get a value of 275 you need a negative x; that is, the solution of p(x) = 275 is x = -1.127632925, which is outside your range 0--180. For y > 443.5218018 you need x > 246.1473175, so for values of y near 475 you need x outside the 0--180 range. For some of your y-values you will have just one x value that works; for some other y-values you will have 2 x-values that work and are in the range 0--180 (with a third x that also works, but lies outside the desired range).

    The problem of "inverting"---getting x for specified y---is difficult. You can do it in EXCEL by using the Solver tool, but you need to specify a range of x values. Typically, the way to do it is to have a cell that will contain you unknown x---say cell A1. In another cell--say cell A2-- you put you value of p(x). Then after starting the solver tool, you say that the target cell is A2 (that is, p(x), the variable cell is A1 (that is, x) and you can choose a value to have the solution for; say you want to solve p(x) = 200. Then you put 200 in the place where it asks you for a target value. After looking at a graph of p(x) (which you can also do in EXCEL) you can give a range of x values in which the solution will lie. You add that range to the "constraints" section of the Solver input panel. Then press the "solve" key, and EXCEL will spit out an estimated solution. Its solution will not always be very accurate because it implements a form of Newton's method, but using finite-differences in place of derivatives, and that can lead to significant roundoff and truncation errors in some cases.
     
  18. Mar 2, 2013 #17

    How did you get this x value of -1.27..........

    The ranges I gave were rough estimates of the ranges I'm interested in

    If I enter 100 as my x value I get 438.32 for the y value that's great! But I know only the y values and need to calculate my x values

    So for example what is the x value when my y value is 450?? Or 455?? Etc etc you get the idea

    Yes when x is zero the y value is 280.32 that is also fine, but really I want to know all the x values between the ranges 280+ up to say around 475 (y values) Might even be around 450 I have to check my data set

    I know some members have said I can use "look up" in excel etc and do this many ways but really I want to re-arrange this equation so I can calculate exactly the x value for a given y value that I have
     
  19. Mar 2, 2013 #18

    Ray Vickson

    User Avatar
    Science Advisor
    Homework Helper

    I got the value of x by solving the equation numerically.

    Did you even read the rest of my message? It tells you to find x for given y using the EXCEL Solver Tool!
     
  20. Mar 2, 2013 #19
    Thanks Ray I will give it a go

    I was just thinking of it another way if I solve for x using the cubic root method using the following equation, this is from wiki

    a62765f773848d28461972fba6be026d_zpsc914788a.jpg

    Where do I enter in my y value in all of this? I'm assuming this is solved for y=0
     
  21. Mar 2, 2013 #20

    rcgldr

    User Avatar
    Homework Helper

    You're solving for the y value as given. For y = 275, the equation becomes:

    275 = 0.0001x^3 - 0.0409x^2 + 4.6716x + 280.32
    0 = 0.0001x^3 - 0.0409x^2 + 4.6716x + 5.32
     
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook

Have something to add?
Draft saved Draft deleted



Similar Discussions: Need help solving 3rd order polynomial
Loading...