Hi, On Mon, Apr 19, 2010 at 09:39:49AM -0700, smichr wrote: > In polytools when two polys are multiplied, the two polys are unified > first: > > def mul(f, g): > """Multiply two polynomials `f` and `g`. """ > _, per, F, G = f.unify(g) <======================= there > > try: > result = F.mul(G) > except AttributeError: # pragma: no cover > raise OperationNotSupported(f, 'mul') > > return per(result) > > And the first thing that happens when F.mul(G) calls mul in > polyclasses is: > > def mul(f, g): > """Multiply two multivariate polynomials `f` and `g`. """ > lev, dom, per, F, G = f.unify(g) <======= the same as the > above. > > > Why aren't the computed unified values simply passed as arguments with > a flag "unified=True?" rather than being recomputed? Is this a design > issue where it's easier to maintain if one duplicates work rather than > tries to keeptrack of what work has already been done? >
there is no duplication in this case. Lets look into DMP.unify() code:
if f.dom == g.dom:
return f.lev, f.dom, f.per, f.rep, g.rep
else:
# unification code here
If you use Poly.mul() then Poly.unify() will unify domains and structure
of input polynomials, so in DMP.unify() (or any other in polyclasses.py)
(f.dom == g.dom) == True and no unification will be performed.
> --
> You received this message because you are subscribed to the Google Groups
> "sympy" group.
> 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/sympy?hl=en.
>
--
Mateusz
signature.asc
Description: This is a digitally signed message part
