def testComplex(self): self.compare( mathics.Complex(mathics.Real('1.0'), mathics.Real('1.0')), sympy.Add(sympy.Float('1.0'), sympy.Float('1.0') * sympy.I)) self.compare(mathics.Complex(mathics.Integer(0), mathics.Integer(1)), sympy.I) self.compare(mathics.Complex(mathics.Integer(-1), mathics.Integer(1)), sympy.Integer(-1) + sympy.I)
def testComplex(self): self.compare( mathics.Complex(mathics.Real("1.0"), mathics.Real("1.0")), sympy.Add(sympy.Float("1.0"), sympy.Float("1.0") * sympy.I), ) self.compare(mathics.Complex(mathics.Integer(0), mathics.Integer(1)), sympy.I) self.compare( mathics.Complex(mathics.Integer(-1), mathics.Integer(1)), sympy.Integer(-1) + sympy.I, )
def testComplex(self): self.compare(mathics.Complex(mathics.Integer(1), mathics.Integer(1)), 1 + 1j) self.compare( mathics.Complex(mathics.MachineReal(1.0), mathics.MachineReal(1.0)), 1.0 + 1.0j, ) self.compare( mathics.Complex(mathics.Integer(1), mathics.MachineReal(1.0)), 1 + 1.0j ) self.compare( mathics.Complex(mathics.MachineReal(1.0), mathics.Integer(1)), 1.0 + 1j ) self.compare( mathics.Complex(mathics.Real("1.0", 5), mathics.Integer(1)), 1.0 + 1j ) self.compare( mathics.Complex(mathics.Integer(1), mathics.Real("1.0", 20)), 1 + 1.0j ) self.compare(mathics.Complex(mathics.Integer(0), mathics.Integer(1)), 1j) self.compare(mathics.Complex(mathics.Integer(1), mathics.Integer(0)), 1)
def testReal(self): self.compare(mathics.Real('0.0'), 0.0) self.compare(mathics.Real('1.5'), 1.5) self.compare(mathics.Real('-1.5'), -1.5)
def testReal(self): self.compare(mathics.Real('1.0'), sympy.Float('1.0')) self.compare(mathics.Real(1.0), sympy.Float(1.0))
def testReal(self): self.compare(mathics.Real("1.0"), sympy.Float("1.0")) self.compare(mathics.Real(1.0), sympy.Float(1.0))
def testReal(self): self.compare(mathics.Real("0.0"), 0.0) self.compare(mathics.Real("1.5"), 1.5) self.compare(mathics.Real("-1.5"), -1.5)