Need help solving 3rd order polynomial

  • Thread starter aziqbal
  • Start date
  • Tags
    Polynomial
In summary, the conversation discusses the process of solving a cubic equation for x. Various methods, such as graphing, numerical methods, and using the general formula for roots, are suggested. The possibility of multiple solutions for a given y-value is also mentioned. The conversation also touches upon the idea of reversing the equation and finding exact and accurate x-values using Excel. The use of Wolfram is recommended for finding solutions, but the concept of n=z in the results is not fully understood.
  • #1
aziqbal
14
0
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!
 
Physics news on Phys.org
  • #2
What part of the problem do you need help with? Please show how far you've gotten.
 
  • #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:
  • #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
aziqbal said:
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
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:
  • #7
aziqbal said:
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!

aziqbal said:
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
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.
 
  • #8
  • #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
 
  • #10
aziqbal said:
I can't reverse the equation?
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?
 
  • #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
 
  • #12
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.)
 
  • #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?
 
  • #14
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.
 
  • #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
 
  • #16
aziqbal said:
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

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.
 
  • #17
Ray Vickson said:
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.

.
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
 
  • #18
aziqbal said:
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

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!
 
  • #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
 
  • #20
aziqbal said:
Where do I enter in my y value in all of this? I'm assuming this is solved for y=0
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
 
  • #21
Ok that's great!

So basically if I want to solve for zero if I plug my co-efficients into the above equation I should get value for x

So putting in

A=0.0001
B= -0.0409
C=4.6716
D=280.32

Into the above I should get out a value for x? Just want to make sure before I attempt as its a big job
 
  • #22
OMG I just did 4 pages of Maths and got x to be -42.76!

Could I push my luck and ask if anyone else got a value close to that??

That equation is really tough so many steps I had to split it into parts and do each part individually
 
  • #23
aziqbal said:
D=280.32
You need to subtract the value of Y from D. For Y = 275, D = 5.32 .
 
  • #24
ok thing are working well now i think i have this sorted

however i had one question,

when i plot the following data set for x,y

0,280.32
60,437.03
120,441.10
180,434.34

i get a curve, that best fits to a 3rd order polynomial which is this equation

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


however when i re-enter in my x values i do no get the resulting y values which i originally started with, i get out

0,280.32 which is correct
60,434.97 which is a little bit off
120,424.752 far off
180,379.248 which is very far off

why are my last 3 y-values different? and how can i get around this?
 
  • #25
aziqbal said:
ok thing are working well now i think i have this sorted

however i had one question,

when i plot the following data set for x,y

0,280.32
60,437.03
120,441.10
180,434.34

i get a curve, that best fits to a 3rd order polynomial which is this equation

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


however when i re-enter in my x values i do no get the resulting y values which i originally started with, i get out

0,280.32 which is correct
60,434.97 which is a little bit off
120,424.752 far off
180,379.248 which is very far off

why are my last 3 y-values different? and how can i get around this?
How many data points did you use to get that polynomial by curve fitting? If you used only those 4 points, it should be possible to get a polynomial which fits those points exactly.

How much round-off is present in the coefficients of the polynomial?
 
  • #26
SammyS said:
How many data points did you use to get that polynomial by curve fitting? If you used only those 4 points, it should be possible to get a polynomial which fits those points exactly.

How much round-off is present in the coefficients of the polynomial?


Just used those 4 points that's all

It's been fitted by numerous other members to the 3rd order polynomial and that's the right equation

But just take 120 as the x value and enter it in and you get a different y value??

Here's a worked example

0.0001(120^3) -0.0409(120^2)+4.6716(120)+280.32

=172.8-588.96+560.59+280.32

=424.73 when the y value is actually 441.10!

I'm thinking can there be more than 1 x solution for each y vaue?
 
  • #27
Since it's 4 points and 4 coefficients, you're just solving for the coefficients (instead of a curve fit). The issue seems to be the precision of your coefficients.

Code:
  0^3 a  +   0^2 b +   0 c + 1 d = 280.32
 60^3 a  +  60^2 b +  60 c + 1 d = 437.03
120^3 a  + 120^2 b + 120 c + 1 d = 441.10
180^3 a  + 180^2 b + 180 c + 1 d = 434.34

a =   0.0001094212963
b =  -0.04089583333
c =   4.671666667
d = 280.3200000

y = 0.0001094212963 x^3 + -0.04089583333 x^2 + 4.671666667 x + 280.32
 
Last edited:
  • #28
rcgldr said:
Since it's 4 points and 4 coefficients, you're just solving for the coefficients (instead of a curve fit). The issue seems to be the precision of your coefficients.

y = 0.0001094212963 x^3 + -0.04089583333 x^2 + 4.671666667 x + 280.32
I fully agree with rcgldr .

I just got done using a divided difference table to find the coefficient of x3 with a result of 4727/43200000 = 0.000109421296296...

The coefficient of x3 you (aziqbal) used was especially responsible for the errors you were experiencing.

For instance if you find the roots of the equation, 0.0001x^3 - 0.0409x^2 + 4.6716x + 280.32 = 441.10, the middle root is x = 94.0446 .

Simply correcting the coefficient of x3 , thus solving 0.0001094212963x^3 - 0.0409x^2 + 4.6716x + 280.32 = 441.10, gives a middle root of x = 119.837 , very close to 120.

Using rcgldr's cubic polynomial, solving 0.0001094212963 x^3 + -0.04089583333 x^2 + 4.671666667 x + 280.32 = 441.10 gives a middle root of x = 120.0 .
 
  • #29
arrghh thanks so much guys, yes i need to round especially the first co-efficient to many decimal places and it works fine then!

thanks again!
 

1. What is a 3rd order polynomial?

A 3rd order polynomial is a type of mathematical function that includes terms of the form ax^3 + bx^2 + cx + d, where a, b, c, and d are constants and x is the variable. The highest exponent in this function is 3, making it a 3rd order polynomial.

2. How do I solve a 3rd order polynomial?

To solve a 3rd order polynomial, you can use a variety of methods such as factoring, the quadratic formula, or synthetic division. It may also be helpful to graph the polynomial to find its roots or zeros.

3. What are the possible solutions for a 3rd order polynomial?

A 3rd order polynomial can have up to three distinct solutions, also known as roots or zeros. These solutions can be real or complex numbers, depending on the coefficients in the polynomial.

4. Can a 3rd order polynomial have no solution?

Yes, it is possible for a 3rd order polynomial to have no solution. This occurs when all three of the roots are complex numbers. In this case, the polynomial has no real solutions.

5. Are there any shortcuts or tricks for solving 3rd order polynomials?

There are a few techniques that can make solving 3rd order polynomials easier, such as using the rational root theorem or grouping terms to simplify the polynomial. However, for more complicated polynomials, it is often best to use a computer or calculator to find the solutions.

Similar threads

  • Precalculus Mathematics Homework Help
Replies
14
Views
809
  • Precalculus Mathematics Homework Help
Replies
4
Views
887
  • Precalculus Mathematics Homework Help
Replies
6
Views
1K
  • Precalculus Mathematics Homework Help
Replies
23
Views
2K
  • Precalculus Mathematics Homework Help
Replies
8
Views
2K
  • Precalculus Mathematics Homework Help
Replies
8
Views
1K
  • Precalculus Mathematics Homework Help
Replies
10
Views
2K
  • Precalculus Mathematics Homework Help
Replies
22
Views
1K
Replies
1
Views
1K
  • Precalculus Mathematics Homework Help
Replies
11
Views
1K
Back
Top