Re: Issue 2132 in sympy: Derivative of RootSum

2011-04-29 Thread sympy
Updates: Status: Fixed Labels: -NeedsReview PassedReview Comment #34 on issue 2132 by matt...@gmail.com: Derivative of RootSum http://code.google.com/p/sympy/issues/detail?id=2132 All this is in master now. -- You received this message because you are subscribed to the Google

Re: Issue 2132 in sympy: Derivative of RootSum

2011-01-06 Thread sympy
Comment #27 on issue 2132 by mattpap: Derivative of RootSum http://code.google.com/p/sympy/issues/detail?id=2132 Now it can: In [1]: f = 161*z**3 + 115*z**2 + 19*z + 1 In [2]: g = Lambda(z, z*log(-3381*z**4/4 - 3381*z**3/4 - 625*z**2/2 - 125*z/2 - 5 + exp(x))) In [3]: RootSum(f, g)

Re: Issue 2132 in sympy: Derivative of RootSum

2011-01-06 Thread sympy
Comment #28 on issue 2132 by mattpap: Derivative of RootSum http://code.google.com/p/sympy/issues/detail?id=2132 It's pretty slow though (70% of time being spent in expand() (the most annoying function in SymPy for me)). -- You received this message because you are subscribed to the Google

Re: Issue 2132 in sympy: Derivative of RootSum

2011-01-06 Thread sympy
Comment #29 on issue 2132 by mattpap: Derivative of RootSum http://code.google.com/p/sympy/issues/detail?id=2132 In 30c7fa78690828a0ac12b0e84c7ede31f4d4beff in polys12 I also fixed the problem with subs() (actually I fixed RootOf(*RootOf(...).args)). -- You received this message because you

Re: Issue 2132 in sympy: Derivative of RootSum

2011-01-06 Thread sympy
Updates: Labels: -NeedsBetterPatch NeedsReview Comment #30 on issue 2132 by mattpap: Derivative of RootSum http://code.google.com/p/sympy/issues/detail?id=2132 (No comment was entered for this change.) -- You received this message because you are subscribed to the Google Groups

Re: Issue 2132 in sympy: Derivative of RootSum

2011-01-06 Thread sympy
Comment #31 on issue 2132 by Vinzent.Steinberg: Derivative of RootSum http://code.google.com/p/sympy/issues/detail?id=2132 Do you use the general expand() or a specialized version, that does not try to expand everything? I think there are many low-hanging fruits in expand()... -- You

Re: Issue 2132 in sympy: Derivative of RootSum

2011-01-06 Thread sympy
Comment #32 on issue 2132 by asmeurer: Derivative of RootSum http://code.google.com/p/sympy/issues/detail?id=2132 So implementing Frac() will make this faster by allowing it to do expand entirely in Poly? And I totally agree with you about expand(). Let's make it a priority to make it

Re: Issue 2132 in sympy: Derivative of RootSum

2011-01-06 Thread sympy
Comment #33 on issue 2132 by asmeurer: Derivative of RootSum http://code.google.com/p/sympy/issues/detail?id=2132 And by the way, my example now works (I forgot to throw in a term): In [6]: cancel((a + x).diff(x)) Out[6]: 1 ─ x5⋅x 1 + ℯ + ℯ So this is exactly what

Re: Issue 2132 in sympy: Derivative of RootSum

2011-01-04 Thread sympy
Comment #24 on issue 2132 by mattpap: Derivative of RootSum http://code.google.com/p/sympy/issues/detail?id=2132 So, SymPy doesn't know that RootSum is commutative. Now it knows. Also RootOf is now commutative. -- You received this message because you are subscribed to the Google Groups

Re: Issue 2132 in sympy: Derivative of RootSum

2011-01-04 Thread sympy
Comment #26 on issue 2132 by asmeurer: Derivative of RootSum http://code.google.com/p/sympy/issues/detail?id=2132 I think the problem, or at least part of the problem, is that it is trying to expand the RootSum into a sum or RootOfs instead of simplifying the rational function Lambda, which

Re: Issue 2132 in sympy: Derivative of RootSum

