# Function design

1. Jul 18, 2008

### roppie

Hi,

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" [Broken]) 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.

Last edited by a moderator: May 3, 2017
2. Jul 18, 2008

### arildno

As a nice, neat formula? Nope.

3. Jul 18, 2008

### roppie

No, a way :tongue:

4. Jul 18, 2008

### CRGreathouse

There's Excel and CurveExpert.

5. Jul 18, 2008

### roppie

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?

#### Attached Files:

• ###### CurveExpert.jpg
File size:
93.5 KB
Views:
133
6. Jul 18, 2008

### CRGreathouse

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?

7. Jul 18, 2008

### roppie

Thank you, this is exactly what I needed

This is kinda for a secret project.. but are there any nutritional experts here?

8. Jul 18, 2008

### Mk

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
https://www.physicsforums.com/forumdisplay.php?f=82
https://www.physicsforums.com/forumdisplay.php?f=149 [Broken]

Good luck!

Your sample graph was titled "excess deaths!" I hope you're not working them too hard.
http://www.vspop.org/images/graph09.jpg

Last edited by a moderator: May 3, 2017
9. Jul 19, 2008

### roppie

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...

10. Jul 19, 2008

### uart

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

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

Where x is the number of years after 2008.

#### Attached Files:

• ###### curve_fit.png
File size:
6.5 KB
Views:
159
11. Jul 19, 2008

### roppie

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...

12. Jul 19, 2008

### uart

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 $x^a e^{-bx}$.

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
13. Jul 20, 2008

### roppie

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!

14. Jul 20, 2008

### Focus

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 $$f(x) = {k \over \lambda} \left({x \over \lambda}\right)^{k-1} e^{-(x/\lambda)^k}\$$. 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

Last edited by a moderator: Apr 23, 2017
15. Jul 20, 2008

### roppie

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?

Last edited by a moderator: Apr 23, 2017
16. Jul 21, 2008

### ice109

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?

17. Jul 21, 2008

### roppie

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.

18. Jul 21, 2008

### HallsofIvy

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.

19. Jul 21, 2008

### roppie

Ah , 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?

20. Jul 21, 2008

### uart

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.