ASKSAGE: Sage Q&A Forum - RSS feedhttps://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Tue, 24 Jul 2018 23:19:26 +0200simplifying out negative signs in exponentshttps://ask.sagemath.org/question/43132/simplifying-out-negative-signs-in-exponents/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!Jason021Tue, 24 Jul 2018 23:19:26 +0200https://ask.sagemath.org/question/43132/How to simplify expression with fractional exponents?https://ask.sagemath.org/question/10006/how-to-simplify-expression-with-fractional-exponents/Is there a way to have Sage recognize that e^(2/3) times e^(1/3) in the below will simplify to just the variable e. Is there a type that can handle this? Obviously using a PolynomialRing in the code below won't work.
R.<a,e> = PolynomialRing(QQ)
p1 = (a+e^(1/3))
p2 = e^(2/3)
p1*p2kevinfatTue, 09 Apr 2013 21:24:12 +0200https://ask.sagemath.org/question/10006/