(eq, func=None, **kwargs)
return matching_hints
r"""
    Returns a list of parameters defining the system of ordinary differential equations
    in form of dictionary. The dictionary returned is further used in
    :py:meth:`~sympy.solvers.ode.dsolve` for solving system of ODEs.

    It returns seven parameters, first parameter is 'is_linear' which tells
    whether given equation is linear or Non-linear based on the coefficients
    of the functions of equations, i.e, coefficients of x, diff(x,t), diff(x,t,t) etc
    which itself is a parameter named 'func_coeff'.
    If the coefficient is constant, then the equation is said to be linear and 'is_linear'
    returns True otherwise 'is_linear' returns False.
    Second parameter is order of equation, it provides information about order
    of differential equations provided. The third parameters is the number of equation
    in the system.
    The forth parameter is 'func_coeff' which has list of coefficient of all function and its
    differentials. Each is described by three elements, first is equation number,
    second is function and third is order of function whose coefficients we are calculating.
    The other two parameters are the equations of ODEs and its functions.
    The other parameter which tells whether given system of ODEs are solvable by current
    solving engine. If it returns a type the it is solvable and result can be obtained
    using dsolve otherwise None is returned.

    The type returned is just a number assigned to set of each equation classified under
    common characteristics based on linearity, number of equation and order. Similarly
    there are different sets based on above parameters. The type number sequence implemented
    is same as is given references.

    References
    ==========
    -http://eqworld.ipmnet.ru/en/solutions/sysode/sode-toc1.htm
    -A. D. Polyanin and A. V. Manzhirov, Handbook of Mathematics for Engineers and Scientists

    Examples
    ========

    >>> from sympy import Function, Eq, symbols, diff
    >>> from sympy.solvers.ode import classify_sysode
    >>> from sympy.abc import t
    >>> f, x, y = symbols('f, x, y', function=True)
    >>> k, l, m, n = symbols('k, l, m, n', Integer=True)
    >>> x1 = diff(x(t), t) ; y1 = diff(y(t), t)
    >>> x2 = diff(x(t), t, t) ; y2 = diff(y(t), t, t)
    >>> eq = (Eq(5*x1, 12*x(t) - 6*y(t)), Eq(2*y1, 11*x(t) + 3*y(t)))
    >>> classify_sysode(eq)
    {'eq': [-12*x(t) + 6*y(t) + 5*Derivative(x(t), t), -11*x(t) - 3*y(t) + 2*Derivative(y(t), t)],
    'func': [x(t), y(t)], 'func_coeff': {(0, x(t), 0): -12, (0, x(t), 1): 5, (0, y(t), 0): 6,
    (0, y(t), 1): 0, (1, x(t), 0): -11, (1, x(t), 1): 0, (1, y(t), 0): -3, (1, y(t), 1): 2},
    'is_linear': 'True', 'no_of_equation': 2, 'order': [1, 1], 'type_of_equation': 'type1'}
    >>> eq = (Eq(diff(x(t),t), 5*t*x(t) + t**2*y(t)), Eq(diff(y(t),t), -t**2*x(t) + 5*t*y(t)))
    >>> classify_sysode(eq)
    {'eq': [-t**2*y(t) - 5*t*x(t) + Derivative(x(t), t), t**2*x(t) - 5*t*y(t) + Derivative(y(t), t)],
    'func': [x(t), y(t)], 'func_coeff': {(0, x(t), 0): -5*t, (0, x(t), 1): 1, (0, y(t), 0): -t**2,
    (0, y(t), 1): 0, (1, x(t), 0): t**2, (1, x(t), 1): 0, (1, y(t), 0): -5*t, (1, y(t), 1): 1},
    'is_linear': 'True', 'no_of_equation': 2, 'order': [1, 1], 'type_of_equation': 'type4'}
r"""
    Returns a list of parameters defining the system of ordinary differential equations
    in form of dictionary. The dictionary returned is further used in
    :py:meth:`~sympy.solvers.ode.dsolve` for solving system of ODEs.
