# solve exponential

I've just started to experiment with Sage, so I might be missing something simple here. What I'm trying to do is to solve the following equation:

var('t','k1','k2','y1','y2')
assume(k1>0,k2>0,y1>0,y2>0)
assume(k1,'real')
assume(k2,'real')
assume(y1,'real')
assume(y2,'real')
assume(t,'real')
solve(y1*exp(-t/k1)/k1 - y2*exp(-t/k2)/k2==0,t)


The result is[e^(t/k2) == k1*y2*e^(t/k1)/(k2*y1)], and not fully solved for some reason. I was expecting something like

t==ln(y2*k1/y1*k2)/(1/k2-1/k1)

edit retag close merge delete

Thanks for reporting ! I added a confirmed_bug tag to track such issues.

( 2016-02-17 00:14:14 +0200 )edit

( 2016-02-17 19:11:19 +0200 )edit

Sort by ยป oldest newest most voted

sympy.solvers.solve gives a solution similar to what you expected:

from sympy import solvers, Symbol
y1 = Symbol('y1')
y2 = Symbol('y2')
t = Symbol('t')
k1 = Symbol('k1')
k2 = Symbol('k2')
sol = solvers.solve(y1*exp(-t/k1)/k1 - y2*exp(-t/k2)/k2,t)
show(sol[0]._sage_())

more

Yep, that's it, thanks!

( 2016-02-17 11:29:16 +0200 )edit