Computer Science Canada Need Help for Math |
Author: | Piro24 [ Wed Nov 08, 2006 10:06 pm ] | ||
Post subject: | Need Help for Math | ||
Ok, here is the unifinished code...
This program is very simple...It's a simple parabola. What I want to do is output the minimum. So output the value of x when y is at a minimum (in this case it would be when x = 0, y is at a minimum)...Of course there are several ways you could cheat, but I want to find a way that would work for any parabola or function. I'm stumped with this question. It's probablly very simple, but I'm just over thinking because I got frustrated... |
Author: | TheFerret [ Wed Nov 08, 2006 10:17 pm ] |
Post subject: | |
I'll give you the way that you have to learn before using, find the derivative of the function and then set that equal to 0 and then solve for x, in your case y'=2x, 0=2x, x=0 therefor, y = 0 For a fuction such as y=4x^3 + 3x^2 - 2x + 1, y' = 12x^2 + 6x - 2, set it to 0 to get x to be 0.22 or -0.73... Wikipedia will help you with this... |