r Returns a list of parameters defining the system of ordinary differential equations in form of dictionary . The dictionary returned is further used in : py : meth : ~sympy . solvers . ode . dsolve for solving system of ODEs .
def classify_sysode(eq, func=None, **kwargs):
    r"""
    Returns a list of parameters defining the system of ordinary differential equations
    in form of dictionary. The dictionary returned is further used in
    :py:meth:`~sympy.solvers.ode.dsolve` for solving system of ODEs.

    It returns seven parameters, first parameter is 'is_linear' which tells
    whether given equation is linear or Non-linear based on the coefficients
    of the functions of equations, i.e, coefficients of x, diff(x,t), diff(x,t,t) etc
    which itself is a parameter named 'func_coeff'.
    If the coefficient is constant, then the equation is said to be linear and 'is_linear'
    returns True otherwise 'is_linear' returns False.
    Second parameter is order of equation, it provides information about order
    of differential equations provided. The third parameters is the number of equation
    in the system.
    The forth parameter is 'func_coeff' which has list of coefficient of all function and its
    differentials. Each is described by three elements, first is equation number,
    second is function and third is order of function whose coefficients we are calculating.
    The other two parameters are the equations of ODEs and its functions.
    The other parameter which tells whether given system of ODEs are solvable by current
    solving engine. If it returns a type the it is solvable and result can be obtained
    using dsolve otherwise None is returned.

    The type returned is just a number assigned to set of each equation classified under
    common characteristics based on linearity, number of equation and order. Similarly
    there are different sets based on above parameters. The type number sequence implemented
    is same as is given references.

    References
    ==========
    -http://eqworld.ipmnet.ru/en/solutions/sysode/sode-toc1.htm
    -A. D. Polyanin and A. V. Manzhirov, Handbook of Mathematics for Engineers and Scientists

    Examples
    ========

    >>> from sympy import Function, Eq, symbols, diff
    >>> from sympy.solvers.ode import classify_sysode
    >>> from sympy.abc import t
    >>> f, x, y = symbols('f, x, y', function=True)
    >>> k, l, m, n = symbols('k, l, m, n', Integer=True)
    >>> x1 = diff(x(t), t) ; y1 = diff(y(t), t)
    >>> x2 = diff(x(t), t, t) ; y2 = diff(y(t), t, t)
    >>> eq = (Eq(5*x1, 12*x(t) - 6*y(t)), Eq(2*y1, 11*x(t) + 3*y(t)))
    >>> classify_sysode(eq)
    {'eq': [-12*x(t) + 6*y(t) + 5*Derivative(x(t), t), -11*x(t) - 3*y(t) + 2*Derivative(y(t), t)],
    'func': [x(t), y(t)], 'func_coeff': {(0, x(t), 0): -12, (0, x(t), 1): 5, (0, y(t), 0): 6,
    (0, y(t), 1): 0, (1, x(t), 0): -11, (1, x(t), 1): 0, (1, y(t), 0): -3, (1, y(t), 1): 2},
    'is_linear': 'True', 'no_of_equation': 2, 'order': [1, 1], 'type_of_equation': 'type1'}
    >>> eq = (Eq(diff(x(t),t), 5*t*x(t) + t**2*y(t)), Eq(diff(y(t),t), -t**2*x(t) + 5*t*y(t)))
    >>> classify_sysode(eq)
    {'eq': [-t**2*y(t) - 5*t*x(t) + Derivative(x(t), t), t**2*x(t) - 5*t*y(t) + Derivative(y(t), t)],
    'func': [x(t), y(t)], 'func_coeff': {(0, x(t), 0): -5*t, (0, x(t), 1): 1, (0, y(t), 0): -t**2,
    (0, y(t), 1): 0, (1, x(t), 0): t**2, (1, x(t), 1): 0, (1, y(t), 0): -5*t, (1, y(t), 1): 1},
    'is_linear': 'True', 'no_of_equation': 2, 'order': [1, 1], 'type_of_equation': 'type4'}

    """

    # Sympify equations and convert iterables of equations into
    # a list of equations
    def _sympify(eq):
        return list(map(sympify, eq if iterable(eq) else [eq]))

    eq, func = (_sympify(w) for w in [eq, func])
    for i, fi in enumerate(eq):
        if isinstance(fi, Equality):
            eq[i] = fi.lhs - fi.rhs
    matching_hints = {"no_of_equation":i+1}
    matching_hints['eq'] = eq
    if i==0:
        raise ValueError("classify_sysode() woks for systems of ODEs. For"
        " single ODE equation solving classify_ode should be used")

    t = list(list(eq[0].atoms(Derivative))[0].atoms(Symbol))[0]

    # find all the functions if not given
    if func==[None]:
        func = []
        for j in range(i+1):
            derivs = eq[j].atoms(Derivative)
            funcs = set.union(*[d.atoms(AppliedUndef) for d in derivs])
            max_order = 0
            for fun in funcs:
                order_ = ode_order(eq[j], fun)
                if order_ > max_order or (order_ == max_order and eq[j].coeff(diff(fun, t, order_))!=0):
                    max_order = order_
                    func_ = fun
            func.append(func_)
    if len(func) < i+1 and (func != [None]):
        raise ValueError("Number of function given is less than number of equations %s" % func)

    matching_hints['func'] = func
    for j in range(i+1):
        if func[j] and len(func[j].args)!=1:
            raise ValueError("dsolve() and classify_sysode() work with"
            "functions of one variable only, not %s" % func[j])

    # find the order of all equation in system of odes
    order = []
    for j in range(i+1):
        order.append(ode_order(eq[j], func[j]))
    matching_hints["order"] = order

    # find coefficients of terms f(t), diff(f(t),t) and higher derivatives
    # and similarly for other functions g(t), diff(g(t),t) in all equations.
    # Here j denotes the equation number, func[l] denotes the function about
    # which we are taking about and k denotes the order of function func[l]
    # whose coefficient we are calculating.
    df = {}
    func_coef = {}
    is_nonlinear = 0
    for j in range(i+1):
        for k in range(order[0]+1):
            df[k,j] = diff(func[j], t, k)

    # keep highest order term coefficient positive
    for j in range(i+1):
        if eq[j].coeff(df[order[j],j]).is_negative:
            eq[j] = -eq[j]

    for j in range(i+1):
        for l in range(i+1):
            for k in range(order[0]+1):
                func_coef[j,func[l],k] = collect(eq[j].expand(),[df[k,l]]).coeff(df[k,l])
                if is_nonlinear == 0:
                    if func_coef[j,func[l],k]==0:
                        if k==0:
                            coef = eq[j].as_independent(func[l])[1]
                            for xr in xrange(1, ode_order(eq[j],func[l])+1):
                                coef -= eq[j].as_independent(diff(func[l],t,xr))[1]
                            if coef != 0:
                                is_nonlinear = 1
                        else:
                            if eq[j].as_independent(df[k,l])[1]:
                                is_nonlinear = 1
                    else:
                        for m in range(i+1):
                            dep = func_coef[j,func[l],k].as_independent(df[0,m])[1]
                            if dep!=1 and dep!=0:
                                is_nonlinear = 1

    matching_hints['func_coeff'] = func_coef

    if not is_nonlinear:
        matching_hints['is_linear'] = 'True'
    else:
        matching_hints['is_linear'] = 'False'

    if order.count(order[0]) == len(order):
        order_eq = matching_hints['order'][0]
        if matching_hints['is_linear'] == 'True':
            if matching_hints['no_of_equation'] == 2:
                if order_eq == 1:
                    type_of_equation = check_linear_2eq_order1(eq, func, func_coef)
                elif order_eq == 2:
                    type_of_equation = check_linear_2eq_order2(eq, func, func_coef)
                else:
                    type_of_equation = None

            elif matching_hints['no_of_equation'] == 3:
                if order_eq == 1:
                    type_of_equation = check_linear_3eq_order1(eq, func, func_coef)
                else:
                    type_of_equation = None
            else:
                if order_eq == 1:
                    type_of_equation = check_linear_neq_order1(eq, func, func_coef)
                else:
                    type_of_equation = None
        else:
            if matching_hints['no_of_equation'] == 2:
                if order_eq == 1:
                    type_of_equation = check_nonlinear_2eq_order1(eq, func, func_coef)
                if order_eq == 2:
                    type_of_equation = check_nonlinear_2eq_order2(eq, func, func_coef)
                else:
                    type_of_equation = None
            elif matching_hints['no_of_equation'] == 3:
                if order_eq == 1:
                    type_of_equation = check_nonlinear_3eq_order1(eq, func, func_coef)
                elif order_eq == 2:
                    type_of_equation = check_nonlinear_3eq_order2(eq, func, func_coef)
                else:
                    type_of_equation = None
            else:
                type_of_equation = None
    else:
        type_of_equation = None

    matching_hints['type_of_equation'] = type_of_equation

    return matching_hints
