Comment #9 on issue 3148 by [email protected]: Too many constants from
dsolve()
http://code.google.com/p/sympy/issues/detail?id=3148
It just occurred to me that if you have too many constants, you can solve
for the excess ones in terms and substitute them out. e.g. in PR 1964 this
test is failing because it gives too many constants:
sol = Eq(f(x), C1/(x**2 + 6*x + 9) - S(3)/2)
eq = df + (3 + 2*f(x))/(x + 3)
dsolve(eq, hint='linear_coefficients')
f(x) == (C1 + C2*x - 3*x**3/2 - 27*x**2/2)/(x**3 + 9*x**2 + 27*x + 27)
eq.subs(f(x),_.rhs).doit()
(C2 - 9*x**2/2 - 27*x)/(x**3 + 9*x**2 + 27*x + 27) + (-3*x**2 - 18*x -
27)*(C1 +
C2*x - 3*x**3/2 - 27*x**2/2)/(x**3 + 9*x**2 + 27*x + 27)**2 + (2*(C1 +
C2*x - 3
*x**3/2 - 27*x**2/2)/(x**3 + 9*x**2 + 27*x + 27) + 3)/(x + 3)
We can get rid of C2 since we know that the above should be zero:
solve(_,C2)
[C1/3 - 27]
eq.subs(f(x),sol.rhs).doit().subs(C2,_[0])
C1*(-2*x - 6)/(x**2 + 6*x + 9)**2 + 2*C1/((x + 3)*(x**2 + 6*x + 9))
factor(_)
0
Is that something that constantsimp should be doing? Since C2 is
multiplying x it's not a simple issue that constants didn't combine that
should have (e.g. C1 + C2/2 should combine to C1 but in this case there is
an x on C2).
--
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 [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sympy-issues?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.