Ask Your Question
1

Order of variable for simplification

asked 2021-11-17 00:36:34 +0100

Studentaaaaaaaa gravatar image

updated 2021-11-17 17:18:51 +0100

Let's say I have two variables x, q. When I use simplify_full(), how do I make sure the final expression is ordered as monomial of X instead of q? For example, let f=q^2+x+1, g=qx+1. Somehow if I use simplify_full() to simplify fg, then the monomial is of the following form (expression in terms of x)q^3+(expression in terms of x)q^2...

But actually I regard x as the variable, q as power of prime number. So I wish to order the expression like: (expression in terms of q)X^2+(expression in terms of q)X+(expression in terms of q)

Thanks!

edit retag flag offensive close merge delete

Comments

Welcome to Ask Sage! Thank you for your question.

slelievre gravatar imageslelievre ( 2021-11-17 11:47:03 +0100 )edit

Ideally, add the simplest example illustrating your question.

slelievre gravatar imageslelievre ( 2021-11-17 11:47:17 +0100 )edit

@slelievre Thanks! I just edited the question.

Studentaaaaaaaa gravatar imageStudentaaaaaaaa ( 2021-11-17 17:19:15 +0100 )edit

Great. You might even include the code you have so far.

slelievre gravatar imageslelievre ( 2021-11-17 17:25:56 +0100 )edit

1 Answer

Sort by ยป oldest newest most voted
1

answered 2021-11-17 23:09:03 +0100

eric_g gravatar image

I guess you should use

(f*g).expand().collect(x)

See x.collect? for more information.

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

Stats

Asked: 2021-11-17 00:36:34 +0100

Seen: 178 times

Last updated: Nov 17 '21