Loading [MathJax]/jax/output/HTML-CSS/jax.js
Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

How to add a condition in the sum funciton in sage

I want to implement the following sum nj=0ajxj under the following conditions the coefficient aj=j if j is even, or j+1 otherwise. My problem is how to include these cases in the sum function in sage. Normally the command is sum(a_j*x^j,j,1,n) but how to distinguish between the parity of j ?

click to hide/show revision 2
None

updated 0 years ago

FrédéricC gravatar image

How to add a condition in the sum funciton in sage

I want to implement the following sum nj=0ajxj under the following conditions the coefficient aj=j if j is even, or j+1 otherwise. My problem is how to include these cases in the sum function in sage. Normally the command is sum(a_j*x^j,j,1,n) but how to distinguish between the parity of j ?