Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Function design

  1. Jul 18, 2008 #1

    i'm not a mathematician at all so I'm sorry for not using correct jargon.

    I need to create functions that give a specified output. I'm able to draw the graphs that should correspond with the output values of the function, however I haven't got a clue how to get the corresponding function...

    The functions I need to create produce a single value from a single parameter. The parameter specifies a date or a number of days from a starting point.

    A very good example:
    I need a function that gives the percentage of extra protein need during a workout program.
    This graph (http://www.vspop.org/images/graph09.jpg) shows a nice example of a graph that i can produce. What is tells is that during the first days of the workout program, the percentage should gradually be increased. After a certain maximum value, the percentage should gradually drop to zero again...

    Is there a way to get a function from a graph? Or is there special software available which takes this reversed approach?

    Thank you all.
  2. jcsd
  3. Jul 18, 2008 #2


    User Avatar
    Science Advisor
    Homework Helper
    Gold Member
    Dearly Missed

    As a nice, neat formula? Nope.
  4. Jul 18, 2008 #3

    No, a way :tongue:
  5. Jul 18, 2008 #4


    User Avatar
    Science Advisor
    Homework Helper

    There's Excel and CurveExpert.
  6. Jul 18, 2008 #5
    So, if i'm correct (see attachment):

    1.) I fill in the numbers
    2.) I do the Curve Finder
    3.) I see my function

    Or do I need to be a little bit more experienced with math before I do these kind of things? :wink:

    Attached Files:

  7. Jul 18, 2008 #6


    User Avatar
    Science Advisor
    Homework Helper

    Yeah, that's pretty much it. Now choosing between some type of curve fit (on the Apply Fit menu or with the Curve Finder) and some kind of interpolation (on the Interpolate menu) depends on what you want to do, and deciding which of the curve fits is best for you also relies on what you need.

    If you need any help on that, I trust you'll ask here or elsewhere?
  8. Jul 18, 2008 #7
    Thank you, this is exactly what I needed :approve:

    This is kinda for a secret project.. but are there any nutritional experts here?
  9. Jul 18, 2008 #8


    User Avatar

    On determining equations for graphs, if you study properties of functions for long enough, you could probably guess a function to generally describe your curve. For example, what you described might be described as a third degree polynomial with a domain and range (in the x and y values) of ≥0.

    Go ahead and visit the Biology or Medical section

    Good luck!

    Your sample graph was titled "excess deaths!" I hope you're not working them too hard.
    Last edited: Jul 18, 2008
  10. Jul 19, 2008 #9
    I think this will take some time lol. I imagine that after defining some functions with the help of CurveExpert, I could guess the function i should use, and maybe approximate the coefficients. For now I think I have to stick to the program..

    I included the sample graph solely for its curve...
  11. Jul 19, 2008 #10


    User Avatar
    Science Advisor

    Ropie, try the following and see if it's close enough.

    [tex] y = 8.75 \, x^{1.6} \, e^{-x/12} \, - \, 16.5 \, x/74 [/tex]

    Where x is the number of years after 2008.

    Attached Files:

  12. Jul 19, 2008 #11
    Lol uart,

    thank you for the input, but you didn't really get the question...

    The curve that I attached was just an example. I need to get functions of a lot of curves... I can get them with CurveExpert...
  13. Jul 19, 2008 #12


    User Avatar
    Science Advisor

    Yes I posted that as an example to see if it was close enough for your puroses because it was obtained with only some very simple parameter fitting to the general curve [itex]x^a e^{-bx}[/itex].

    My point is that if your other curves are of a similar nature to the example you linked then I'd recommened experimenting with functions of this form. :)
    Last edited: Jul 19, 2008
  14. Jul 20, 2008 #13
    Sorry my bad.

    I do not have a good view of how all curves will look, so i just really need a general way to get 'a function from a curve'. I'm not experienced enough to look at functions and quickly see which parameter to change, or which parameter to add/subtract to get a specific result... But thanks for the input!
  15. Jul 20, 2008 #14
    I recomend that you get to know functions, more importantly distirbution shapes well. This can help you fit functions to your graphs. For example, the picture you have looks like a Weibull to me [tex] f(x) = {k \over \lambda} \left({x \over \lambda}\right)^{k-1} e^{-(x/\lambda)^k}\ [/tex]. You can fit the parameters using a fitting method such as least sqaures, http://en.wikipedia.org/wiki/Least_squares . Then you may wish to check the goodness of fit using chi-squared goodness of fit. http://en.wikipedia.org/wiki/Pearson's_chi-square_test

    Hope this helps
  16. Jul 20, 2008 #15
    Wow, it's all very logical to read. Especially about the sum of residuals which needs to has the lowest value to get the most optimal fit.

    I have a very good skill of thinking conceptually and visualizing data and models, but I have very little functional knowledge of math operators etc. This makes a wiki page like the Least Squares, with a lot of Math symbols a bit overwhelming and hard to read.

    Anyway thanks for the input!

    p.s. Is this curve fitting method that you explain the same method that CurveFinder applies?
  17. Jul 21, 2008 #16
    this is silly , you're arbitrarily modeling some kind of nutritional theory using polynomials. that's not how data modeling works. if it were that easy all theoretical scientists would just use excel.

    for example here is a function i fit to real radioactive decay data using curve expert.


    very pretty and smooth except that it's completely wrong outside the first and last data points because the behavior is actually similar to an exponential decay function.

    so what is this secret project? scheming to sell people a workout routine based on poorly motivated models and pretty graphs?
  18. Jul 21, 2008 #17
    I'm not modeling, just getting the function from a curve.

    The range where the function delivers good values is the range I'll use. Otherwise I need another curve ;-)

    First of all, it will be free. Second, I'm not modeling, scientists do. I just use their (scientifically motivated) data to build a curve.
  19. Jul 21, 2008 #18


    User Avatar
    Staff Emeritus
    Science Advisor

    There are a number of ways of "curve fitting", many of which have already been mentioned. But all of them require some 'a priori' decision as to what kind of function you want to use. Given any finite amount of information, there exist an infinite number of different functions that will match that information.
  20. Jul 21, 2008 #19
    Ah :smile:, I think that is what most people here were trying to say?

    As for my project, i don't think it really matters which function is used, as long as the right value is produced with given parameters...

    In addition: are all different kinds of functions included in CurveExpert?
  21. Jul 21, 2008 #20


    User Avatar
    Science Advisor

    To be fair to the OP, hasn't mentioned anything about using the function to extrapolate the data. I agree that it would be interesting to know exactly what it will be used for.
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook

Have something to add?

Similar Discussions: Function design
  1. Function ? (Replies: 30)