Ask Your Question
0

Is there a command or a way in SageMath to collect more than one common variable in an equation? without specifying those common variable or write them manually

asked 2024-02-18 23:37:27 +0200

anonymous user

Anonymous

updated 2024-02-19 02:59:34 +0200

Max Alekseyev gravatar image

Is there a command or a way in SageMath to collect more than one common variable in an equation without specifying those common variable or write them manually, for example I want the following equation

-36*beta*t*exp(-4*beta*t) +14*exp(-4*beta*t)-12*beta*t*exp(-6*beta*t) -18*exp(-6*beta*t)+5

to be written like this

(-36*beta*t+14)*exp(-4*beta*t) +(-12*beta*t-18)*exp(-6*beta*t)+5

I do not to specify the common variables since the code I am running is iteration so I do not know the values what will be

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2024-02-19 10:36:59 +0200

Emmanuel Charpentier gravatar image

updated 2024-02-21 07:29:26 +0200

EDIT : A previous answer (seriously out of scope...) has been edited out.

Nothing direct, as far as I know.

Of note : if you have Mathematica (or the (gratis, but not free) Wolfram Engine),

sage: foo._mathematica_().FullSimplify().sage()
-2*(18*beta*t - 7)*e^(-4*beta*t) - 6*(2*beta*t + 3)*e^(-6*beta*t) + 5

does what you want (and some more, such as factoring coefficients).

HTH,

edit flag offensive delete link more

Your Answer

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

Add Answer

Question Tools

1 follower

Stats

Asked: 2024-02-18 23:37:27 +0200

Seen: 118 times

Last updated: Feb 21