2011-01-03 Thread sympy
Updates: Labels: -NeedsBetterPatch NeedsReview Comment #12 on issue 2132 by mattpap: Derivative of RootSum http://code.google.com/p/sympy/issues/detail?id=2132 All problems from #10 and #11 were fixed: In [1]: a = S((1-5*x^2)/(x-2*x^3+x^5-1)) In [2]: a Out[2]: ⎛ 2⎞ -⎝1 -

Re: Issue 2132 in sympy: Derivative of RootSum

2011-01-03 Thread sympy
Comment #13 on issue 2132 by asmeurer: Derivative of RootSum http://code.google.com/p/sympy/issues/detail?id=2132 Good idea about just converting RootSum(..., sin) into RootSum(…, Lambda(i, sin(i))). It's good to see that you implemented an unevaluated form of RootSum; I was going to

Re: Issue 2132 in sympy: Derivative of RootSum

2011-01-03 Thread sympy
Comment #14 on issue 2132 by mattpap: Derivative of RootSum http://code.google.com/p/sympy/issues/detail?id=2132 I used 'auto' keyword because RootSum with auto=False isn't unevaluated, it just skips some of its simplification algorithms (this is different from being unevaluated, like e.g.

Re: Issue 2132 in sympy: Derivative of RootSum

2011-01-03 Thread sympy
Comment #15 on issue 2132 by asmeurer: Derivative of RootSum http://code.google.com/p/sympy/issues/detail?id=2132 I used 'auto' keyword because RootSum with auto=False isn't unevaluated That is what I figured. This is fine then. If it hangs on line 645, then this is performance issue.

Re: Issue 2132 in sympy: Derivative of RootSum

2011-01-03 Thread sympy
Comment #17 on issue 2132 by mattpap: Derivative of RootSum http://code.google.com/p/sympy/issues/detail?id=2132 polys12 is available from github.com/mattpap/sympy-polys Known issues: - possible bug in tests runner makes polystools.py fail on 2.4 (too many tests ;) - tests fail in ode

Re: Issue 2132 in sympy: Derivative of RootSum

2011-01-03 Thread sympy
Comment #18 on issue 2132 by asmeurer: Derivative of RootSum http://code.google.com/p/sympy/issues/detail?id=2132 Can you create a pull request and/or separate issue for polys12? -- You received this message because you are subscribed to the Google Groups sympy-issues group. To post to this

Re: Issue 2132 in sympy: Derivative of RootSum

2011-01-03 Thread sympy
Comment #19 on issue 2132 by mattpap: Derivative of RootSum http://code.google.com/p/sympy/issues/detail?id=2132 PolynomialError: non-commutative expressions are not supported Actually this is true: In [1]: RootSum(x**2 + 1, Lambda(x, exp(x))) Out[1]: ⎛ 2 ⎛x⎞⎞ RootSum⎝x +

Re: Issue 2132 in sympy: Derivative of RootSum

2011-01-03 Thread sympy
Comment #21 on issue 2132 by mattpap: Derivative of RootSum http://code.google.com/p/sympy/issues/detail?id=2132 Unless this is trivial to fix, I would put this into a separate issue. -- You received this message because you are subscribed to the Google Groups sympy-issues group. To post to

Re: Issue 2132 in sympy: Derivative of RootSum

2011-01-03 Thread sympy
Comment #22 on issue 2132 by asmeurer: Derivative of RootSum http://code.google.com/p/sympy/issues/detail?id=2132 It's issue 2134. -- You received this message because you are subscribed to the Google Groups sympy-issues group. To post to this group, send email to

Re: Issue 2132 in sympy: Derivative of RootSum

2011-01-03 Thread sympy
Comment #23 on issue 2132 by mattpap: Derivative of RootSum http://code.google.com/p/sympy/issues/detail?id=2132 And polys12 is issue 2133. -- You received this message because you are subscribed to the Google Groups sympy-issues group. To post to this group, send email to

Re: Issue 2132 in sympy: Derivative of RootSum

2011-01-02 Thread sympy
Updates: Owner: mattpap Cc: -mattpap Labels: Milestone-Release0.7.0 Comment #8 on issue 2132 by mattpap: Derivative of RootSum http://code.google.com/p/sympy/issues/detail?id=2132 viete() function was added in 8f8e6a786b0d0e15a65b01a68367532a0cac55b7 to polys11, e.g.:

