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

First time here? Check out the FAQ!

Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

asked 5 years ago

joakim_uhlin gravatar image

Defining q-binomial coefficients (nk)q symbolic in

I would like to verify certain identities involving sums of q-binomial coefficients (nk)q and as such, I would like to treat the q-binomial coefficients as if they were symbolic in n and k. But the version of q-binomial coefficients that are implemented in Sage cannot be used as a symbolic variable in n and k according to this thread. So, to this end I defined my own:

var('q,n,k')
qint = lambda n: sum([q^i for i in range(n)]) 
qfac = lambda n: 1 if n==0 else prod([qint(i) for i in range(1,n+1)])
qbin = lambda n,k:qfac(n)/(qfac(k)*qfac(n-k))

But if I write

sum(qbin(n,k),k,0,n)

I get the following error:

ValueError: cannot convert n + 1 to int

Is there a way to do these types of summations in Sage? I should note that, for my purposes, it would be enough to limit myself to the case when n and k are non-negative integers.

Defining q-binomial coefficients (nk)q symbolic in

I would like to verify certain identities involving sums of q-binomial coefficients (nk)q and as such, I would like to treat the q-binomial coefficients as if they were symbolic in n and k. But the version of q-binomial coefficients that are implemented in Sage cannot be used as a symbolic variable in n and k according to this thread. So, to this end I defined my own:

var('q,n,k')
qint = lambda n: sum([q^i for i in range(n)]) 
qfac = lambda n: 1 if n==0 else prod([qint(i) for i in range(1,n+1)])
qbin = lambda n,k:qfac(n)/(qfac(k)*qfac(n-k))

But if I write

sum(qbin(n,k),k,0,n)

I get the following error:

ValueError: cannot convert n + 1 to int

Is there a way to do these types of summations in Sage? I should note that, for my purposes, it would be enough to limit myself to the case when n and k are non-negative integers.

Defining q-binomial coefficients (nk)q symbolic inin n and k

I would like to verify certain identities involving sums of q-binomial coefficients (nk)q and as such, I would like to treat the q-binomial coefficients as if they were symbolic in n and k. But the version of q-binomial coefficients that are implemented in Sage cannot be used as a symbolic variable in n and k according to this thread. So, to this end I defined my own:

var('q,n,k')
qint = lambda n: sum([q^i for i in range(n)]) 
qfac = lambda n: 1 if n==0 else prod([qint(i) for i in range(1,n+1)])
qbin = lambda n,k:qfac(n)/(qfac(k)*qfac(n-k))

But if I write

sum(qbin(n,k),k,0,n)

I get the following error:

ValueError: cannot convert n + 1 to int

Is there a way to do these types of summations in Sage? I should note that, for my purposes, it would be enough to limit myself to the case when n and k are non-negative integers.

Defining q-binomial coefficients (nk)q symbolic in n and kn,k

I would like to verify certain identities involving sums of q-binomial coefficients (nk)q and as such, I would like to treat the q-binomial coefficients as if they were symbolic in n and k. But the version of q-binomial coefficients that are implemented in Sage cannot be used as a symbolic variable in n and k according to this thread. So, to this end I defined my own:

var('q,n,k')
qint = lambda n: sum([q^i for i in range(n)]) 
qfac = lambda n: 1 if n==0 else prod([qint(i) for i in range(1,n+1)])
qbin = lambda n,k:qfac(n)/(qfac(k)*qfac(n-k))

But if I write

sum(qbin(n,k),k,0,n)

I get the following error:

ValueError: cannot convert n + 1 to int

Is there a way to do these types of summations in Sage? I should note that, for my purposes, it would be enough to limit myself to the case when n and k are non-negative integers.

EDIT: As an example, I would like to prove something like the q-binomial theorem, which says

nk=0qk(k1)/2(nk)qxk=n1k=0(1+qkt)

Defining q-binomial coefficients (nk)q symbolic in n,k

I would like to verify certain identities involving sums of q-binomial coefficients (nk)q and as such, I would like to treat the q-binomial coefficients as if they were symbolic in n and k. But the version of q-binomial coefficients that are implemented in Sage cannot be used as a symbolic variable in n and k according to this thread. So, to this end I defined my own:

var('q,n,k')
qint = lambda n: sum([q^i for i in range(n)]) 
qfac = lambda n: 1 if n==0 else prod([qint(i) for i in range(1,n+1)])
qbin = lambda n,k:qfac(n)/(qfac(k)*qfac(n-k))

But if I write

sum(qbin(n,k),k,0,n)

I get the following error:

ValueError: cannot convert n + 1 to int

Is there a way to do these types of summations in Sage? I should note that, for my purposes, it would be enough to limit myself to the case when n and k are non-negative integers.

EDIT: As an example, I would like to prove something like the q-binomial theorem, which says

$\sum_{k=0}^n $$\sum_{k=0}^n q^{k(k-1)/2} \binom{n}{k}_q x^k = \prod_{k=0}^{n-1} (1+q^k t)$t)$$

Defining q-binomial coefficients (nk)q symbolic in n,k

I would like to verify certain identities involving sums of q-binomial coefficients (nk)q and as such, I would like to treat the q-binomial coefficients as if they were symbolic in n and k. But the version of q-binomial coefficients that are implemented in Sage cannot be used as a symbolic variable in n and k according to this thread. So, to this end I defined my own:

var('q,n,k')
qint = lambda n: sum([q^i for i in range(n)]) 
qfac = lambda n: 1 if n==0 else prod([qint(i) for i in range(1,n+1)])
qbin = lambda n,k:qfac(n)/(qfac(k)*qfac(n-k))

But if I write

sum(qbin(n,k),k,0,n)

I get the following error:

ValueError: cannot convert n + 1 to int

Is there a way to do these types of summations in Sage? I should note that, for my purposes, it would be enough to limit myself to the case when n and k are non-negative integers.

EDIT: As an example, I would like to prove something like the q-binomial theorem, which says

$$\sum_{k=0}^n q^{k(k-1)/2} \binom{n}{k}_q x^k = \prod_{k=0}^{n-1} (1+q^k t)$$x)$$

EDIT2: Fixed a typo.