Jump to content


- - - - -

Can anyone with math skills that don't suck like mine, solve this?


5 replies to this topic

#1 SyntaxError

    Valued Member

  • Members
  • PipPipPip
  • 139 posts

Posted 26 October 2009 - 10:18 PM

I'm trying to do some prediction of maximum and minimum simplex noise values in a region so I can build better bounding volumes. I took the 2D simplex noise combination function and took the first derivative to get the slope. I plotted it with the original function. So far it looks correct. The slope is zero in four places. Now all I need is to solve for the f'(X) = 0 so I can get some local maximum and minimum values for f(X). The original functions goes way exponential beyond .7 or so but there a hill between 0.2 and 0.3 and a corresponding valley on the opposite side of zero between -0.2 and -0.3. These are the values I'm looking for.

Here is the first derivate function. Anyone know how to solve it? Do I have to solve it iteratively?

0.0625 - 1.5*x^2 + 7.5*x^4 - 14*x^6 + 9x^8 = 0

#2 Reedbeta

    DevMaster Staff

  • Administrators
  • 5340 posts
  • LocationSanta Clara, CA

Posted 26 October 2009 - 10:47 PM

There's no general way to solve for the roots (zeroes) of polynomials higher than degree 4...in fact, it's not practical to do for higher than degree 2 (quadratic formula) as the cubic and quartic formulas are just horrendous. ;) So, numerical methods are the only way here.

Just using my graphing calculator I found that the roots are at .2357 and .7071 (and corresponding negative ones). The inner root (at .2357) should be easy to refine further using Newton's method if you need more precision. The outer one looks like it's a saddle point, or possibly multiple roots close together, so it will be very hard to do with Newton's method because of the very low slope. You may just have to fall back to bisection there.
reedbeta.com - developer blog, OpenGL demos, and other projects

#3 Nick

    Senior Member

  • Members
  • PipPipPipPip
  • 1227 posts
  • LocationOttawa, Ontario, Canada

Posted 26 October 2009 - 11:05 PM

SyntaxError said:

Do I have to solve it iteratively?
Only up to quartic functions there exist generic analytic formulas for the roots. For higher degree polynomials it has been proven no such generic formulas exist and you have to use an algorithmic approach.

However, your specific polynomial can be rewritten as a quartic one:

0.0625 - 1.5*z + 7.5*z^2 - 14*z^3 + 9z^4 = 0
z = x^2

Solving for z gives me 0.5 (three times) and 0.055555. Taking their square roots to get x results in 0.70710678 and 0.23570226.

#4 SyntaxError

    Valued Member

  • Members
  • PipPipPip
  • 139 posts

Posted 26 October 2009 - 11:08 PM

I don't need the .707 roots just the .235 . Actually I do have some code for Newton's method I downloaded for solving Kepler's equation. I guess I'll try plugging in this function and see how it goes. Thanks for the tip!!

#5 Reedbeta

    DevMaster Staff

  • Administrators
  • 5340 posts
  • LocationSanta Clara, CA

Posted 26 October 2009 - 11:10 PM

Looks like the inner root is exactly sqrt(1/18). No need for Newton's method after all!
reedbeta.com - developer blog, OpenGL demos, and other projects

#6 SyntaxError

    Valued Member

  • Members
  • PipPipPip
  • 139 posts

Posted 26 October 2009 - 11:17 PM

Reedbeta said:

Looks like the inner root is exactly sqrt(1/18). No need for Newton's method after all!

Ahh OK cool! Thanks again guys. That should get me going.





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users