Hi Simaon,

I've got a functional patch worked up, which will need some polish to
be ready.  Very soon.

The modulus seems to have  Mod( , )*  in each term, prior to every
occurrence of the variable, so using a straight replacement of  (* +
variable_name) in _finite_field_ext_pari_modulus_as_str() should fix
the modulus.  Then the element can be hit with a replacement *before*
wrapping in the outermost Mod.  Modulo three tiny fixups, patch seems
to work for tests in sage/rings.

So I think it can be fixed without resorting to regular expressions.
Thankfully.

Rob

On Jun 21, 10:43 pm, Simon King <[email protected]> wrote:
> Hi Rob,
>
> On 21 Jun., 22:17, Rob Beezer <[email protected]> wrote:
>
> > sage: F.<d> = GF(3^2)
> > sage: d._pari_()
> > Mod(d, Mod(1, 3)*d^2 + Mod(2, 3)*d + Mod(2, 3))
> > sage: d._pari_init_("m")
> > 'Mom(m, Mom(1, 3)*m^2 + Mom(2, 3)*m + Mom(2, 3))'
> > sage: d._pari_init_("p")
> > 'Mop(p, Mop(1, 3)*p^2 + Mop(2, 3)*p + Mop(2, 3))'
> > sage: d._pari_init_("b")
> > 'Mob(b, Mob(1, 3)*b^2 + Mob(2, 3)*b + Mob(2, 3))'
>
> WHAT? We actually have
>   sage: d._pari_init_??
>         ...
>         g = self.parent()._finite_field_ext_pari_modulus_as_str()
>         f = str(self.polynomial())
>         s = 'Mod(%s, %s)'%(f, g)
>         if var is None:
>             return s
>         return s.replace(self.parent().variable_name(), var)
>
> Not good to use "replace" here...
>
> But what else? A regular expression, perhaps?
>
> Cheers,
> Simon

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

Reply via email to