Ask Your Question

# 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

## Comments

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

( 2016-02-16 17:14:14 -0600 )edit

Ah! I didn't know about this tag. Good.

( 2016-02-17 12:11:19 -0600 )edit

## 1 answer

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

## Comments

Yep, that's it, thanks!

( 2016-02-17 04:29:16 -0600 )edit

## Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

## Stats

Asked: 2016-02-15 04:12:08 -0600

Seen: 264 times

Last updated: Feb 16 '16