Min and Max of polynomial
Does anyone know where I can find code to find the bounds of a 3d polynomial of n-degrees. I want to use it to build a bounding box for it.
LinaInverse2010
Is your polynomial parameterized into X, Y, and Z coordinates as a function of a fourth variable, such as time? If so, then find when dX/dt, dY/dt, and dZ/dt are zero, and those are your local mimimum and maximum. Then also plug your first and last time values into the original polynomials to find where the curve starts and ends. Once you have all these values for each coordinate (at least two, start and end), the largest one will be the maximum for that axis, and the smallest one will be the minimum for that axis. These values can then be used to make your bounding box.
If your equation is in some other form, then we''ll help you get it into something you can work with
If your equation is in some other form, then we''ll help you get it into something you can work with

I don''t think my polynomial is parameratized like you need. Heres an example one: 3(x^2)(y^3)z + 1(y^4)(z^2) + ...
I also have a copy in terms of t, which each t having coefficients in terms of x0, y0, z0, dx, dy, dz. Basically its from expanding the n degree polynomial with x = x0 + dx*t, and the same with y and z. That makes the t coefficients depend on the incoming ray of course.
I can take derivatives and solve for the roots in terms of t already. I also have a copy of the 3 derivatives of the original polynomial with respect to d/dx, d/dy, d/dz. I don''t know a way to solve the roots in terms of x, y, z of the origonal polynomial, but I don''t believe thats necassary. Of course I can evaluate any of theses expression at a given point.
Can I solve by finding the local min and max using the derivatives i have for the polynomial? Or will that not work? (Sorry, I''m a little rust on my calculus, its been a couple of years)
LinaInverse2010
I also have a copy in terms of t, which each t having coefficients in terms of x0, y0, z0, dx, dy, dz. Basically its from expanding the n degree polynomial with x = x0 + dx*t, and the same with y and z. That makes the t coefficients depend on the incoming ray of course.
I can take derivatives and solve for the roots in terms of t already. I also have a copy of the 3 derivatives of the original polynomial with respect to d/dx, d/dy, d/dz. I don''t know a way to solve the roots in terms of x, y, z of the origonal polynomial, but I don''t believe thats necassary. Of course I can evaluate any of theses expression at a given point.
Can I solve by finding the local min and max using the derivatives i have for the polynomial? Or will that not work? (Sorry, I''m a little rust on my calculus, its been a couple of years)
LinaInverse2010
What kind of bounds are you expecting, and what is the form of your equation?
3(x^2)(y^3)z + 1(y^4)(z^2) + ...
looks like an implicit equation. I don''t know how to find its bounds. You will probably have to turn it into an explicit equation, or a paraterized equation, and follow Zipster''s technique.
Cédric
3(x^2)(y^3)z + 1(y^4)(z^2) + ...
looks like an implicit equation. I don''t know how to find its bounds. You will probably have to turn it into an explicit equation, or a paraterized equation, and follow Zipster''s technique.
Cédric
Even if i parameratize it in terms of t, those coefficients are going to be in terms of x, y, z, dx, dy, dz. And I won''t know those until I try to intersect a ray with it. There is no way I can change its form. So, is there some way to get the min, max of an implicit polynomial?
LinaInverse2010
LinaInverse2010
To find the local max and min for a polynomial you have to:
Find the first derivative of the function (f''(x)) then where the derivative is zeroed there is a local max or min for example if the f(x)= x^2 + 5x f''(x) = 2x+5 solve the equation 2x+5=0 2x=-5 x=-5/2 now at this point the function has a max or min and it''s value is f(-5/2) = (-5/2)^2-(25/2).In your case where a function has multiple variables you have to:each time you are looking for a variables derivative you take the others as constants(like numbers) for example f(x,y)= x^2+y^3+2y solve with respect to y taking x as constant f''(x,y)= (x^2)'' + (y^3)'' + (2y)''=
0 + 3y^2+2 ((x^2)''=0) this means dy/y=3y^2+2 do same for x each time finding the roots of the derivatives and you have the local max and min
Find the first derivative of the function (f''(x)) then where the derivative is zeroed there is a local max or min for example if the f(x)= x^2 + 5x f''(x) = 2x+5 solve the equation 2x+5=0 2x=-5 x=-5/2 now at this point the function has a max or min and it''s value is f(-5/2) = (-5/2)^2-(25/2).In your case where a function has multiple variables you have to:each time you are looking for a variables derivative you take the others as constants(like numbers) for example f(x,y)= x^2+y^3+2y solve with respect to y taking x as constant f''(x,y)= (x^2)'' + (y^3)'' + (2y)''=
0 + 3y^2+2 ((x^2)''=0) this means dy/y=3y^2+2 do same for x each time finding the roots of the derivatives and you have the local max and min
Virtus junxit, mors non separabit
But what do i do for this: 3*(x^2)*(y^3) + 3*y*z
then d/dy = 9*(x^2)*(y^2) + 3z
So how do i find the zero of that considering x and y can be anything.
LinaInverse2010
then d/dy = 9*(x^2)*(y^2) + 3z
So how do i find the zero of that considering x and y can be anything.
LinaInverse2010
A quick note to lone_ranger: i think we all remember first semester calculus. If you had bothered to read the question, you might have realized that your answer is damn near irrelevant.
if we have 3*(x^2)(y^3) + 3yz, we have absolutely no meaning to it. If we say that z = f(x, y), then we have an implcitly defined function for z. This is not too diffcult to make into an explicit equation:
3yz = -3*(x^2)(y^3)
z = (-3*(x^2)(y^2)) / 3y
Now we need to take the derivative with respect to x, then y, and find where both dx/dz and dy/dz are 0. That will give you a min or max.
Now, I don''t think that''s what you want. x, y, and z are all functions of t, and you''ve got them all in this expression. So we have to differentiate all of these with respect to t. This means massive application of product rule, esp. with more complex expressions. I think this is the answer if x, y, and z are all functions of t(i''ve pulled the constants outside the derivatives because this is getting complicated):
f''( x(t), y(t), z(t) ) = 3*( (x^2)*3(y^2)(dy/dt) + 2x*(y^3)(dx/dt) ) + 3*( y*(dz/dt) + z*(dy/dt) )
To simplify:
f''( x(t), y(t), z(t) ) = 9(x^2)(y^2)(dy/dt) + 6x(y^3)(dx/dt) + 3y(dz/dt) + 3z(dy/dt)
And...you would have to solve that for 0. I''m a little bit out on a limb here though. I don''t know if there''s any guarantee that there will be a solution at all, frankly. But the calculus is done correctly so I still get 8 out of 9
j/k. The only possible solutions I can see upfront are where (1) dx/dt, dy/dt, and dz/dt are all equal to 0, or (2) x, y, and z are all equal to 0. There are probably other possible solutions, but those would depend on what x(t), y(t), and z(t) are.
____________________________________________________________
Direct3D vs. OpenGL
if we have 3*(x^2)(y^3) + 3yz, we have absolutely no meaning to it. If we say that z = f(x, y), then we have an implcitly defined function for z. This is not too diffcult to make into an explicit equation:
3yz = -3*(x^2)(y^3)
z = (-3*(x^2)(y^2)) / 3y
Now we need to take the derivative with respect to x, then y, and find where both dx/dz and dy/dz are 0. That will give you a min or max.
Now, I don''t think that''s what you want. x, y, and z are all functions of t, and you''ve got them all in this expression. So we have to differentiate all of these with respect to t. This means massive application of product rule, esp. with more complex expressions. I think this is the answer if x, y, and z are all functions of t(i''ve pulled the constants outside the derivatives because this is getting complicated):
f''( x(t), y(t), z(t) ) = 3*( (x^2)*3(y^2)(dy/dt) + 2x*(y^3)(dx/dt) ) + 3*( y*(dz/dt) + z*(dy/dt) )
To simplify:
f''( x(t), y(t), z(t) ) = 9(x^2)(y^2)(dy/dt) + 6x(y^3)(dx/dt) + 3y(dz/dt) + 3z(dy/dt)
And...you would have to solve that for 0. I''m a little bit out on a limb here though. I don''t know if there''s any guarantee that there will be a solution at all, frankly. But the calculus is done correctly so I still get 8 out of 9

____________________________________________________________
Direct3D vs. OpenGL
SlimDX | Ventspace Blog | Twitter | Diverse teams make better games. I am currently hiring capable C++ engine developers in Baltimore, MD.
Sorry, i didn''t get the question correctly

Virtus junxit, mors non separabit
Lina: Did I answer your question acceptably, or not?
SlimDX | Ventspace Blog | Twitter | Diverse teams make better games. I am currently hiring capable C++ engine developers in Baltimore, MD.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement