rk4odes/rk4.py
def str2def(eqn):
    """
    Make function <string> to <def> for format in RK4 iterations.

    Example
    -------
    >>> fcn = '2 * t - 3 * y + 1'
    >>> fcn = str2def(fcn)
    >>> type(fcn)
    function
    >>>
    """

    if type(eqn) is not str:
        raise ValueError('Input must be string' )

    def f(t, y):
        """
        To evaluate equation with varibles (t, y).
        """

        chk = list(eqn)
        for idx in range(len(chk)):
            if chk[idx] == 't':
                chk[idx] = '% s' % t

            elif chk[idx] == 'y':
                chk[idx] = '% s' % y

        return numexpr.evaluate(''.join([w for w in chk]))

    return f

    Make function <string> to <def> for format in RK4 iterations.

    Example
    -------
    >>> fcn = '2 * t - 3 * y + 1'
    >>> fcn = str2def(fcn)
    >>> type(fcn)
    function
    >>>
    
Make function  to  for format in RK4 iterations.
Example


Make function to for format in RK4 iterations . Example
def str2def(eqn):
    if type(eqn) is not str:
        raise ValueError('Input must be string' )
    def f(t, y):
        chk = list(eqn)
        for idx in range(len(chk)):
            if chk[idx] == 't':
                chk[idx] = '% s' % t
            elif chk[idx] == 'y':
                chk[idx] = '% s' % y
        return numexpr.evaluate(''.join([w for w in chk]))
    return f
def str2def ( eqn ) : if type ( eqn ) is not str : raise ValueError ( 'Input must be string' ) def f ( t , y ) : """
        To evaluate equation with varibles (t, y).
        """ chk = list ( eqn ) for idx in range ( len ( chk ) ) : if chk [ idx ] == 't' : chk [ idx ] = '% s' % t elif chk [ idx ] == 'y' : chk [ idx ] = '% s' % y return numexpr . evaluate ( '' . join ( [ w for w in chk ] ) ) return f
Make function <string> to <def> for format in RK4 iterations.
Make function <string > to <def > for format in RK4 iterations .
"""
    Make function <string> to <def> for format in RK4 iterations.

    Example
    -------
    >>> fcn = '2 * t - 3 * y + 1'
    >>> fcn = str2def(fcn)
    >>> type(fcn)
    function
    >>>
    """ """
        To evaluate equation with varibles (t, y).
        """
eqn