# I need to solve x from: A*exp(K*x)+B*x = CIt's for a program, so i can't use numeric-aproximation.A, K, B and C are well known numbers.

kjcdb8er | Teacher | (Level 1) Associate Educator

Posted on

I don't know of any way to explicitly solve for x.

But, if it's for a computer program, why can't you use numeric approximation? If you use newton's method, usually you can obtain accurate convergence in only a few iterations.

Use f(X) = A*exp(Kx) + Bx - C = 0

Xn = Xp - f(Xp)/f'(Xp), where Xn is your next guess for x, and Xp is your previous guess. You can use any convenient guess as the first Xp, and the algorithm will work.

f'(x) is easy to calculate:

f'(x) = K*A*exp(K*x) + B

Continue the loop until your value is not changing more than 0.1 %, or whatever degree of precision you want.

You also don't have to worry about  multiple zeros since the exponential function doesn't have any, and you can base your initial guess on the equation B*X0 = C since the first zero will always be in the vicinity of where the exponential goes to zero. If there are further zeros you are interested in, starting at some point past the minimum/maximum of the function  (if it exists) should bring you to the second zero. I don't believe there are occasions where there are more zeros than that with this equation. However, you should look out for the case where there are no zeros, like in e^x - x.

neela | High School Teacher | (Level 3) Valedictorian

Posted on

To find a solution for  A*e^(kx) +Bx = C.

We can write the equation as:

e^(kx) = (C-bx)/A , which has a real solution provided (C-bx)A is positive. So

e^(kx) = (C-bx)/A > 0. Therefore,

kx = ln((C-Bx)/A)

Therefore.

x = (1/k)ln((C-Bx')/A).

We can use this as an iterating equation X2 = (1/k)ln((C-BX1)/A), where x1 is any tentative estimate of x. by substituting in the iteration equation we can get the estimate of X2.

Example:

5* 10^x  + 100x = 8486.56.

10^x = (8486.56 - 100x)/5

10^x =  (1697.312 - 20x). Tentatively 10^3 =1000 . And x must be around 3. put x1 = 3

x1 = log (1697.312-20*3) =  3.214

X2 = log(1697.312-20*3.214) = 3.213

x3 = log(1697.312-20*3.213) = 3.21300001

It is clear that futher iteration gives the estimate at 3.213 only. So x= 3.213 is the solution.

So x3 =3.213 .

Verification : 5*10^3.213+100.3.213 = 8165.2597+321.3 = 8486.5597. You can use the base e instead of base 10