1
$\begingroup$

I'm not super with math but I need to make a function in my web app to get the value of a point on a curve when I know the curve points that are set. Here is what I did, I put a set of point with the x and y set at the know points then did an exponential trend line with limits of 1.15 to 3 for the x value. The y value ranges from 0-1000. I get for the formula output from excel as

y = 5.3785e0.7204x
R² = 0.9898 

Here are the points I have

x        y
10      3
25      2.95
50      2.75
100     2.5
200     2
300     1.5
1000    1.15

I short i need to have my web app say, what is the y value when x is 176. I know this is probably simple for you math guys but I'd be thankful the help. Cheers

2 Answers 2

1

Note that your text says y ranges from 0 to 1000 and x from 1.15 to 3, but your data is the reverse. When I plot it, the data doesn't fit an exponential at all. The last point is way off, with the rest fitting a straight line very well. If I had to use this data I would either throw away the point at 1000 or use a pair of linear fits, one from 10 to 300, and another from 300 to 1000.

The way to read your output from excel is $y=5.3785e^{0.7204x}$ and in the computer languages I have used you would write y=5.3785*exp(0.7204*x), but that can't be right because y increases with x while the data goes the other way. When I fit the data as presented to an exponential in excel, I get $y=2.7032e^{-.001x}$ and if I transpose x and y I get $y=10046e^{-2.054x}$

  • 0
    Yes your right this really doesn't fit an exponential function does it. Well those are the points.. um.. well i tried to adding 5.3785*exp(0.7204*A2) were A2 is a cell that is value of 10 so it should solve to 3 but it does not. I get 7233.00259.. for 2.7032*-EXP(0.001*A2) i get -2.730367612 .. all 3 you put don't seem to get the right number. The way i got the 5.3785e0.7204x was from the trend line. .. not she here.2012-08-28
0

Using Octave, I used least squares to fit a line of the form $x \mapsto ax+b$ to the data points $(x_i, \ln y_i)$ above, and ended up with $a \approx -0.95815 \times 10^{-3}$, $b \approx 0.99445$. This corresponds to a model $y = K e^{\alpha x}$ where $\alpha = a \approx -0.95815 \times 10^{-3}$ and $K = e^b \approx 2.7032$.

So the model should be $y = 2.7032 e^{-0.95815 \times 10^{-3} x}$.

  • 0
    not 100% here but i used =2.7032*-EXP(0.95815*A2*10^-10*A2) in excell to test it were X is 10 expecting 3 but i got -2.7032000026 (A2 is the x)2012-08-28
  • 0
    I have really no idea what you are doing. Why would you not use 2.7032*exp(-0.95815e-3*A2) (assuming $x$ is in A2)? I mean, where did the 10^10 and extra A2 come from? Also, you put the minus sign outside the exponential.2012-08-28
  • 0
    well lol. i just put in what i thought you had but left a typo from the other anwser. I put 2.7032*exp(-0.95815e-3*A2) and got 2.677422978 where A2 = 10 .. so doesn't seem right.2012-08-28
  • 0
    Well, I doubt you will get an exact match, and a value of 2.677 is not too bad compared to the expected 3?2012-08-28
  • 0
    Well i don't really have a choice here to be close 10 has to come out to 3, 25 has to be 2.95 and 50 need to be 2.75 etc on the rest already noted.2012-08-28
  • 0
    @jeremyBass_DC Why would you want such a function? The exponential function that copper.hat mentioned is the best fitting curve in exponential form with a reasonable level of complexity. If you really want a function which directly yields those values, you can use the [Lagrange Interpolating Polynomial](http://mathworld.wolfram.com/LagrangeInterpolatingPolynomial.html), but it will be a 6th degree polynomial and it will fluctuate more wildly from the estimated relationship for points outside the range you described.2012-08-28
  • 0
    @MichaelBoratko i guess I'm a little lost.. excel made a treand line that starts at 10 outputting 3 and stays very close.. i guess i only really need it to be 10 outputing 3 and going to 300 hitting near1.5 and 1000 near 1.15 but not more then 1.15 .. i get this from excel y = 5.3785e0.7204x but here is what i want http://screencast.com/t/FgqEpI9Ee3t2012-08-28
  • 0
    @jeremyBass_DC You want the black line in that image? It seems like the black line is given by $y=5.3785e^{0.7204x}$. I don't know what you mean in the image when you say "the app will get the larger value", what larger value? The value of the blue line?2012-08-28
  • 0
    @MichaelBoratko yes it the black line but.. see if I put in =5.3785*EXP(0.7204*A2) as the out says i get 7233.00259 were A2 is 10 ... which should come out as 3 not 7233.. so i don't get that ..2012-08-28
  • 0
    @jeremyBass_DC Ah, I see - your x and y values are backwards - the graph is also going right to left. Read Ross' answer again.2012-08-28
  • 0
    I'm sorry I tried those and still don't get the right value.. at that I'm not sure how it's transposed cause excel did the graph.. lol. i seem to be quite lost here lol.2012-08-28