• ### Announcements

#### Archived

This topic is now archived and is closed to further replies.

# Solving an Exponential Function

## Recommended Posts

Hey, I am having some trouble understanding how to solve the following Exponential Function: f(x) = a(e^bx)+c Here are the constraints: f(0) = 0 f(.1) = 1 f(1) = 100 Any hints would recieve a warm welcome Thankyou, Michael Bartman CEO, Lead Programmer Dark Omen Studios http://www.darkomenstudios.com/

##### Share on other sites

f(x) = a * e^(b*x) + c

as

(f(x) - c)/a = e^(b*x)

then take the natural logarithm of both sides
(and use ln(A/B) = ln(A) - ln(B) to expand if so inclined)

ln(f(x) - c) - ln(a) = b*x

then sub in the various values of x and f(x), resulting in 3 fairly simple equations with 3 unknowns (a, b and c). You can replace ln(a) with something else, say A = ln(a) for doing the linear algebra, and then find a using a = e^A

##### Share on other sites
Hey Geoff,

Thanks a ton for your help! I really appreciated it. I''ve been stuck on this problem since the other night.

Thanks again,

Michael Bartman
Dark Omen Studios
http://www.darkomenstudios.com/

##### Share on other sites
Excuse this interruption but could you explain yourself.

I just cannot understand how you can solve it from your final equation, and this makes me irritated.

Is it too much to ask to continue it further?

Just to find out if we are in the same ball park, I got a as roughly 0.6. Does your method get that?

[edited by - sadwanmage on July 5, 2003 6:38:52 PM]

##### Share on other sites
Hey,

I am enrolled in Game Institutes Game Mathematics course, and this problem was used as an example in the text there. The reason I needed help was because they gave the results, but didn''t really explain how to get to them. They simply said they used Mathematica.

Anyway, according to the course material a should be about 2.10999, b should be about 3.87937, and c should be the inverse of a -2.10999.

I haven''t had time to verify if Geoff''s equation works yet, but it looks like it should.

Michael Bartman
Dark Omen Studios
http://www.darkomenstudios.com/

##### Share on other sites
Just tested it with those values, and yes it does work.

Thanks again Geoff!

Michael Bartman
Dark Omen Studios
http://www.darkomenstudios.com/

##### Share on other sites
quote:
Is it too much to ask to continue it further?

It is not. I assumed it wasn''t necessary. Upon attempting to do so however, I found it was somewhat harder than I had thought. Here''s what I did:

Substitute f(0) = 0 into f(x) = a*(exp(b*x)) + c
(1) 0 = a*exp(0) + c
(2) a = -c

Substitute f(.1) = 1, f(1) = 100 into ln(f(x) - c) - ln(a) = b*x

(3) ln(1 + a) - ln(a) = b/10
(4) ln(100 + a) - ln(a) = b

Subtract (4) - 10*(3)

(5) ln(100 + a) + 9*ln(a) = 10*ln(1 + a)
(6) (100 + a)*a^9 = (1 + a)^10

At this point, I''m stumped. Maple 6 will solve for a if I ask it nicely, but it gives 9 answers, 8 of them partly imaginary. The purely real answer is the correct one. (Maple will solve the original system with no problems however... only giving one solution) Doing this analytically is probly not worth the effort, as it would involve factoring a 9th order polynomial and searching for the single purely real root, which is not an integer. You''d have to do this iteratively, I think.

You don''t want me to do that too, do you sadwanmage?

Knowing a, one can easily get b and c.

If someone knows a better way, I''d like to know. Also, why/how does Maple get only the signle, purely real, solution when asked to solve the whole system instead of just equation (6). I assume I''ve generalized a specific case of something or invalidated some property of the original equations by manipulating them.

How did you check my equations, MichaelBartman?

##### Share on other sites
I know what a, b and c should be, so I plugged them into it and both sides were equal. I haven''t worked the problem out yet though.

Michael Bartman
Dark Omen Studios
http://www.darkomenstudios.com/

##### Share on other sites
Using mathematica on equation 6 yields 9 equations as well, so it isn''t just maple.

I assume maple is a program like mathematica.

Thanks,

Michael Bartman
Dark Omen Studios
http://www.darkomenstudios.com/

##### Share on other sites
Thanks, I thought it was not as easy as you said. I did the same thing, but made a mistake, so got the wrong polynomial at the end. Good to know my reasoning is sound though...

##### Share on other sites
(3) ln(1 + a) - ln(a) = b/10

Shouldn''t that be:

(3) ln(1 + a) / ln(a) = b/10

?

I''m new to this kind of math, so I could be wrong. That just looks funny how it went from divided by ''a'' to - the natural log of ''a''.

Michael Bartman
Dark Omen Studios
http://www.darkomenstudios.com/

##### Share on other sites
quote:
Original post by Geoff the Medio
ln(A/B) = ln(A) - ln(B)

Also: ln(A*B) = ln(A) + ln(B)

Thus: ln(A*A) = ln(A) + ln(A) = 2*ln(A) = ln(A^2)

