On Fri, Apr 9, 2010 at 12:08 PM, Ondrej Certik <[email protected]> wrote:
> Let me know if it helps. Another idea is that this line: > > first * second - third**2 > > probably isn't using polynomial arithmetics, but regular sympy > arithmetics, which will be slow and eat lots of memory. Is there a way > to do the above operations on polynomials only? I think it is and > maybe some things (like multiplication) might be already implemented, > so try to find the correct function, let's call it poly_mul, so try do > do: > > poly_mul(first, second) - poly_mul(third, third) > > and maybe there is some efficient way to do "-", e.g. poly_sub() or something. > > > All of this doesn't matter as long as the polynomials are small, but > in your case it does matter, and so you need to take advantage of what > you know about the expressions, in your case you know that they are > polynomials, and thus stay working just with them (e.g. the polys > module), and avoid converting back to Add/Mul/Pow instances. And if this helps, we can then try to think how to make this automatic, so that you can just write: first * second - third**2 and it will be the same fast. Ondrej -- 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.
