Created
May 26, 2011 20:58
-
-
Save asmeurer/994066 to your computer and use it in GitHub Desktop.
gsoc diff
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/sympy/polys/polytools.py b/sympy/polys/polytools.py | |
index cb94fb9..588a1b3 100644 | |
--- a/sympy/polys/polytools.py | |
+++ b/sympy/polys/polytools.py | |
@@ -5103,7 +5103,7 @@ def groebner(F, *gens, **args): | |
else: | |
return G | |
-def poly(expr, **args): | |
+def poly(expr, *gens, **args): | |
""" | |
Efficiently transform an expression into a polynomial. | |
@@ -5153,7 +5153,7 @@ def poly(expr, **args): | |
poly_terms.append(product) | |
if not poly_terms: | |
- result = Poly(expr, expand=False) | |
+ result = Poly(expr, *gens, **{'expand':False}) | |
else: | |
result = poly_terms[0] | |
diff --git a/sympy/simplify/hyperexpand.py b/sympy/simplify/hyperexpand.py | |
index e2d1743..91658ad 100644 | |
--- a/sympy/simplify/hyperexpand.py | |
+++ b/sympy/simplify/hyperexpand.py | |
@@ -118,7 +118,7 @@ def addb(ap, bq, B, C, M): | |
add([], [a, a + S.Half, 2*a], | |
(2*sqrt(-z))**(1-2*a)*gamma(2*a)**2 * besselj(2*a-1, x)*besseli(2*a-1, x)) | |
- # 1F2 | |
+ # 1F2 | |
addb([a], [a - S.Half, 2*a], | |
Matrix([z**(S.Half - a)*besseli(a-S.Half, sqrt(z))**2, | |
z**(1-a)*besseli(a-S.Half, sqrt(z)) | |
@@ -598,7 +598,7 @@ def lookup_origin(self, ip): | |
# find the nearest origin | |
possible.sort(key=lambda x:x[0]) | |
- return possible[0][1] | |
+ return possible[0][1] | |
class Operator(object): | |
@@ -907,8 +907,23 @@ def make_derivative_operator(M, z): | |
""" Create a derivative operator, to be passed to Operator.apply. """ | |
def doit(C): | |
r = z*C.diff(z) + C*M | |
+ from sympy import pprint | |
+ pprint(r) | |
r.simplify() # this is probably a good idea | |
return r | |
+ def doit(C): | |
+ r = z*C.diff(z) + C*M | |
+ def simp(expr): | |
+ from sympy import poly | |
+ #return simplify(expr) | |
+ #return cancel(together(expr), z) | |
+ numer, denom = expr.as_numer_denom() | |
+ c, numer, denom = poly(numer, z).cancel(poly(denom, z)) | |
+ return c * numer.as_expr() / denom.as_expr() | |
+ r = r.applyfunc(simp) | |
+ #r.simplify() # this is probably a good idea | |
+ return r | |
+ return doit | |
return doit | |
def apply_operators(obj, ops, op): |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment