The match function is the most important part of dsolve. It relies on it heavily to determine what type an ODE is to see if it can solve it and if so how. Unfortunately, it currently has some issues:
1) Issue 1429 (http://code.google.com/p/sympy/issues/detail? id=1429&q=match). The following returns None: >>> a = Wild('a', exclude=[f(x).diff(x)]) >>> b = Wild('b', exclude=[f(x).diff(x)]) >>> eq = x+f(x) - (x - f(x))*diff(f(x), x) >>> r = eq.match(a+b*diff(f(x),x)) I want this to return {a:x + f(x), b:-x + f(x)}. See the issue page for more. 2) For separable equations (what I plan on working on next), I need to be able to separate a function f(x,y) into p(x)*q(y) if it is possible. If I use the following: >>> # I have replaced f(x) with y so that it will work with exclude=[x], and I >>> leave f(x).diff(x) alone >>> a = Wild('a', exclude=[f(x).diff(x),x]) >>> c = Wild('c', exclude=[f(x).diff(x),x]) >>> b = Wild('b', exclude=[f(x).diff(x), y]) >>> d = Wild('d', exclude=[f(x).diff(x), y]) >>> me = c*d + a*b*diff(f(x), x) >>> e1 = (x**2*y - 2*x**2)*diff(f(x), x) - x*y**3 >>> e2 = x**2*(y - 2)*diff(f(x), x) - x*y**3 >>> print e1.match(me) None >>> print e2.match(me) {c_: y**3, b_: -x**2, a_: 2 - y, d_: -x} e2 is the same as e1, except that the x**2 has been factored out. This sort of thing also causes dsolve to fail with an equation p(x,f (x)) + q(x,f(x))*f(x).diff(x) that it can handle when it is written as p(x,f(x)) + q1(x,f(x))*f(x).diff(x) + q2(x,f(x))*f(x).diff(x), where q1 + q2 == q. match cannot factor out the f(x).diff(x). 3) There are also more advanced ways to split a function into x and y parts. Consider the following two expressions, both for which the variables can be separated: exp(x+y) 1 + x + y + x⋅y factor can handle the second one because it is a polynomial (it equals (x+1)*(y+1)) I couldn't find any existing function that would split the first one into exp(x)*exp(y)) So my questions are, are these already implemented somewhere and I am just missing it? And if not, should they all go in match, or somewhere else (e.g., in factor, which must be called before match for it to work)? Also some guidance on match would be nice too, since I have now idea how it works. :) Aaron Meurer --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "sympy" group. To post to this group, send email to sympy@googlegroups.com To unsubscribe from this group, send email to sympy+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sympy?hl=en -~----------~----~----~----~------~----~------~--~---