def _toex(other):
    """Converts other to GiNaC::ex.
    """
    if isinstance(other, (float, int)):
        return _g.numeric(other)
    elif isinstance(other, (Symbol, Expr, Matrix, Vector)):
        return other.data
    elif isinstance(other, (_g.basic)):
        return other
    elif isinstance(other, str):
        print "Can not convert a string to symbolic type"
        return _g.numeric(other)
    elif isinstance(other, list):
        return [_toex(x) for x in other]
    def dotest(self,s):
        def t(a,b):
            s(a,b)
            s(b,a)
        a=g.numeric(2)
        b=g.numeric("1.3")
        c=g.symbol("x")
        d=g.symbol("y")
        e=pow(c,d)*d
        f=5
        h=5.5

        t(a,a)
        t(a,b)
        t(a,c)
        t(a,d)
        t(a,e)
        t(a,f)
        t(a,h)

        t(b,b)
        t(b,c)
        t(b,d)
        t(b,e)
        t(b,f)
        t(b,h)

        t(c,c)
        t(c,d)
        t(c,e)
        t(c,f)
        t(c,h)

        t(d,d)
        t(d,e)
        t(d,f)
        t(d,h)

        t(e,e)
        t(e,f)
        t(e,h)

        t(f,f)
        t(f,h)

        t(h,h)
 def __neg__(self):
     neg = _g.numeric('-1')
     return self.__mul__(Expr(neg))
 def __init__(self, data = _g.numeric(0), symbs = None, time = None): 
     self.data = _toex(data)
     self.spatial_symbs = symbs
     self.time = time
     self._string = None
     self._lhs = []