Re: Issue 2132 in sympy: Derivative of RootSum

2011-01-02 Thread sympy
Updates: Labels: NeedsReview Comment #9 on issue 2132 by mattpap: Derivative of RootSum http://code.google.com/p/sympy/issues/detail?id=2132 In 74cd9297f0df1df6bbdeaf12616d62dd71141a0f support for auto-simplification of rational functions was added to RootSum, e.g.: In [1]: %time

Re: Issue 2132 in sympy: Derivative of RootSum

2011-01-02 Thread sympy
Updates: Labels: -NeedsReview NeedsBetterPatch mattpap Comment #10 on issue 2132 by asmeurer: Derivative of RootSum http://code.google.com/p/sympy/issues/detail?id=2132 There is a bug: In [11]: a = S((1-5*x^2)/(x-2*x^3+x^5-1)) In [12]: a Out[12]: ⎛ 2⎞ -⎝1 - 5⋅x ⎠

Re: Issue 2132 in sympy: Derivative of RootSum

2011-01-02 Thread sympy
Comment #11 on issue 2132 by asmeurer: Derivative of RootSum http://code.google.com/p/sympy/issues/detail?id=2132 I just noticed, don't you have x and z backwards in that example (c.f. the output from integrate in [29] in my OP)? It should be RootSum(z**5 - z**2 + 1, Lambda(z, z*log(x -

Issue 2132 in sympy: Derivative of RootSum

2011-01-01 Thread sympy
Status: Accepted Owner: asmeurer CC: mattpap Labels: Type-Defect Priority-Medium Integration Polynomial New issue 2132 by asmeurer: Derivative of RootSum http://code.google.com/p/sympy/issues/detail?id=2132 diff does not work at all with RootSum. This makes it impossible to reverse

Re: Issue 2132 in sympy: Derivative of RootSum

2011-01-01 Thread sympy
Comment #1 on issue 2132 by asmeurer: Derivative of RootSum http://code.google.com/p/sympy/issues/detail?id=2132 There is also a bug with diff and Lambda: In [31]: Lambda(z, z*log(x - z)).diff(x) --- TypeError

Re: Issue 2132 in sympy: Derivative of RootSum

2011-01-01 Thread sympy
Comment #2 on issue 2132 by mattpap: Derivative of RootSum http://code.google.com/p/sympy/issues/detail?id=2132 In this particular case, this is an application of Viete formulas. Take an expression: In [6]: var('r1:6') Out[6]: (r₁, r₂, r₃, r₄, r₅) In [7]: R = _ In [8]: sum(r/(x - r) for r

Re: Issue 2132 in sympy: Derivative of RootSum

2011-01-01 Thread sympy
Comment #3 on issue 2132 by asmeurer: Derivative of RootSum http://code.google.com/p/sympy/issues/detail?id=2132 Excellent! Thanks for the information. So I guess what we need to do is: 1. Implement the Viete formulas in the polys somewhere. 2. Put in a check somewhere in RootSum to see it

Re: Issue 2132 in sympy: Derivative of RootSum

2011-01-01 Thread sympy
Updates: Status: Started Comment #4 on issue 2132 by mattpap: Derivative of RootSum http://code.google.com/p/sympy/issues/detail?id=2132 1. I started implementing this. 3. I'm aware of the fact that the lambda can be an arbitrary expression. The example you gave can be done by

Re: Issue 2132 in sympy: Derivative of RootSum

2011-01-01 Thread sympy
Comment #5 on issue 2132 by asmeurer: Derivative of RootSum http://code.google.com/p/sympy/issues/detail?id=2132 After a bit more research, I think it can be done. See http://en.wikipedia.org/wiki/Newton_identities. -- You received this message because you are subscribed to the Google

Re: Issue 2132 in sympy: Derivative of RootSum

2011-01-01 Thread sympy
Comment #7 on issue 2132 by asmeurer: Derivative of RootSum http://code.google.com/p/sympy/issues/detail?id=2132 Ah, yes, I forgot about that function. Of course, it should be symmetric, because to be symmetric just means that we can reorder the r_i any way we like and still get the same