First time here? Check out the FAQ!

Ask Your Question
0

simplifying out negative signs in exponents

asked 6 years ago

Jason021 gravatar image

Hello all!

I can't for the life of me find a way to force sage to return terms with only positive coefficient variable exponents. For example, if I enter something like

assume(n, 'integer', n>10)
c = 2^(-n)

I would like the output to be something like 1/(2^n), but instead I can only get something like 2^(-n). Is there a way to force the output to display only positive coefficients in front of the n?

In general I'd like some magicFunc function which I could feed some expression g(x,n) and have it return a rational expression with no negatives; eg.

var('x,n')
assume(x,'real')
assume(n,'integer',n>10)
g(x,n) = 2^(-n)*x^(-3*n)*3^n
magicFunc(g(x,n))

Would return 3^n/(2^n*x^(3n))

Is this possible? This seems like it should be an existent simplification method, but nothing I've tried seems to work.

Thanks!

Preview: (hide)

Comments

What version of Sage are you using? Type version() at the Sage prompt.

slelievre gravatar imageslelievre ( 6 years ago )

1 Answer

Sort by » oldest newest most voted
1

answered 6 years ago

tmonteil gravatar image

Isn't this the case already ? On my laptop (SageMath version 8.3.rc2), i have:

sage: var('x,n')
....: assume(x,'real')
....: assume(n,'integer',n>10)
....: g(x,n) = 2^(-n)*x^(-3*n)*3^n
(x, n)
sage: g
(x, n) |--> 3^n/(2^n*x^(3*n))

sage: c = 2^(-n)
sage: c
1/(2^n)
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

1 follower

Stats

Asked: 6 years ago

Seen: 598 times

Last updated: Jul 25 '18