Status: Accepted
Owner: ----
Labels: Type-Defect Priority-Medium Solvers

New issue 3149 by asmeu...@gmail.com: solve() doesn't work when it should
http://code.google.com/p/sympy/issues/detail?id=3149

Consider this example from the docstring of ode.ode_1st_homogeneous_coeff_best:

In [99]: dsolve(2*x*f(x) + (x**2 + f(x)**2)*f(x).diff(x), f(x), hint='1st_homogeneous_coeff_best', simplify=False)
Out[99]:
               ⎛    2    ⎞
               ⎜ 3⋅x     ⎟
            log⎜───── + 1⎟
               ⎜ 2       ⎟
   ⎛f(x)⎞      ⎝f (x)    ⎠
log⎜────⎟ + ────────────── = 0
   ⎝ C₁ ⎠         3

If we remove the simplify flag, it is solved for f(x):

In [100]: dsolve(2*x*f(x) + (x**2 + f(x)**2)*f(x).diff(x), f(x), hint='1st_homogeneous_coeff_best', simplify=True)
Out[100]:
___________________ _______________ ⎢ 2 ╱ _________ 2 ⎛ ___ ⎞ ╱ ______ ⎢ x 3 ╱ ╱ 6 x ⎜1 ╲╱ 3 ⋅ⅈ⎟ 3 ╱ ╱ ⎢f(x) = ─────────────────────── - ╲╱ C₃ + ╲╱ C₄ + x , f(x) = ─────────────────────────────────────── + ⎜─ + ───────⎟⋅╲╱ C₁ + ╲╱ C₂ + ___________________ ___________________ ⎝2 2 ⎠ ⎢ ╱ _________ ⎛ ___ ⎞ ╱ _________ ⎢ 3 ╱ ╱ 6 ⎜ 1 ╲╱ 3 ⋅ⅈ⎟ 3 ╱ ╱ 6 ⎢ ╲╱ C₁ + ╲╱ C₂ + x ⎜- ─ - ───────⎟⋅╲╱ C₃ + ╲╱ C₄ + x ⎣ ⎝ 2 2 ⎠

____ ___________________⎤ ___ 2 ⎛ ___ ⎞ ╱ _________ ⎥ 6 x ⎜1 ╲╱ 3 ⋅ⅈ⎟ 3 ╱ ╱ 6 ⎥ x , f(x) = ─────────────────────────────────────── + ⎜─ - ───────⎟⋅╲╱ C₁ + ╲╱ C₂ + x ⎥ ___________________ ⎝2 2 ⎠ ⎥ ⎛ ___ ⎞ ╱ _________ ⎥ ⎜ 1 ╲╱ 3 ⋅ⅈ⎟ 3 ╱ ╱ 6 ⎥ ⎜- ─ + ───────⎟⋅╲╱ C₃ + ╲╱ C₄ + x ⎥ ⎝ 2 2 ⎠ ⎦

But passing it straight to solve() gives a NotImplementedError:

In [98]: solve(dsolve(2*x*f(x) + (x**2 + f(x)**2)*f(x).diff(x), f(x), hint='1st_homogeneous_coeff_best', simplify=False), f(x))
---------------------------------------------------------------------------
NotImplementedError                       Traceback (most recent call last)
/Users/aaronmeurer/Documents/Python/sympy/sympy/<ipython-input-98-0c201ee96578> in <module>() ----> 1 solve(dsolve(2*x*f(x) + (x**2 + f(x)**2)*f(x).diff(x), f(x), hint='1st_homogeneous_coeff_best', simplify=False), f(x))

/Users/aaronmeurer/Documents/Python/sympy/sympy/sympy/solvers/solvers.pyc in solve(f, *symbols, **flags) 711 ###########################################################################
    712     if bare_f:
--> 713         solution = _solve(f[0], *symbols, **flags)
    714     else:
    715         solution = _solve_system(f, symbols, **flags)

/Users/aaronmeurer/Documents/Python/sympy/sympy/sympy/solvers/solvers.pyc in _solve(f, *symbols, **flags)
   1109     if result is False:
   1110         raise NotImplementedError(msg +
-> 1111         "\nNo algorithms are implemented to solve equation %s" % f)
   1112
   1113     if flags.get('simplify', True):

NotImplementedError: multiple generators [log(1 + 3*x**2/_F0**2), log(_F0/C1)]
No algorithms are implemented to solve equation log(1 + 3*x**2/_F0**2)

So some kind of preprocessing or special casing is happening in dsolve() that should also happen in solve().

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

Reply via email to