Loading [MathJax]/jax/output/HTML-CSS/jax.js
Ask Your Question
1

Excluding a common factor in a sum

asked 9 years ago

drs663 gravatar image

I'm trying to figure out how to simplify this expression in Sage:

y = tau1*exp(-t/tau1)/(tau1 - tau2) - tau1*exp(-t/tau2)/(tau1-tau2)

When I try factor(y) or simplify(y), I get this:

-tau1*(e^(t/tau1) - e^(t/tau2))*e^(-t/tau1 - t/tau2)/(tau1 - tau2)

However, the result I would like to see is this:

 tau1/(tau1 - tau2)*(exp(-t/tau1) - exp(-t/tau2))

which seems like the simplest form to me. I've not been able to get this result with the various simplify commands or with assumptions (BTW, all variables are real, and tau1 & tau2 > 0).

In this case the simplest form is obvious, of course, but it would be a great help to be able to get this right for larger expressions.

Preview: (hide)

1 Answer

Sort by » oldest newest most voted
3

answered 5 years ago

Emmanuel Charpentier gravatar image

Try:

sage: var("t, tau, tau_1, tau_2")
(t, tau, tau_1, tau_2)
sage: f = tau_1*exp(-t/tau_1)/(tau_1 - tau_2) - tau_1*exp(-t/tau_2)/(tau_1-tau_2)
....: 
sage: f.collect_common_factors()
tau_1*(e^(-t/tau_1) - e^(-t/tau_2))/(tau_1 - tau_2)

(i. e. τ1(e(tτ1)e(tτ2))τ1τ2), which, IMHO, is what you seek.

Preview: (hide)
link

Your Answer

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

Add Answer

Question Tools

2 followers

Stats

Asked: 9 years ago

Seen: 872 times

Last updated: Oct 27 '19