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.Sun, 05 Apr 2020 09:38:08 +0200How to factorise a quantity obtained after summing?https://ask.sagemath.org/question/50537/how-to-factorise-a-quantity-obtained-after-summing/ list=[]
for n in range(2,20,2):
s = sum(1/k^n,k,1,oo)/(pi)^n
print(s)
list.append(s.factor())
print(list)
My code is given above I'm not able to use the .factor() function, I understand that this is due to the type of s in the above code which is sage.symbolic.expression.Expression . My question is how to convert it into 𝚜𝚊𝚐𝚎.𝚛𝚒𝚗𝚐𝚜.𝚛𝚊𝚝𝚒𝚘𝚗𝚊𝚕.𝚁𝚊𝚝𝚒𝚘𝚗𝚊𝚕 or something else so that I can factorise it. In the end I want to make a list of these numbers factorized.abhinavSun, 05 Apr 2020 09:38:08 +0200https://ask.sagemath.org/question/50537/What does Sage offer for expression manipulations?https://ask.sagemath.org/question/30394/what-does-sage-offer-for-expression-manipulations/I heard that advanced expression manipulation isn't Sage's strong side. But are there simple conversions like
convert(expr, X) where X is in {factorial, binomial, Gamma, hypergeom, partfrac, etc.. }?
For example how to convert (n!/k!)*binomial(k,n-k) to factorials? With Maple this would look like:
convert( (n!/k!)*binomial(k,n-k), factorial);
Peter LuschnyMon, 02 Nov 2015 06:07:04 +0100https://ask.sagemath.org/question/30394/Convert expression to univariate polynomial over symbolic ring properlyhttps://ask.sagemath.org/question/25556/convert-expression-to-univariate-polynomial-over-symbolic-ring-properly/If I create polynomial like this
R.<x> = SR[]
var('a')
f = a*x^3+1
I get such list of variables
sage: f.variables()
(x,)
But how to convert existing expression to univariate polynomial over symbolic ring?
When I do like this
var('a')
f = a*x^3+1
P.<x> = SR[]
I get following output
sage: P(f).variables()
()
sage: SR['x'](f).variables()
()
How to convert `f` to polynomial in a right way with `x` as variable.
petRUShkaMon, 19 Jan 2015 11:57:47 +0100https://ask.sagemath.org/question/25556/