# Thread: State an equation that best fits these results?

1. ## State an equation that best fits these results?

Hi there, this is my first question on here that I am struggling with and would love some clarification:
I needed to do some coin tosses (this has nothing to do with probability) and make a chart based on the tosses and values (starting with 20, each coin toss I would remove all heads up coins and, record what coins are left return all coins that are tails into the cup for the next toss). I would need to repeat this until no coins remain, so here's my results:

toss=coins remaining
0=20
1=15
2=12
3=9
4=5
5=3
6=1

How would I graph these results? I would also need to state an equation that best fits these results? And lastly, I would have to state another equation that would predict the number of remaining coins if I began with N(base=0).

I appreciate all help and thank you for your efforts.

I am thinking that the coin tosses =x and the coins remaining after each toss = y? I would need confirmation on this and how to go about doing the equation normally and if I were to begin with N(base=0).

2. What do you mean by "best fits these results". You are given 7 data points so there exist a sixth degree polynomial that exactly passes through those 7 points.
You could set this up as $y= ax^6+ bx^5+ cx^4+ dx^3+ ex^2+ fx+ g$ and then let x and y be from each data point to get 7 equations to solve for the 7 coefficients. For example, when x= 0, y= 20 so $a(0^6)+ b(0^5)+ c(0^4)+ d(0^3)+ e(0^2)+ f(0)+ g= g= 20$.

On the other hand there are probably simpler functions (linear, quadratic, etc.) that come close to those points.

3. I think the equation is going to be exponential, because on average, for each coin toss, you'll have 1/2 heads and 1/2 tails. That is, the number of coins that you remove for each round is going to be, on average, half of the coins you tossed. It's exactly like the exponential decay of radioactive materials. So I would assume a function of the form

$N=N_{0}e^{-kt},$

where $N$ is the number of coins remaining at toss $t$, and $N_{0}$ is the initial number of coins. You already know $N_{0}$. The trick is to figure out the $k$. I would probably use a least squares fit procedure. That is, try to minimize the error of

$E=\sum_{j=1}^{T}(y_{j}-N_{0}e^{-kt_{j}})^{2}.$ Set $\dfrac{dE}{dk}=0$ and off you go.