With numbers:

ln(9/3) = ln(9) - ln(3)
ln(3) = ln(9) - ln(3)
ln(3) + ln(3) = ln(9)
2*ln(3) = ln(3^2) = ln(9)
etc...

To verify:
ln(9) = 2.1972
ln(3) = 1.0986

What that what you meant?

##### Share on other sites
That's what I meant, thanks

Michael Bartman
Dark Omen Studios
http://www.darkomenstudios.com/

[edited by - MichaelBartman on July 6, 2003 5:52:02 PM]

##### Share on other sites
Is anyone able to finish solving it? I''d really like to see how it is done.

Thanks,

Michael Bartman
Dark Omen Studios
http://www.darkomenstudios.com/

##### Share on other sites
Rewrite (6):

(100+a)*a^9 - (1+a)^10 = 0

Expand:

-1 - 10*a - 45*a^2 - 120*a^3 - 210*a^4 - 252*a^5 - 210*a^6 - 120*a^7 - 45*a^8 + 90*a^9 = 0

(I did that with Maple, but you could use binomial theorm and do it by hand)

Then try to find a value of a that works by trial and error. The polynomial is odd ordered, so there is guaranteed to be at least one purely real solution (there could be as many as 9).

My efforts: Call the value of the left hand side f(a). Start with f(1) (random coice, you can pick anything), then try various others to narrow it down. Ideally, try to get values of a such that the corresponding values of f(a) are both above and below 0, so you get get a range to start subdividing.

f(1) = -923
f(0) = -1
f(-1) = -99
f(2) = -6825 (discouraging)
f(3) = 978773 (hmm... might steep near this root)
f(2.5) = 115151.7
f(2.25) = 19642.3
f(2.125) = 1414.6
f(2.0625) = -3640.1
f(2.09) = -1678.6
f(2.1) = -1678.6
f(2.11) = 1.26
f(2.105) = -440.0
f(2.1025) = -655.2
f(2.1075) = -221.2
f(2.109) = -88.15
f(2.1095) = -43.52
f(2.1098) = -16.67
f(2.1099) = -7.70
f(2.10995) = -3.22
f(2.10998) = -0.530
f(2.10999) = 0.367
f(2.109985) = -0.0819
f(2.109988) = 0.187
f(2.109987) = 0.0975
f(2.109986) = 0.00782

etc.

Note that I used Maple to do all the calcuations of f(a), while I specified the a's. Trying to do this by hand would be incredibly tedious and error-prone.

Edit: Clarified thing about getting a starting range for a

[edited by - Geoff the Medio on July 7, 2003 1:05:02 AM]

##### Share on other sites
Thanks Geoff!

Michael Bartman
Dark Omen Studios
http://www.darkomenstudios.com/

##### Share on other sites
Newton-Raphson gives it about 2.10998591292375. Who needs Mathmatica or Maple when you have the power of Excel :D

##### Share on other sites
2.109985912923751762225137372342676325737001460677142227104350467099657923318217857097039908918738538068667266491548990462718975985567501461483325693384795286106764626531278835784932263868935878354213291205235337081918151883829082111740782478925023382491688135765692095746173641723502989016032206706988930641083858315551282415439686681079905861234491017793052850159768972772199683606767532599818663389237425896654180972652449702136159272895159775733131998221836605839968115335999994422437217109423813289675987634866520405091706100063914430182039690849076963067849598579498732833640639142857120859619576541585091563733262231689323406376446601250094910713668650499303574387978707320632423320375932749486709352879290522748143379790624510116830748827248255251570243858553992903471856812748577586543615581439629840421406783849766752338558515049370979163602571834620054717669064269524520079943273205622413847780088896575329762726832667545924373754128884019707422265726072707164187216111213539081332834490572

Maple can do more, if you want.

##### Share on other sites
How would you get mathematica to solve to that precision?

I set up the function like this:

f[a_] := Expand[(100 + a)*a^9 - (1 + a)^10]

and then I tell it to solve:

Solve[f[x] == 0, x]

And it gives me 9 equations, instead of solving it.

I know that I am just not doing something right.

Thanks,

Michael Bartman
Dark Omen Studios
http://www.darkomenstudios.com/

##### Share on other sites
I haven''t used mathmatica, but in Maple you do what you did ( just replace your []''s with ()''s ) then ask it to "evalf(result, digits);" where result is the list of 9 equations and digits is the number of digits you want (in this case, 1000). You can also do it in one line like so: evalf(solve(f(a)=0,a),1000);

I suggest you read the mathmatica help on solve and/or whatever command you would normally convert rational (fractions) into numbers with stuff after the decimal point (floating point). I would assume this function would do the same as evalf in Maple.

##### Share on other sites
I figured it out, and it is somewhat similar to Maple.

N[Evaluate[Solve[f[x] == 0, x]], 1000]

Michael Bartman
Dark Omen Studios
http://www.darkomenstudios.com/

[edited by - MichaelBartman on July 7, 2003 6:29:35 PM]