Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

I found out that maxima does offer this capability, so one can use it in sage:

sage: p = maxima('sum(a[i]*x^i,i,0,n)')
sage: p
'sum(a[i]*x^i,i,0,n)
sage: p.taylor(x,0,3)                  
a[0]+a[1]*x+a[2]*x^2+a[3]*x^3
sage: p.diff(x)
'sum(i*a[i]*x^(i-1),i,0,n)

sadly:

sage: p.sage()
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
...
TypeError: unable to make sense of Maxima expression 'sum(a[i]*x^i,i,0,n)' in Sage

Also, it is not as strong as maple:

sage: p = maxima('product(1+a[i]*x+b[i]*x^2,i,0,n)')
sage: p.taylor(x,0,3)                               
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
taylor: unable to expand at a point specified in:
'product(b[i]*x^2+a[i]*x+1,i,0,n)
 -- an error. To debug this try: debugmode(true);

whereas in maple this works -

series(product(1+a[i]*x+b[i]*x^2,i=1..k),x=0,3);

gives the desired answer $(1+\sum _{i=1}^{k}a_{{i}}x+ \left( \sum _{i=1}^{k}b_{{i}}-1/2\cdot{a_{{i} }}^{2}+1/2\cdot \left( \sum _{i=1}^{k}a_{{i}} \right) ^{2} \right) {x}^{2 }+O \left( {x}^{3} \right) )$.

I found out that maxima does offer this capability, so one can use it in sage:

sage: p = maxima('sum(a[i]*x^i,i,0,n)')
sage: p
'sum(a[i]*x^i,i,0,n)
sage: p.taylor(x,0,3)                  
a[0]+a[1]*x+a[2]*x^2+a[3]*x^3
sage: p.diff(x)
'sum(i*a[i]*x^(i-1),i,0,n)

sadly:

sage: p.sage()
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
...
TypeError: unable to make sense of Maxima expression 'sum(a[i]*x^i,i,0,n)' in Sage

Also, it is not as strong as maple:

sage: p = maxima('product(1+a[i]*x+b[i]*x^2,i,0,n)')
sage: p.taylor(x,0,3)                               
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
taylor: unable to expand at a point specified in:
'product(b[i]*x^2+a[i]*x+1,i,0,n)
 -- an error. To debug this try: debugmode(true);

whereas in maple this works -

series(product(1+a[i]*x+b[i]*x^2,i=1..k),x=0,3);

gives the desired answer $(1+\sum $1+\sum _{i=1}^{k}a_{{i}}x+ \left( \sum _{i=1}^{k}b_{{i}}-1/2\cdot{a_{{i} }}^{2}+1/2\cdot \left( \sum _{i=1}^{k}a_{{i}} \right) ^{2} \right) {x}^{2 }+O \left( {x}^{3} \right) )$.

$.