Associative-Magmatic-Algebras

327 views
Skip to first unread message

Animesh Shree

unread,
Mar 11, 2024, 1:57:29 PM3/11/24
to sage-gsoc
Hello Sir,

I was going through "Algebras" and I had a doubt.
Does MagmaticAlgebra and AssociativeAlgebra have to be implemented over Ring only? 
I went through internet and google uses rings to define those algebras, but the axioms that those algebra follow (Unital, Associative) are also preserved by commutative semirings.
Would it be good to define MagmaticAlgebra and AssociativeAlgebra over other objects that follow those axioms too or come-up with alternative Algebra?

tcscrims

unread,
Mar 11, 2024, 2:56:38 PM3/11/24
to sage-gsoc
Mathematically speaking, you can always weaken axioms. However, there are some extra advantages that additive groups have that commutative semirings don't have (mainly 0, the additive identity).

That being said, there isn't anything prevent you from constructing the appropriate categories. It would be good to have a more specific use-case in mind, but that isn't necessary. However, one should be careful with the name because it would conflict with what "most" people would call an algebra (which is why we have MagmaticAlgebras).

Best,
Travis

Animesh Shree

unread,
Mar 21, 2024, 11:18:26 AM3/21/24
to sage-gsoc
Hello Sir,

I have submitted my proposal.
Please review it and let me know necessary updates and improvements. 

I want to verify soundness of my approach and extend the proposal for Multivariate Polynomials.

Thank You
Animesh Shree

Animesh Shree

unread,
Mar 26, 2024, 12:12:45 PM3/26/24
to sage-gsoc
I was going through this code and got error. But I could not understand why this is the case.




sage: T = TropicalSemiring(QQ)
sage: T(1)
1
sage: T(2)
2
sage: T(-2)
-2
sage: -T(2)
---------------------------------------------------------------------------
ArithmeticError                           Traceback (most recent call last)
Cell In[26], line 1
----> 1 -T(Integer(2))

File ~/sage/src/sage/rings/semirings/tropical_semiring.pyx:278, in sage.rings.semirings.tropical_semiring.TropicalSemiringElement.__neg__()
    276     if self._val is None:
    277         return self
--> 278     raise ArithmeticError("cannot negate any non-infinite element")
    279
    280 cpdef _mul_(left, right) noexcept:

ArithmeticError: cannot negate any non-infinite element
sage:


It looks like starting with T(-2) and reaching to -2 from T(2) by comparing with zero(+Inf) are different things.
T(-2) = -2
T(2) -T(2) = T.zero(+inf) = T(2)  + (-T(2))

My doubt is : if  we cannot negate the elements, then how can we compute the determinant of a Matrix over Tropical Semiring.
For example in 2x2 matrix : [[a,b], [c,d]] the determinant should be ad - bc 
But can it be expressed as ad + (-bc) -->> min ( add(a,d),   -1*add(b,c) )?

In fact we connot even do matrix subtraction directly.
What can be done in these cases??

Animesh Shree

unread,
Mar 26, 2024, 1:17:39 PM3/26/24
to sage-gsoc
This problem can be seen clearly if we use Matrix_generic_dense as element class for matrix space.
ask.txt

tcscrims

unread,
Mar 28, 2024, 2:46:44 PM3/28/24
to sage-gsoc
One needs to be *very* careful about what operations mean. -T(2), the (tropical) additive inverse of 2, is not T(-2). There is no way to have min(2, a) = \infty (note that this is the (tropical) additive unit).

I am not sure how (or if) determinants over the tropical semiring are defined, but one could define it by having the sign included in each term. So for the 2x2 case, it could be T(a*b) + T(-b*d), but I don’t know if this makes det a group homomorphism.

Best,
Travis

Animesh Shree

unread,
Mar 30, 2024, 5:45:12 PM3/30/24
to sage-gsoc
I read about Matrix Algebra over Tropical Semiring and found that there is "tropical determinant" for this purpose (Page 3 : Eq 4). This formulation does not use (additive) inversion.

I was also trying different operations between tropical elements and other elements(like Integers). It looks like there is a need for implementation of coercion maps between few datatypes and tropical elements.
One can check this by running few commands like
        sage: T = TropicalSemiring(QQ)
        sage: a = T(1); b = T(0)
        sage: a + 0; b + 0
        sage: a * 0; b * 0
        sage: a + 1; b + 1
        sage: a * 1; b * 1

Coercion maps and models are crucial for polynomial element implementation.
For example : between
'Symbolic Ring' and 'Tropical semiring over Rational Field' 
'Univariate Polynomial Ring in x over Tropical semiring over Rational Field' and 'Tropical semiring over Rational Field' 
'Tropical semiring over Rational Field' and 'Integer Ring' 

tcscrims

unread,
Mar 30, 2024, 5:54:02 PM3/30/24
to sage-gsoc
First, coercion is not in any way essential for polynomial rings. It makes some things a bit more cumbersome, but it is certainly workable by putting elements in the tropical semiring.

Second, the operations between, e.g., integers and tropical ring elements does *not* make sense. What is T(1) + 1? Is it 1 or 2? There's no good way to answer this. The case with (integer) 0 under addition is a special case that I would like to not have, but changing that would be more work than the benefit.

Best,
Travis

Animesh Shree

unread,
Mar 31, 2024, 2:06:25 AM3/31/24
to sage-gsoc
Actually I was facing few errors.
The 4th error made me feel like coercion was required.
ask_poly.txt

Animesh Shree

unread,
Mar 31, 2024, 5:22:35 AM3/31/24
to sage-gsoc
Sorry, I mistakenly attached wrong file.
This is the correct one
poly_ask.txt

Animesh Shree

unread,
Apr 2, 2024, 4:19:33 AM4/2/24
to sage-gsoc
I have updated the proposal in GSOC portal. I updated the following things
  • Breakdown of Project Synopsis
  • Added phases of development
  • Updated the schedule
  • Added Appendix for extra details ( diagrams )

I submitted my proposal for the topic : Implement matrix spaces over commutative semirings "
These are my basic details
  • Name: Animesh Shree ( Shay2Shay )  
  • College: Indian Institute of Information Technology, Sri City, India
  • Employment : Student ( 2021-25 Batch, 3rd Year, B.Tech. CSE ) 
  • Skill: Python, Cython, C-API    
Reply all
Reply to author
Forward
0 new messages