Hi. I am planning on applying to work with sympy for the Google Summer of Code 2009 (see here: http://groups.google.com/group/sympy/browse_thread/thread/bfccfe3e4ce60c34/bb3093a30ea1d168#bb3093a30ea1d168)
Anyway, Ondrej has requested that I post my patch here, so here it is: --- sympy/solvers/solvers.py | 6 ++---- sympy/solvers/tests/test_solvers.py | 1 + 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/sympy/solvers/solvers.py b/sympy/solvers/solvers.py index 6a19372..60a1ef5 100644 --- a/sympy/solvers/solvers.py +++ b/sympy/solvers/solvers.py @@ -579,17 +579,15 @@ def solve_ODE_first_order(eq, f): t = C.exp(integrate(r[b]/r[a], x)) tt = integrate(t*(-r[c]/r[a]), x) return (tt + Symbol("C1"))/t - + #Bernoulli case: a(x)*f'(x)+b(x)*f(x)+c(x)*f(x)^n = 0 n = Wild('n', exclude=[f(x)]) - + r = eq.match(a*diff(f(x),x) + b*f(x) + c*f(x)**n) if r: t = C.exp((1-r[n])*integrate(r[b]/r[a],x)) tt = (r[n]-1)*integrate(t*r[c]/r[a],x) return ((tt + Symbol("C1"))/t)**(1/(1-r[n])) - - #other cases of first order odes will be implemented here diff --git a/sympy/solvers/tests/test_solvers.py b/sympy/solvers/tests/ test_solvers.py index f1e43a0..389b661 100644 --- a/sympy/solvers/tests/test_solvers.py +++ b/sympy/solvers/tests/test_solvers.py @@ -142,6 +142,7 @@ def test_ODE_first_order(): x = Symbol('x') assert dsolve(3*f(x).diff(x) -1, f(x)) == x/3 + Symbol("C1") assert dsolve(x*f(x).diff(x) -1, f(x)) == log(x) + Symbol("C1") + assert dsolve(x*f(x).diff(x)+f(x)-f(x)**2,f(x)) == 1/(x*(Symbol ("C1") + 1/x)) def test_ODE_second_order(): f = Function('f') -- 1.6.2 --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "sympy-patches" group. To post to this group, send email to sympy-patches@googlegroups.com To unsubscribe from this group, send email to sympy-patches+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sympy-patches?hl=en -~----------~----~----~----~------~----~------~--~---