Ask Your Question
1

solve exponential

asked 2016-02-15 11:12:08 +0200

mare gravatar image

updated 2023-01-09 23:59:39 +0200

tmonteil gravatar image

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 flag offensive close merge delete

Comments

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

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

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

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

1 Answer

Sort by ยป oldest newest most voted
2

answered 2016-02-16 10:29:33 +0200

ndomes gravatar image

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_())
edit flag offensive delete link more

Comments

Yep, that's it, thanks!

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

Your Answer

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

Add Answer

Question Tools

Stats

Asked: 2016-02-15 11:12:08 +0200

Seen: 454 times

Last updated: Feb 16 '16