Revision history [back]

Defining family of multivariable polynomials

Brand new to Sage here and trying to define a family of polynomials indexed by natural numbers. In particular, I'd like to be able to generate then perform symbolic calculations with the family of polynomials defined for all $n\in \mathbb{N}$ and all $k=0,\dotsc, 2n$ by $$p_k=\begin{cases} 0 & \textrm{if } k=0\newline \sum_{j=1}^k x_k&\textrm{if } k\leq n\newline \sum_{j=1}^{2n-k+1}x_j&\textrm{if }k>n \end{cases}$$

So far the attempts that I've had are of the form:

h = lambda k:sum([var('d_%d' %(i+1)) for i in range(k)])

but I don't seem to easily perform calculations with these. Another method I was trying is by defining $\mathbb{Q}[x_0,\dotsc, x_n]$ then trying to defining these polynomials using conditional statements but keep getting errors that my variables don't exist.

Would love some help or a hint.

Brand new to Sage here and trying to define a family of polynomials indexed by natural numbers. In particular, I'd like to be able to generate then perform symbolic calculations with the family of polynomials defined for all $n\in \mathbb{N}$ and all $k=0,\dotsc, 2n$ by $$p_k=\begin{cases}$$p_{n,k}=\begin{cases} 0 & \textrm{if } k=0\newline \sum_{j=1}^k x_k&\textrm{if x_j&\textrm{if } k\leq n\newline \sum_{j=1}^{2n-k+1}x_j&\textrm{if }k>n \end{cases}$$So far the attempts that I've had are of the form: sage: h = lambda k:sum([var('d_%d' %(i+1)) for i in range(k)])range(k)])  but I don't seem to easily perform calculations with these. Another method I was trying is by defining \mathbb{Q}[x_0,\dotsc, x_n] then trying to defining these polynomials using conditional statements but keep getting errors that my variables don't exist. Would love some help or a hint. Defining family of multivariable polynomials Brand new to Sage here and trying to define a family of polynomials indexed by natural numbers. In particular, I'd like to be able to generate then perform symbolic calculations with the family of polynomials defined for all n\in \mathbb{N} and all k=0,\dotsc, 2n by$$p_{n,k}=\begin{cases} 0 & \textrm{if } k=0\newline \sum_{j=1}^k x_j&\textrm{if } k\leq n\newline \sum_{j=1}^{2n-k+1}x_j&\textrm{if }k>n \end{cases}

So far the attempts that I've had are of the form:

sage: h = lambda k:sum([var('d_%d' %(i+1)) for i in range(k)])


but I don't seem to easily perform calculations with these. Another method I was trying is by defining $\mathbb{Q}[x_0,\dotsc, x_n]$ then trying to defining define these polynomials using conditional statements but statements. I seem to keep getting errors that stating my variables don't exist.

Would love some help or a hint.