Ask Your Question

levav's profile - activity

2025-01-24 18:06:25 +0100 received badge  Famous Question (source)
2025-01-17 17:02:58 +0100 received badge  Notable Question (source)
2025-01-17 17:02:58 +0100 received badge  Popular Question (source)
2025-01-07 19:46:06 +0100 commented question Getting a specific Coefficient of a non-commuting formal power series in multiple variables

That works like a charm! Thank you.

2025-01-07 19:21:30 +0100 asked a question Getting a specific Coefficient of a non-commuting formal power series in multiple variables

Getting a specific Coefficient of a non-commuting formal power series in multiple variables This is a continuation of qu

2025-01-07 15:13:15 +0100 received badge  Supporter (source)
2025-01-07 15:12:50 +0100 commented answer getting a specific Coefficient of a non-commuting monomial in multiple variables

Thank you very much! this worked perfectly. Should I open a bug about this in git, or is this expected behavior?

2025-01-07 15:12:11 +0100 marked best answer getting a specific Coefficient of a non-commuting monomial in multiple variables

Example:

A.<a,b> = FreeAlgebra(QQ, 2)
f = a + a * b - b * a
f.coefficient(a*b)

Throws:

AssertionError: a*b should be an element of Free monoid on 2 generators (a, b)

After some investigation:

c = f.monomial_coefficients()
type(list(c.keys())[0])
<class 'sage.monoids.free_monoid.FreeMonoid_with_category.element_class'>

But:

type(a*b)
<class 'sage.algebras.free_algebra.FreeAlgebra_generic_with_category.element_class'>

This might be a bug? I'm not sure. For now, the only 'solution' I have is something like this:

mon_keys = list(c.keys())
str_keys = [str(k) for k in c.keys()]
i = str_keys.index(str(a*b))
print(f[mon_keys[i]])

Which prints:

1

as expected.

Note that this is a playground example, in practice I need to get this result from a Lyndon word in the generators, hence some of the generalities that would otherwise seem slightly unneeded. Anyhow, Is there a way to avoid this ugly hack?

2025-01-07 13:51:09 +0100 received badge  Student (source)
2025-01-07 12:17:36 +0100 received badge  Organizer (source)
2025-01-07 12:16:11 +0100 asked a question getting a specific Coefficient of a non-commuting monomial in multiple variables

getting a specific Coefficient of a non-commuting monomial in multiple variables Example: A.<a,b> = FreeAlgebra(Q

2025-01-07 09:50:47 +0100 commented answer How to implement Non Commuting Multivariate Formal Power Series rings in SageMat

Thank you so much! that solved my issue completely. Just wish I could upvote lol

2025-01-07 09:50:29 +0100 commented answer How to implement Non Commuting Multivariate Formal Power Series rings in SageMat

Thank you so much! that solved my issue completely.

2025-01-07 09:50:13 +0100 marked best answer How to implement Non Commuting Multivariate Formal Power Series rings in SageMat

Hi everyone,

As the title says, I need to use Non Commuting Multivariate Formal Power Series rings (Over P-adics) for my masters research, and while I found Non Commuting Multivariate Polynomial rings (e.g. the FreeAlgebra) and Multivariate Formal Power Series rings, I haven't found something that mixes both.

Is there some terminology for this that I'm missing? Or a simple way to implement this in sage?

Edit: I need to be able to do calculations with its generators. For example, (a+1)^(-1) should be 1 - a + a^2 - a^3 + ... + O(..) when 'a' is a generator.

2025-01-07 09:50:13 +0100 received badge  Scholar (source)
2025-01-06 20:39:11 +0100 received badge  Editor (source)
2025-01-06 20:39:11 +0100 edited question How to implement Non Commuting Multivariate Formal Power Series rings in SageMat

How to implement Non Commuting Multivariate Formal Power Series rings in SageMat Hi everyone, As the title says, I nee

2025-01-06 20:37:46 +0100 commented answer How to implement Non Commuting Multivariate Formal Power Series rings in SageMat

Thank you for the answer! I tried it but didn't manage to do calculations with its elements. I should've mentioned that

2025-01-06 20:36:19 +0100 commented answer How to implement Non Commuting Multivariate Formal Power Series rings in SageMat

Thank you for the answer! I tried it but didn't manage to do calculations with its elements. I should've mentioned that

2025-01-06 18:10:32 +0100 asked a question How to implement Non Commuting Multivariate Formal Power Series rings in SageMat

How to implement Non Commuting Multivariate Formal Power Series rings in SageMat Hi everyone, As the title says, I nee