Results 1 to 13 of 13

Math Help - Calulating the minimum value of f(x) in a given range of x?

  1. #1
    Newbie
    Joined
    Mar 2008
    Posts
    13

    Calulating the minimum value of f(x) in a given range of x?

    Given the function below, where a, b, c, d, e are constants.

    f(x) = ax^4 + bx^3 + cx^2 + dx + e

    How do I get the minimum return value given that x lies in the range 0 <= x < 1?

    I know this has something to do with differentiation (maybe??), and I know that the derivative is:

    df(x) = 4ax^3 + 3bx^2 + 2cx + d

    But I have no idea how to get the minimum value back within a given range of x.

    Any help would be appreciated!
    Follow Math Help Forum on Facebook and Google+

  2. #2
    Newbie
    Joined
    Mar 2008
    Posts
    7
    f(x) = ax^4 + bx^3 + cx^2 + dx + e
    f '(x) = 4ax^3 + 3bx^2 + 2cx + d
    0 <= x < 1

    Ok, thats all you need to solve this problem. What you want to do is solve f '(x) for zero. Find all the x coordinate points where y equals zero in that equation and you'll have the x positions in the function f(x) at which the gradient is zero.

    In a quartic like f(x) the derivative will have 3 points where y=0, so 3 turning points in f(x), one will be the maximum, one will be the minimum, and another will be in between both.

    Once you have the x values calculated from the derivative f '(x) you can sub the 3 values back in to the original function f(x) and find which of those is the minimum and thus which value of x is the minimum.

    But!.... Since you have been given a range for x, you might find that 2 of those values of x you found in the derivative function are outside those bounds, so you can exclude those straight away.

    For example:
    x1 = -12.3 , x2 = 0.4 , x3 = 54.6

    In this case, both x1 and x3 lie outside the bounds of zero and one (0<=x<1) so the answer would be x2.

    Identify the appropriate x value, then sub it back in to the original equation and give the corresponding y value for the minimum.

    If this solved your problem, stop reading here. If you still haven't solved it, read on.

    -----------------------------------------

    You might find that none of the 3 calculated x values lie within the boundaries specified, so simply take the lower limit (in this case "0") and sub that in as the x value in the original function f(x). Then sub in the upper limit (in this case "1") in f(x) and find which is smaller, and that will be your answer.

    I haven't told you how to solve for x in this :P I can't do everything for you now can I? If you need help with that, let me know and I'll step you through solving for x in a cubic derivative.

    Hope it helps, and good luck.
    Follow Math Help Forum on Facebook and Google+

  3. #3
    Flow Master
    mr fantastic's Avatar
    Joined
    Dec 2007
    From
    Zeitgeist
    Posts
    16,948
    Thanks
    5
    Quote Originally Posted by Makka View Post
    f(x) = ax^4 + bx^3 + cx^2 + dx + e
    f '(x) = 4ax^3 + 3bx^2 + 2cx + d
    0 <= x < 1

    Ok, thats all you need to solve this problem. What you want to do is solve f '(x) for zero. Find all the x coordinate points where y equals zero in that equation and you'll have the x positions in the function f(x) at which the gradient is zero. Mr F says: So you're proposing to langers2k that s/he solve a general cubic equation ......


    In a quartic like f(x) the derivative will have 3 points where y=0, so 3 turning points in f(x), one will be the maximum, one will be the minimum, and another will be in between both. Mr F says: Not true. For example, {\color{red}y = x^4 - 2x^3 + \frac{3}{2} x^2 - \frac{1}{2} x - \frac{15}{16} = \left(x- \frac{1}{2}\right)^4 - 1} has only one (minimum) turning point.

    Once you have the x values calculated from the derivative f '(x) you can sub the 3 values back in to the original function f(x) and find which of those is the minimum and thus which value of x is the minimum.

    But!.... Since you have been given a range for x, you might find that 2 of those values of x you found in the derivative function are outside those bounds, so you can exclude those straight away.

    For example:
    x1 = -12.3 , x2 = 0.4 , x3 = 54.6

    In this case, both x1 and x3 lie outside the bounds of zero and one (0<=x<1) so the answer would be x2.

    Identify the appropriate x value, then sub it back in to the original equation and give the corresponding y value for the minimum.

    If this solved your problem, stop reading here. If you still haven't solved it, read on.

    -----------------------------------------

    You might find that none of the 3 calculated x values lie within the boundaries specified, so simply take the lower limit (in this case "0") and sub that in as the x value in the original function f(x). Then sub in the upper limit (in this case "1") in f(x) and find which is smaller, and that will be your answer.

    I haven't told you how to solve for x in this :P I can't do everything for you now can I? Mr F wryly observes: Very glib. The devil is in the detail. Which would be why there is none .......

    If you need help with that, let me know and I'll step you through solving for x in a cubic derivative. Mr F remarks: I think you're biting off more than you can chew here, sport.

    Hope it helps, and good luck.
    I'm certain there's more to the question that what's been posted ......
    Follow Math Help Forum on Facebook and Google+

  4. #4
    Newbie
    Joined
    Mar 2008
    Posts
    13
    Thanks for that, I think most of it makes sense.

    I need to find the three roots of f'(x) and use them to calculate the y values (where x is in range), I then also need to get the y values at each extreme of the specified range.

    This will give me between 2 and 5 sets of values (for x, and resulting y). I can then choose the correct one by choosing the lowest y value.

    So all I need to do is calculate the real roots of f'(x) which is a cubic polynomial and I am all set!

    What method would you suggest using to solve f'(x)? I will be programming it into a computer so complexity isn't too much of a problem.

    I have found this page which explains one method: Solving Cubic Equations.

    Or I can use the Newton-Raphson method that I already have in code. My only problem is choosing a start point for the Newton-Raphson method, are there any ways to calculate a good guess to start with?
    Follow Math Help Forum on Facebook and Google+

  5. #5
    Newbie
    Joined
    Mar 2008
    Posts
    13
    Quote Originally Posted by mr fantastic View Post
    I'm certain there's more to the question that what's been posted ......
    Not sure, its not technically a question that has been set. I need to make a simulator of sorts and deal with collisions, I will be using this to calculate collision times so I can model them accurately.

    Quote Originally Posted by mr fantastic
    Mr F says: So you're proposing to langers2k that s/he solve a general cubic equation ......
    Unfortunately it will be used in a computer program, so the values of a to e can be anything.

    Assuming the rest of Makka's method is fitting to my requirements can you give me advice on how to solve the cubic? Thanks!
    Follow Math Help Forum on Facebook and Google+

  6. #6
    Flow Master
    mr fantastic's Avatar
    Joined
    Dec 2007
    From
    Zeitgeist
    Posts
    16,948
    Thanks
    5
    Quote Originally Posted by langers2k View Post
    Thanks for that, I think most of it makes sense.

    I need to find the three roots of f'(x) and use them to calculate the y values (where x is in range), I then also need to get the y values at each extreme of the specified range.

    This will give me between 2 and 5 sets of values (for x, and resulting y). I can then choose the correct one by choosing the lowest y value.

    So all I need to do is calculate the real roots of f'(x) which is a cubic polynomial and I am all set!

    What method would you suggest using to solve f'(x)? I will be programming it into a computer so complexity isn't too much of a problem.

    I have found this page which explains one method: Solving Cubic Equations.

    Or I can use the Newton-Raphson method that I already have in code. My only problem is choosing a start point for the Newton-Raphson method, are there any ways to calculate a good guess to start with?
    If a, b, c, d, e are unrestrained constants, then the minimum value of the quartic over the interval [0, 1) can be anything you want it to be!!!!

    The quartic {\color{red}y = x^4 - 2x^3 + \frac{3}{2} x^2 - \frac{1}{2} x + \frac{1}{16} - k = \left(x- \frac{1}{2}\right)^4 - k} has a minimum value of k occuring at x = 1/2. k is any real number.

    The question as posted has no sensible answer.
    Follow Math Help Forum on Facebook and Google+

  7. #7
    Newbie
    Joined
    Mar 2008
    Posts
    13
    Quote Originally Posted by mr fantastic View Post
    If a, b, c, d, e are unrestrained constants, then the minimum value of the quartic over the interval [0, 1) can be anything you want it to be!!!!

    The quartic {\color{red}y = x^4 - 2x^3 + \frac{3}{2} x^2 - \frac{1}{2} x + \frac{1}{16} - k = \left(x- \frac{1}{2}\right)^4 - k} has a minimum value of k occuring at x = 1/2. k is any real number.

    The question as posted has no sensible answer.
    I don't know what a, b, c, d, e will be when I create the program, but at run-time they are fixed. Surely there will be a minimum value of y given a range of x values?

    I may not have explained my question very well and I certainly don't even pretend to understand polynomials past the 2nd degree, but given 5 co-efficients that are known when the equation is going to be solved, we should be able to get an answer back?

    If I have missing something please let me know.
    Follow Math Help Forum on Facebook and Google+

  8. #8
    Flow Master
    mr fantastic's Avatar
    Joined
    Dec 2007
    From
    Zeitgeist
    Posts
    16,948
    Thanks
    5
    Quote Originally Posted by langers2k View Post
    I don't know what a, b, c, d, e will be when I create the program, but at run-time they are fixed. Surely there will be a minimum value of y given a range of x values?
    I may not have explained my question very well and I certainly don't even pretend to understand polynomials past the 2nd degree, but given 5 co-efficients that are known when the equation is going to be solved, we should be able to get an answer back?

    If I have missing something please let me know.
    Well you didn't say that in your statement of the question. The replies you get are only going to be as good as the information you give.

    There are standard numerical algorithms for finding the minimum value of a polynomial over a given domain. I believe advice along that line has already been given in one of your other posts.
    Follow Math Help Forum on Facebook and Google+

  9. #9
    Newbie
    Joined
    Mar 2008
    Posts
    13
    Quote Originally Posted by mr fantastic View Post
    Well you didn't say that in your statement of the question. The replies you get are only going to be as good as the information you give.

    There are standard numerical algorithms for finding the minimum value of a polynomial over a given domain. I believe advice along that line has already been given in one of your other posts.
    Sorry about the confusion, I will take more care next time I post a question to explain it completely.

    Have you got any advice for solving the cubic?

    Would you recommend a fully algebraic solution or using the Newton method? If I were to use the Newton method, is there any way to come up with reasonable guess to give me the roots?
    Follow Math Help Forum on Facebook and Google+

  10. #10
    Flow Master
    mr fantastic's Avatar
    Joined
    Dec 2007
    From
    Zeitgeist
    Posts
    16,948
    Thanks
    5
    Quote Originally Posted by langers2k View Post
    Sorry about the confusion, I will take more care next time I post a question to explain it completely.

    Have you got any advice for solving the cubic?

    Would you recommend a fully algebraic solution or using the Newton method? If I were to use the Newton method, is there any way to come up with reasonable guess to give me the roots?
    A numerical approach with an error tolerance is certainly the best way to go. Do you know that a graphics or CAS calculator can easily do what you're asking ....?
    Follow Math Help Forum on Facebook and Google+

  11. #11
    Newbie
    Joined
    Mar 2008
    Posts
    7
    kk, Mr. F

    I'll be the first to admit I'm not an expert. But I thought what I did respond with was sufficient to get him on the right track, and tbh it sounds like it at least got over the initial hurdle and outlined a basic technique to start the problem, which is what I thought his problem was... where to start?

    If he doesn't include actual numbers, I'm not going to spend all day going over every possible combination or result in examples, I'll generalize a little for the sake of simplification. I'm quite aware not all cubics have 3 turning points, but that would certainly be a worst case scenario in this instance (most work).

    I apologise if my response confused or was so woefully incorrect that you found it necessary to dress me down, but at least I pinged a light bulb initially.

    ttyl
    Follow Math Help Forum on Facebook and Google+

  12. #12
    Newbie
    Joined
    Mar 2008
    Posts
    7
    Quote Originally Posted by mr fantastic View Post
    Do you know that a graphics or CAS calculator can easily do what you're asking ....?
    Incidentally, unless you're suggesting a graphics calculator with a program thats designed to show all the working steps in solving a cubic, I don't think thats what he's after. The "user input constants" were included because the formula needs to be applied to a program, not just a one time solution with the inbuilt graphing functions of a calculator.

    I use a website QuickMath Automatic Math Solutions to simplify my equations and things, as well as performing various functions, however I haven't played around with it enough to know whether it gives a descent cubic solving function. Though it does do a nice job of showing each and every step, you can leave your formula in the ax^2 + bx + c stage and see the final position of each constant in the end formula. That'll cut right past the understanding of each solving step if you're only interested in getting your program/simulator running. It will however give quite messy equations, but at least they work :S

    -----------------------------------------------------

    I had a quick look at some techniques for solving cubics in the material I have, your best bet is to just google around and find something that works for you if you want to understand the process, theres heaps of good stuff out there, rather than getting only 1 type of solution. The reason there are more than one way of solving things (other than being mathematically possible) is because some people find certain ways of doing things easier than others. So shop around and find something that works for you. I can give you a bunch of links to some good material on cubics and how to solve them logically, but nothing better than you'll find yourself if you google a bit. But I'm sure theres someone willing to run through one process with you here (i'm just unfortunately not one of them).

    G'luck.
    Last edited by Makka; March 12th 2008 at 08:56 AM.
    Follow Math Help Forum on Facebook and Google+

  13. #13
    Flow Master
    mr fantastic's Avatar
    Joined
    Dec 2007
    From
    Zeitgeist
    Posts
    16,948
    Thanks
    5
    Quote Originally Posted by Makka View Post
    [snip]I apologise if my response confused or was so woefully incorrect that you found it necessary to dress me down, but at least I pinged a light bulb initially.

    ttyl
    It was hardly a dressing down. But if that's how it came across to you, then here:

    The missing ingredient, which we now know, was the fact that the values of a, b, c, d, and e are input data.
    Last edited by mr fantastic; March 12th 2008 at 05:31 PM.
    Follow Math Help Forum on Facebook and Google+

Similar Math Help Forum Discussions

  1. Replies: 3
    Last Post: August 21st 2011, 01:12 PM
  2. what is the range (minimum and maximum values of:
    Posted in the Trigonometry Forum
    Replies: 1
    Last Post: March 10th 2011, 01:52 PM
  3. Replies: 4
    Last Post: December 8th 2010, 02:47 PM
  4. calulating tension in a string
    Posted in the Math Topics Forum
    Replies: 9
    Last Post: October 6th 2010, 12:24 PM
  5. Calulating Robotic arm measurements
    Posted in the Algebra Forum
    Replies: 0
    Last Post: May 7th 2009, 01:18 PM

Search Tags


/mathhelpforum @mathhelpforum