Comment #12 on issue 3148 by smi...@gmail.com: Too many constants from dsolve()
http://code.google.com/p/sympy/issues/detail?id=3148

And here's another simpler case where the numbering issue can be seen:

Here is a differential equation

eq
x**2*f(x)**2 + x*Derivative(f(x), x)

The implicit solution is ok

sol = dsolve(eq, hint = 'separable_reduced', simplify=False)
sol
log(x**2*f(x))/2 - log(x**2*f(x) - 2)/2 == C1 + log(x)
checkodesol(eq, sol, order=1, solve_for_func=False)
(True, 0)

If we solve for the solution explicitly, it is ok

fx = solve(sol, f(x), force=True); fx
[2*exp(2*C1)/(x**2*exp(2*C1) - 1)]
checkodesol(eq, fx[0], order=1, solve_for_func=False)
(True, 0)

But the constantsimp'ed form is not valid

constantsimp(fx[0], x, 2)
C1/(C1*x**2 - 1)
checkodesol(eq, _, order=1, solve_for_func=False)
(False, -C1**2*x**2)

If the solution is renumbered after constantsimp it becomes C1/(C2*x**2 - 1) and that solution doesn't check unless the right value of C2 is chosen (C2 = C1/2)

checkodesol(eq, C1/(C2*x**2-1), order=1, solve_for_func=False)
(False, C1*x**2*(C1 - 2*C2))


If exp(2*C1) were simplified to C1 and the 2 not absorbed and the two C1s not renumbered, the solution would have been validated:

checkodesol(eq, 2*C1/(C1*x**2-1), order=1, solve_for_func=False)
(True, 0)


--
You received this message because this project is configured to send all issue notifications to this address.
You may adjust your notification preferences at:
https://code.google.com/hosting/settings

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


Reply via email to