Пример #1
0
    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)
Пример #2
0
    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,
        )
Пример #3
0
    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)
Пример #4
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)
Пример #5
0
 def testReal(self):
     self.compare(mathics.Real('1.0'), sympy.Float('1.0'))
     self.compare(mathics.Real(1.0), sympy.Float(1.0))
Пример #6
0
 def testReal(self):
     self.compare(mathics.Real("1.0"), sympy.Float("1.0"))
     self.compare(mathics.Real(1.0), sympy.Float(1.0))
Пример #7
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)