1. ## Algebra help

a = (1-e^(bt))/(1-e^(ct))

Isolate t (a, b, c are all known).

Anyone?

If you are curious as to why I need to solve this - I am trying to determine the parameters of an exponential decay given 3 points.

V = Vf - (Vf - Vi)e^(-t/r)
where r is the time constant.

(this is the transient response of a battery after a charging current or a load has been removed)

After solving the system (3 V's and 3 t's), I got an equation in the form above, and couldn't solve it.

2. Believe it would be:

t = ln(1 - a(1-e^(ct)))/b

EDIT: Don't hold me to this, though. it is 12:21am

3. Pretty sure that's transcendental. That's why God gave us iterative solvers.

4. I might be wrong, but maybe:

r = ( e ^ ( b - c ) )
a = r ^ t

The subtraction of one can be dropped, since it occurs on both sides (the ratio is unchanged).

EDIT:

Doh, I still haven't isolated 't'. Lemme think on that a bit.

EDIT#2:

I do know that isolating 't' from 'r' is a simple matter. Something to do with the log function...it's on the tip of my mind here...someone?

5. Originally Posted by Sebastiani
I might be wrong, but maybe:

r = ( e ^ ( b - c ) )
a = r ^ t

The subtraction of one can be dropped, since it occurs on both sides (the ratio is unchanged).

EDIT:

Doh, I still haven't isolated 't'. Lemme think on that a bit.
If you're telling me (5-1)/(4-1) is equal to 5/4, I'm a bit worried about you.

6. >> If you're telling me (5-1)/(4-1) is equal to 5/4, I'm a bit worried about you.

Hehe. I can assure you that your worries are justified. I'm not sure why I came to that conclusion, actually (bad intuition, I guess).

7. Thanks for the replies!

Kennedy -
I tried plugging it in and got
a = a(1-e^(ct))/(1-(1-a(1-e^(ct)))^(c/b))

Meaning, if a != 0, (1-e^(ct)) = (1-(1-a(1-e^(ct)))^(c/b))

I don't think that is possible, since the left side does not depend on b at all.
How did you arrive at that answer?

tabstop -
No idea what that means (I am only doing second year math), but will look that up. Thanks!

8. No solution exists in closed form. However, since both the numerator and denominator are monotonic, the ratio is also monotonic, which means you can use bisection to find a solution iteratively.

In other words, find two initial values of t such that the value of the RHS is less than a for one of them, and greater than a for the other. Then recursively bisect the interval, getting closer and closer to the true root.

Something like:

Code:
```double Function( double b, double c, double t )
{
return ( 1.0 - exp( b * t ) ) / ( 1.0 - exp( c * t ) );
}

double FindRoot( double a, double b, double c )
{
double tLow = ???;
double tHigh = ???;
double guess = Function( b, c, tLow );

while( fabs( a - guess ) > 1e-5 )
{
double tMid = ( tLow + tHigh ) * 0.5;
guess = Function( b, c, tMid );
if( guess > a ) tHigh = tMid else tLow = tMid;
}
return tLow;
}```
If you don't know what to put in for the ??? marks, just use a very small (but nonzero) value for tLow and a very large value for tHigh. The only requirement is that tLow < tTrue < tHigh

9. Notes:
(1) I know that I mentioned iterative solvers up top too, but if you are at an actual institution of higher learning you probably have access to Mathematica or Maple or the moral equivalent thereof. (It won't give you a closed form either, unless there's one of those weird functions out there that can be used; but none of the ones I'm familiar with work.)
(2) Even if you are not, Wolfram has unbent so far as to have Wolfram Alpha solve that equation numerically using the Mathematica engine, if you have numbers for a, b, and c.

10. brewbuck - Thanks! That makes sense. It's like a binary search.

Yeah we have all those programs on lab computers, but we haven't learned to use them, yet.

We have only used Matlab so far in our math (and engineering) courses (btw, after writing a moderately sized program for a project in Matlab, I can't imagine any more fundamentally flawed language than Matlab. Fine for interactive prompt, garbage for actual programming).

11. Originally Posted by cyberfish
Yeah we have all those programs on lab computers, but we haven't learned to use them, yet.
Yes, but that will be time very very very very very very very very well spent. (And if you use Wolfram Alpha, I just typed in .5 = (1-e^(3t))/(1-e^(4t)) and got an answer.)
Originally Posted by cyberfish
We have only used Matlab so far in our math (and engineering) courses (btw, after writing a moderately sized program for a project in Matlab, I can't imagine any more fundamentally flawed language than Matlab. Fine for interactive prompt, garbage for actual programming).
I don't remember too much being silly about the language per se, once you accept the premise that numbers are special cases of matrices (which can take a while); I do remember the performance being atrocious though.

12. Ah ok, I will certainly look into those.

I don't remember too much being silly about the language per se, once you accept the premise that numbers are special cases of matrices (which can take a while); I do remember the performance being atrocious though.
The biggest complaint I have is that it, for all intents and purposes, requires either the whole program to be in 1 huge file, or have a separate file for every single function. Both of which are impractical (and there is no "include", so not even a way to simulate some kind of organization). This is from the fact that a script can only see 1 function in every file, the one that matches the name of the file. So if you have functions A and B that you want to access, and they both need to access helper functions c, d, and e, you have a few options -
1) put them all in separate files
2) have A and B in separate files, and a copy of c, d, and e in both
3) just have the whole program in one file to eliminate this problem

None of which are elegant IMHO.

And then there is the OOP thing, where member functions have to take an explicit "this" parameter, and accesses to class members must be made through that reference (this.variable). And the funniest thing - member functions return a copy of the object!

We eventually gave up on both, and just have a bunch of global functions and global variables in one huge file.

EDIT:
And of course, since variables don't need to be declared, a typo in a variable name usually means the program won't complain, it will just make it a new variable. But I guess that applies to many scripting languages.

13. Since Matlab allows its functionality to be used in C/C++, why not give it a whirl? Cannot say I have tried it myself, but it is on my list to-do if and when I get another project to do in it and I have the time for it.