def classify_sysode ( eq , func = None , * * kwargs ) : # Sympify equations and convert iterables of equations into # a list of equations def _sympify ( eq ) : return list ( map ( sympify , eq if iterable ( eq ) else [ eq ] ) ) eq , func = ( _sympify ( w ) for w in [ eq , func ] ) for i , fi in enumerate ( eq ) : if isinstance ( fi , Equality ) : eq [ i ] = fi . lhs - fi . rhs matching_hints = { "no_of_equation" : i + 1 } matching_hints [ 'eq' ] = eq if i == 0 : raise ValueError ( "classify_sysode() woks for systems of ODEs. For" " single ODE equation solving classify_ode should be used" ) t = list ( list ( eq [ 0 ] . atoms ( Derivative ) ) [ 0 ] . atoms ( Symbol ) ) [ 0 ] # find all the functions if not given if func == [ None ] : func = [ ] for j in range ( i + 1 ) : derivs = eq [ j ] . atoms ( Derivative ) funcs = set . union ( * [ d . atoms ( AppliedUndef ) for d in derivs ] ) max_order = 0 for fun in funcs : order_ = ode_order ( eq [ j ] , fun ) if order_ > max_order or ( order_ == max_order and eq [ j ] . coeff ( diff ( fun , t , order_ ) ) != 0 ) : max_order = order_ func_ = fun func . append ( func_ ) if len ( func ) < i + 1 and ( func != [ None ] ) : raise ValueError ( "Number of function given is less than number of equations %s" % func ) matching_hints [ 'func' ] = func for j in range ( i + 1 ) : if func [ j ] and len ( func [ j ] . args ) != 1 : raise ValueError ( "dsolve() and classify_sysode() work with" "functions of one variable only, not %s" % func [ j ] ) # find the order of all equation in system of odes order = [ ] for j in range ( i + 1 ) : order . append ( ode_order ( eq [ j ] , func [ j ] ) ) matching_hints [ "order" ] = order # find coefficients of terms f(t), diff(f(t),t) and higher derivatives # and similarly for other functions g(t), diff(g(t),t) in all equations. # Here j denotes the equation number, func[l] denotes the function about # which we are taking about and k denotes the order of function func[l] # whose coefficient we are calculating. df = { } func_coef = { } is_nonlinear = 0 for j in range ( i + 1 ) : for k in range ( order [ 0 ] + 1 ) : df [ k , j ] = diff ( func [ j ] , t , k ) # keep highest order term coefficient positive for j in range ( i + 1 ) : if eq [ j ] . coeff ( df [ order [ j ] , j ] ) . is_negative : eq [ j ] = - eq [ j ] for j in range ( i + 1 ) : for l in range ( i + 1 ) : for k in range ( order [ 0 ] + 1 ) : func_coef [ j , func [ l ] , k ] = collect ( eq [ j ] . expand ( ) , [ df [ k , l ] ] ) . coeff ( df [ k , l ] ) if is_nonlinear == 0 : if func_coef [ j , func [ l ] , k ] == 0 : if k == 0 : coef = eq [ j ] . as_independent ( func [ l ] ) [ 1 ] for xr in xrange ( 1 , ode_order ( eq [ j ] , func [ l ] ) + 1 ) : coef -= eq [ j ] . as_independent ( diff ( func [ l ] , t , xr ) ) [ 1 ] if coef != 0 : is_nonlinear = 1 else : if eq [ j ] . as_independent ( df [ k , l ] ) [ 1 ] : is_nonlinear = 1 else : for m in range ( i + 1 ) : dep = func_coef [ j , func [ l ] , k ] . as_independent ( df [ 0 , m ] ) [ 1 ] if dep != 1 and dep != 0 : is_nonlinear = 1 matching_hints [ 'func_coeff' ] = func_coef if not is_nonlinear : matching_hints [ 'is_linear' ] = 'True' else : matching_hints [ 'is_linear' ] = 'False' if order . count ( order [ 0 ] ) == len ( order ) : order_eq = matching_hints [ 'order' ] [ 0 ] if matching_hints [ 'is_linear' ] == 'True' : if matching_hints [ 'no_of_equation' ] == 2 : if order_eq == 1 : type_of_equation = check_linear_2eq_order1 ( eq , func , func_coef ) elif order_eq == 2 : type_of_equation = check_linear_2eq_order2 ( eq , func , func_coef ) else : type_of_equation = None elif matching_hints [ 'no_of_equation' ] == 3 : if order_eq == 1 : type_of_equation = check_linear_3eq_order1 ( eq , func , func_coef ) else : type_of_equation = None else : if order_eq == 1 : type_of_equation = check_linear_neq_order1 ( eq , func , func_coef ) else : type_of_equation = None else : if matching_hints [ 'no_of_equation' ] == 2 : if order_eq == 1 : type_of_equation = check_nonlinear_2eq_order1 ( eq , func , func_coef ) if order_eq == 2 : type_of_equation = check_nonlinear_2eq_order2 ( eq , func , func_coef ) else : type_of_equation = None elif matching_hints [ 'no_of_equation' ] == 3 : if order_eq == 1 : type_of_equation = check_nonlinear_3eq_order1 ( eq , func , func_coef ) elif order_eq == 2 : type_of_equation = check_nonlinear_3eq_order2 ( eq , func , func_coef ) else : type_of_equation = None else : type_of_equation = None else : type_of_equation = None matching_hints [ 'type_of_equation' ] = type_of_equation return matching_hints