Updates:
Summary: (-x).match(a*f(x)**b) fails to give a, b = -x, 0 (was "classify_ode() doesn't catch homogeneous_coeff when y is used")
        Labels: -EasyToFix Matching

Comment #1 on issue 2069 by smichr: (-x).match(a*f(x)**b) fails to give a, b = -x, 0 (was "classify_ode() doesn't catch homogeneous_coeff when y is used")
http://code.google.com/p/sympy/issues/detail?id=2069

Let
  Q be the results from the first expression (with -q0)
  Y be the results from the second expression (with +y)

In t2 I get Q for the first expression (the same as you) but instead of Y for the second I get Y+(Bernoulli, Bernoulli_Integral).

The reason for the difference in t2 (and probably in master) is that match doesn't like the negative term. During the debug session I did the following test which shows that just after evaluating this line:

r = collect(reduced_eq, f(x), exact = True).match(a*df + b*f(x) + c*f(x)**n)

and this is what I got:

[Dbg]>>> y.match(c*f(x)**n)
{n_: 0, c_: _y}
[Dbg]>>> (-y).match(c*f(x)**n)
[Dbg]>>>

whereas the following works

[Dbg]>>> (-y).match(-c*f(x)**n)
{n_: 0, c_: _y}

It's the function that is causing the difference, however, since a single wild will match a negated symbol, and a product of wilds will match a negated symbol but a negated symbol doesn't match against wild*f(x)**wild:

a,b,c=[Wild(w) for w in list('abc')]
x=symbols('x')
f=Function('f')
x.match(a), x.match(a*b), x.match(a*f(x)**c)
({a_: x}, {a_: 1, b_: x}, {c_: 0, a_: x})
x*=-1; x.match(a), x.match(a*b), x.match(a*f(x)**c)
({a_: -x}, {a_: -1, b_: x}, None)
                              \____ there's the problem

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

Reply via email to