Ask Your Question

mathzeta2's profile - activity

2022-11-19 01:06:49 +0200 received badge  Popular Question (source)
2018-08-10 21:26:51 +0200 received badge  Student (source)
2018-06-30 00:40:54 +0200 received badge  Teacher (source)
2018-06-29 19:42:40 +0200 answered a question Offline vs CoCalc

Running on your own computer have its advantages, as does using CoCalc. Some of the advantages of the download version of SageMath:

  • Most modern computers, including laptops, have more computing power than the basic plan offered by CoCalc. For example, you can do computations in parallel, as much as your computer allows.
  • You can work offline. Great in many situations where an internet connection is not available or just slow.
  • Like other files that are important to you, you can backup your SageMath files with your preferred backup solution. They are usually very small.
  • You can install software packages, with specific versions, as you wish on your computer. The download version of SageMath already contains a lot.

In any case, it might be wise to export your work from CoCalc periodically, so you will have a local backup in case CoCalc will change their terms or is accidentally unavailable.

2018-05-13 21:51:50 +0200 asked a question Polynomial rings with an arbitrary infinite set of variables

I have a rational function in $\mathbb{Q}(x)$ which can be computed by substitution of a polynomial in the polynomial ring with integer compositions as variables, with coefficients in $\mathbb{Q}(x)$. The compositions can have unbounded parts. For example, one monomial might be $\frac{1}{1-x}C_{[2,2]}C_{[1,3,1]}$, where $C_\lambda$ is a formal variable related to the integer composition $\lambda$.

I would be happy to have this "symbolic" representation as polynomial over the set of all integer compositions, and not just the polynomial after substituting all of the $C_\lambda$'s. I have tried the following two approaches which failed.

  1. Using the InfinitePolynomialRing class. The setup used:

sage: R = FractionField(QQ["x"])
sage: R.inject_variables()
Defining x
sage: RC.<c> = InfinitePolynomialRing(R)
sage: f = 1/(1-x)*c[3] + 3*c[2]

But then f.subs does not work:

sage: f.subs({c[3]:5})
...[snip]
TypeError: <class 'sage.rings.polynomial.infinite_polynomial_ring.InfinitePolynomialGen'> is not hashable
sage: f.subs(c[3]=5) # Expected not to work.
SyntaxError: keyword can't be an expression

There is also a method called f.specialization which seems to work with substitution of just one variable, but not with more than one, nor when using an element from InfinitePolynomialRing(R, "cd"). There is also the annoyance of using a bijection between the natural numbers and compositions.

  1. Using CombinatorialFreeModule. I know this might seem as an abuse, but a module can also have the structure of a ring...

sage: R = FractionField(QQ["x"])
sage: FM = FreeAbelianMonoid(Compositions())
sage: CR = Rings().Commutative()
sage: CMR = ModulesWithBasis(R)
sage: M = CombinatorialFreeModule(R, FM, category=(CR,CMR)) # Does not work also with category=None
sage: a = M.an_element(); a*a
...[snip]
TypeError: 'NotImplementedType' object is not callable

I assume some magic with the category argument might help. Note that in my case only a free abelian semigroup indexed by compositions is needed, and not a monoid.

Any help is welcomed.