#!/usr/bin/env python3from sympy import symbols, pprint, sqrt, Rational
from unittest import TestCase, main
print('7.')
x = 1 / (sqrt(5) - sqrt(3))
y = 1 / (sqrt(5) + sqrt(3))
classMyTest(TestCase):
defsetUp(self):
passdeftearDown(self):
passdeftest(self):
spam = [x + y, x * y, x ** 2 + x * y + y ** 2, y / x + x / y]
egg = [sqrt(5), Rational(1, 2), Rational(9, 2), 8]
for s, t inzip(spam, egg):
self.assertEqual(s.simplify(), t)
if __name__ == '__main__':
main()
0 コメント:
コメントを投稿