Thanks for the reply!  That's a perfect example of what I am doing
now.  Can I go one level higher and define my generating function as a
product of terms *while leaving the actual degrees, coefficients, and
even the number of dimensions symbolic*.  So instead of getting
something like

(5*x0*x1 + 1)*(3*x0*x1*x4 + 1)

I want to get something like

product(exponent_list, lambda c,d: 1 + c * pot(x, d))

Maybe the second argument should be some kind of a paramaterizable
expression.  So what I'm looking for is a "first-class" product/
summation construct, and an arbitrary number of generators for my
formal power sum.  Even a way to specify the generic construct

vector_power(x, d)

that will float around in my expressions until I take a derivative.
For example, I want something notionally like the following.

sage: vector_power(x,d).derivative(x[1])
d[1] * vector_power(x,d) / x[1]

So the ``vector_power`` construct would have to know how to use the
power rule of differentiation.

Does this make sense?  Is it possible?

Thanks!

- Ryan

On Jun 30, 11:37 am, pang <pablo.ang...@uam.es> wrote:
> > Can I do this in Sage?
>
> Sure. Here you have some tips:
>
> {{{id=1|
> #Create n variables with names x1, x2 ... xn
> #and store them in a list vs
> n = 5
> vs = var(' '.join('x%d'%j for j in range(5)))
> vs
> ///
> (x0, x1, x2, x3, x4)
>
> }}}
>
> {{{id=6|
> def pot(vs,ds):
>     return prod(v^d for v,d in zip(vs,ds))
>
> pot(vs,[1,2,3])
> ///
> x0*x1^2*x2^3
>
> }}}
>
> {{{id=2|
> def generating_function(cs):
>     return prod(1 + c*pot(vs,ds) for ds,c in cs.items())
>
> generating_function({(1,1,0,0,1):3, (1,1,0,0,0):5})
> ///
> (5*x0*x1 + 1)*(3*x0*x1*x4 + 1)
>
> }}}

-- 
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to 
sage-support+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org

Reply via email to