# Converting a problem solved with numerical analysis to a simple exponential

1. Jan 29, 2010

### bill.connelly

I'm just a neuroscientist, so forgive me if the answer to this question is either obvious, or the answer is that it is impossible, obviously.

Basically, this image should outline the question clearly
http://img713.imageshack.us/img713/2569/mathsissuefixedyxs.gif [Broken]
(And Y0 is always 1)

Also, I tried just fitting an exponential to the output. For instance, if I set Y0=1, i = 1, k = 1 and D=0.5, then the output is explained by the curve Yn = (1 - 0.7746)*e^(1.693 * t) + 0.7746 so I can't see the relation, between the fit constants constants in the numerical method

Oh, and just in case anyone is confused about the exponential recovery process equation
yn = (y(n-1) * D) + (1 - y(n-1) * D) * (1 - e^(-k*i))
I modeled it after the general equation for exponential recovery
Y = initial value + (asymptote - initial value) * (1 - e^(-k*x))

Last edited by a moderator: May 4, 2017
2. Jan 31, 2010

### torquil

Your difference equation is of the form y(n) = A*y(n-1) + B, where y(0) = 1.

The solution I get is y(n) = A^n + B/(1-A)

I'm guess the A<1 in your case, since the solution decreases? I have assumed that A is not 1.

But I may have made a mistake. I used the common method of first finding the solution to the homogeneous equation (B=0), and then find a particular solution of the inhomogeneous equation.

Torquil

3. Jan 31, 2010

### bill.connelly

Okay... and how do your constants of A and B relate to my constants Y0, i, k and D?

Last edited: Jan 31, 2010
4. Jan 31, 2010

### Count Iblis

A = De^(-k i)

B = 1 - e^(-k i)

5. Jan 31, 2010

### bill.connelly

Interesting... the seems to match very closely apart from the fact that the initial value is not 1, i.e. when n = 1

6. Jan 31, 2010

### Count Iblis

The general solution is:

y(n) = K A^n + B/(1-A)

where K is some arbitrary constant that you can adjust to get the correct initial value. Putting n = 1 gives

y(1) = K A + B/(1-A) --->

K = [y(1) - B/(1-A)]/A

7. Jan 31, 2010

### bill.connelly

Ah, excellent. That is amazing!

How complicated does it get if between events, instead of the process recoverying with a single exponential, it recovery with a bi-exponential

i.e. the equation for the second event would be

Y=Y1*D + (1-Y1*D)*PercentFast*(1-exp(-KFast*i)) + (1-Y1*D)*(1-PercentFast)*(1-exp(-KSlow*i))

8. Feb 1, 2010

### bill.connelly

Is that too hard to calculate the difference equation for? Is it likely there is another forum that someone might be able to do it?

9. Feb 1, 2010

### torquil

As far as I can see, this is still of the same form y(n+1) = A*y(n) + B, so the solution is the same, only with other values of A and B. A is everything that multiplies y(n) on the right hand side of your equation, and B is the rest.

Torquil