Another equivalent approach would be to plot the logarithm of your data (essentially, you're plotting on a semilog plot). Then you can fit a straight line to the data. Theory:

$\dfrac{N}{N_{0}}=e^{-kt},$ and therefore

$\ln\left(\dfrac{N}{N_{0}}\right)=-kt=\ln(N)-\ln(N_{0}).$

So, if you define a new variable, $z=\ln(N),$ then you've got yourself the equation $z=-kt+\ln(N_{0}).$ You can fit a straight line to that from your data, which is quite straight-forward to do in Excel, for example, and from that you can get your $k$. This is probably the easiest way to go.

4. Originally Posted by HallsofIvy
What do you mean by "best fits these results". You are given 7 data points so there exist a sixth degree polynomial that exactly passes through those 7 points.
You could set this up as $y= ax^6+ bx^5+ cx^4+ dx^3+ ex^2+ fx+ g$ and then let x and y be from each data point to get 7 equations to solve for the 7 coefficients. For example, when x= 0, y= 20 so $a(0^6)+ b(0^5)+ c(0^4)+ d(0^3)+ e(0^2)+ f(0)+ g= g= 20$.

On the other hand there are probably simpler functions (linear, quadratic, etc.) that come close to those points.
Sorry for causing confusion, I have no problem graphing them anymore and that looks more like a polynomial. We have to put the equation in exponential form c(2^x-P)+q, and I'm completely stumped and don't know where to begin.

5. Originally Posted by Ackbeet
I think the equation is going to be exponential, because on average, for each coin toss, you'll have 1/2 heads and 1/2 tails. That is, the number of coins that you remove for each round is going to be, on average, half of the coins you tossed. It's exactly like the exponential decay of radioactive materials. So I would assume a function of the form

$N=N_{0}e^{-kt},$

where $N$ is the number of coins remaining at toss $t$, and $N_{0}$ is the initial number of coins. You already know $N_{0}$. The trick is to figure out the $k$. I would probably use a least squares fit procedure. That is, try to minimize the error of

$E=\sum_{j=1}^{T}(y_{j}-N_{0}e^{-kt_{j}})^{2}.$ Set $\dfrac{dE}{dk}=0$ and off you go.

Another equivalent approach would be to plot the logarithm of your data (essentially, you're plotting on a semilog plot). Then you can fit a straight line to the data. Theory:

$\dfrac{N}{N_{0}}=e^{-kt},$ and therefore

$\ln\left(\dfrac{N}{N_{0}}\right)=-kt=\ln(N)-\ln(N_{0}).$

So, if you define a new variable, $z=\ln(N),$ then you've got yourself the equation $z=-kt+\ln(N_{0}).$ You can fit a straight line to that from your data, which is quite straight-forward to do in Excel, for example, and from that you can get your $k$. This is probably the easiest way to go.
Thank you for clarifying everything, so far I am following.

However, the only equation we learned was: $N_0=N_0 2^(t/d)$ and I've tried applying this equation any way I could but it wouldn't fit at all.

So how would I derive this exponential equation after plotting my graph? And let's say they asked us to do another coin-toss with the same coins, but this time after counting the heads and placing them aside, we would add them to the existing values on the right-hand side?

So it would be something like:
0=20
1=26
2=32
3=35
etc.

Thanks for all the help, by the way.

6. $N=N_{0}\,2^{-t/d}$ will work just as well. Just plot

$\log_{2}(N)$ on the vertical axis, and $t$ on the horizontal. Theory:

$\dfrac{N}{N_{0}}=2^{-t/d},$ so

$\log_{2}\left(\dfrac{N}{N_{0}}\right)=\log_{2}(N)-\log_{2}(N_{0})=-t/d.$ So you get

$\log_{2}(N)=\log_{2}(N_{0})-t/d.$

Since all exponentials are essentially the same, this will work out to much the same thing as my other idea.

7. Originally Posted by Ackbeet
$N=N_{0}\,2^{-t/d}$ will work just as well. Just plot

$\log_{2}(N)$ on the vertical axis, and $t$ on the horizontal. Theory:

$\dfrac{N}{N_{0}}=2^{-t/d},$ so

$\log_{2}\left(\dfrac{N}{N_{0}}\right)=\log_{2}(N)-\log_{2}(N_{0})=-t/d.$ So you get

$\log_{2}(N)=\log_{2}(N_{0})-t/d.$

Since all exponentials are essentially the same, this will work out to much the same thing as my other idea.
So, for the second $N_{0}$ equation where the unlike the first the y-values are increasing, we would have to introduce log here? Or is this for deriving the equation from the graph? I am currently using a graphing software and even though I have the exact function which is: $26.368233*0.62675604^x$ I don't have the slightest clue of putting this in exponential equation form.

8. Increasing:

$\dfrac{N}{N_{0}}=2^{t/d}.$

Decreasing:

$\dfrac{N}{N_{0}}=2^{-t/d}.$

9. Originally Posted by Ackbeet
Increasing:

$\dfrac{N}{N_{0}}=2^{t/d}.$

Decreasing:

$\dfrac{N}{N_{0}}=2^{-t/d}.$
Thank you for all the help so far, I just have one more problem, how would I go about deriving an exponential equation from the Graph? I do have the general knowledge of using a regular equation: y=mx+b. Unfortunately, I haven't been taught at all how to put logarithmic and exponential graphs in equation form.

10. Originally Posted by Pupil
Thank you for all the help so far, I just have one more problem, how would I go about deriving an exponential equation from the Graph? I do have the general knowledge of using a regular equation: y=mx+b. Unfortunately, I haven't been taught at all how to put logarithmic and exponential graphs in equation form.
If you're attempting to fit the data to an equation of the form $N = N_0 e^{kt}$ then you should note that by taking the log of both sides you have $\ln (N) = kt + \ln (N_0)$.

Therefore you can fit a straight line to a plot of $\ln(N)$ versus $t$. The gradient of this line gives you the best estimate of k and the vertical intercept gives you $\ln (N_0)$ from which $N_0$ can be got.

11. Originally Posted by mr fantastic
If you're attempting to fit the data to an equation of the form $N = N_0 e^{kt}$ then you should note that by taking the log of both sides you have $\ln (N) = kt + \ln (N_0)$.

Therefore you can fit a straight line to a plot of $\ln(N)$ versus $t$. The gradient of this line gives you the best estimate of k and the vertical intercept gives you $\ln (N_0)$ from which $N_0$ can be got.
Thank you for that, but I was looking for a general exponential equation that would best fit the graph.

12. Thank you for that, but I was looking for a general exponential equation that would best fit the graph.
Haven't you already been given that? If you think of $N=N_{0}\,2^{t/d},$ where $d$ is any real number, then you've got the increasing and decreasing cases both covered. Is there something more that you need?