details:   http://hg.sympy.org/sympy/rev/d66dc8f1f107
changeset: 1849:d66dc8f1f107
user:      Fabian Seoane <[EMAIL PROTECTED]>
date:      Fri Oct 24 19:09:04 2008 +0200
description:
Make the constructor of Derivative treat correctly instances of Derivative.
 It now collapses nested instances, so that Derivate(Derivative(f, x), x) -> 
Derivative(f, x, x).
Two XFAIL test now pass. This also fixes #979 and #1124.
---
 sympy/core/function.py                |    2 +-
 sympy/core/tests/test_basic.py        |    1 -
 sympy/core/tests/test_functions.py    |    3 +++
 sympy/simplify/tests/test_simplify.py |    1 -
 4 files changed, 4 insertions(+), 3 deletions(-)

diffs (47 lines):

diff -r 3a9219d09389 -r d66dc8f1f107 sympy/core/function.py
--- a/sympy/core/function.py    Mon Oct 20 17:19:52 2008 +0200
+++ b/sympy/core/function.py    Fri Oct 24 19:09:04 2008 +0200
@@ -461,7 +461,7 @@
         expr = sympify(expr)
         if not symbols: return expr
         symbols = Derivative._symbolgen(*symbols)
-        if not assumptions.get("evaluate", False):
+        if not assumptions.get("evaluate", False) and not isinstance(expr, 
Derivative):
             obj = Basic.__new__(cls, expr, *symbols)
             return obj
         unevaluated_symbols = []
diff -r 3a9219d09389 -r d66dc8f1f107 sympy/core/tests/test_basic.py
--- a/sympy/core/tests/test_basic.py    Mon Oct 20 17:19:52 2008 +0200
+++ b/sympy/core/tests/test_basic.py    Fri Oct 24 19:09:04 2008 +0200
@@ -587,7 +587,6 @@
     g = 1/r**2 * (2*r*psi(r).diff(r, 1) + r**2 * psi(r).diff(r, 2))
     assert g.coeff(psi(r).diff(r)) == 2/r
 
[EMAIL PROTECTED]
 def test_coeff2_0():
     var('r, kappa')
     psi = Function("psi")
diff -r 3a9219d09389 -r d66dc8f1f107 sympy/core/tests/test_functions.py
--- a/sympy/core/tests/test_functions.py        Mon Oct 20 17:19:52 2008 +0200
+++ b/sympy/core/tests/test_functions.py        Fri Oct 24 19:09:04 2008 +0200
@@ -141,6 +141,9 @@
 
     assert Derivative(sin(x), x) != diff(sin(x), x)
     assert Derivative(sin(x), x).doit() == diff(sin(x), x)
+
+    f = Function('f')
+    assert Derivative(Derivative(f(x), x), x) == diff(f(x), x, x)
 
 @XFAIL
 def test_combine():
diff -r 3a9219d09389 -r d66dc8f1f107 sympy/simplify/tests/test_simplify.py
--- a/sympy/simplify/tests/test_simplify.py     Mon Oct 20 17:19:52 2008 +0200
+++ b/sympy/simplify/tests/test_simplify.py     Fri Oct 24 19:09:04 2008 +0200
@@ -216,7 +216,6 @@
     assert collect(a*D(fx,x) + b*D(fx,x), fx)   == (a + b)*D(fx, x)
     assert collect(a*fxx     + b*fxx    , fx)   == (a + b)*D(fx, x)
 
[EMAIL PROTECTED]
 def test_collect_D_0():
     D = Derivative
     f = Function('f')

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"sympy-commits" group.
To post to this group, send email to sympy-commits@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sympy-commits?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to