On Dec 11, 1:36 pm, Jason Grout <[email protected]> wrote:
>
> I think it may have just been a copy-paste error from the lmul function.

There is an error in lmul, but there is also an inconsistency between
the manual and the docstring for rmul (that is, if I'm reading them
correctly):

According to the manual, r*s returns the value of s._rmul_(r).
According to the docstring for _rmul_, it is s*r which should return
the value of s._rmul_(r).


Perhaps Kwankyu and I are misunderstanding one or both of the
sources.  In any case, the real question of which method gets called
can be easily tested using the Localization example [1] from the same
manual page.  I changed _rmul_ and left _lmul_ alone, so we have

   def _rmul_(self, c):
       return LocalizationElement(self.parent(), c**2 * self._value)

   def _lmul_(self, c):
       return LocalizationElement(self.parent(), self._value * c)

sage: S = Localization([2]); S
Integer Ring localized at [2]

sage: s = S(1/2)
sage: r = 5

sage: s*r
LocalElt(5/2)

sage: r*s
LocalElt(25/2)

So it seems that (with R the base of S, r in R and s in S), s*r
returns the value of s._lmul_(r) and r*s returns the value of
s._rmul_(r).

best,
Niles

[1]

-- 
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org

Reply via email to