Ticket #598 (closed enhancement: fixed)

Opened 6 years ago

Last modified 3 years ago

implement substitute for monoids

Reported by: was Owned by: mhansen
Priority: minor Milestone: sage-4.4
Component: basic arithmetic Keywords:
Cc: Work issues:
Report Upstream: N/A Reviewers: Paul Zimmermann
Authors: Mike Hansen Merged in: sage-4.4.alpha0
Dependencies: Stopgaps:

Description

On 9/5/07, Joel B. Mohler <joel@kiwistrawberry.us> wrote:
\> Yes, so I found FreeMonoid after sending my first e-mail and was testing it
> out.  I think I may have found something that is not implemented:
> 
> sage: a=FreeMonoid(1,'a').0
> sage: a*a
> a^2
> sage: a.substitute(5)
> a  # should be 5?
> sage: a.substitute(a=5)
> a  # should be 5?
> 
> I would have expected those last two results to be 5 -- am I missing
> something? 

The whole "substitute" architecture was implemented in SAGE
long after monoids were implemented.  So you'll have to implement
monoid substitution. 

> I guess substituting isn't an entirely common operation for free
> monoids, but it seems to be a sensibly defined operation.  Then again, maybe
> not:
> 
> sage: M.<x,y> = FreeMonoid(2)
> sage: (x*y).substitute(x=1)
> x*y  # I would think that this is 1*y
> 



> I find that result unsatisfactory as well, but I sure don't have a good idea
> about what ring (?) the result '1*y' would be a part of.

Just do the arithmetic.    All monoids have a 1 by definition, so 1*y is just "y"
in that monoid.

William

Attachments

trac_598.patch Download (4.1 KB) - added by mhansen 3 years ago.

Change History

comment:1 Changed 6 years ago by was

  • Owner changed from somebody to jbmohler

comment:2 Changed 4 years ago by mhansen

  • Owner changed from jbmohler to mhansen
  • Status changed from new to assigned

Changed 3 years ago by mhansen

comment:3 Changed 3 years ago by mhansen

  • Status changed from new to needs_review
  • Report Upstream set to N/A
  • Authors set to Mike Hansen

comment:4 Changed 3 years ago by zimmerma

  • Status changed from needs_review to positive_review
  • Reviewers set to Paul Zimmermann

A positive review for me.

Note: I did all doctests, and got exactly 22 Segfaults, as with vanilla 4.3.3 (see #7773). Thus if a new failure occurred within one of those 22 doctests, I couldn't see it.

comment:5 Changed 3 years ago by jhpalmieri

  • Status changed from positive_review to closed
  • Resolution set to fixed
  • Merged in set to sage-4.4.alpha0

Merged in 4.4.alpha0.

Note: See TracTickets for help on using tickets.