Download .venv/Lib/site-packages/mpmath/tests/test_identify.py from DrDavis/PythonProject1: direct link, hf CLI and curl.
- Browser
- Download file 692 Bytes
-
https://huggingface.co/DrDavis/PythonProject1/resolve/main/.venv/Lib/site-packages/mpmath/tests/test_identify.py
- Command line
-
hf download hf://DrDavis/PythonProject1/.venv/Lib/site-packages/mpmath/tests/test_identify.py
-
curl -L -o test_identify.py https://huggingface.co/DrDavis/PythonProject1/resolve/main/.venv/Lib/site-packages/mpmath/tests/test_identify.py
692 Bytes
| from mpmath import * | |
| def test_pslq(): | |
| mp.dps = 15 | |
| assert pslq([3*pi+4*e/7, pi, e, log(2)]) == [7, -21, -4, 0] | |
| assert pslq([4.9999999999999991, 1]) == [1, -5] | |
| assert pslq([2,1]) == [1, -2] | |
| def test_identify(): | |
| mp.dps = 20 | |
| assert identify(zeta(4), ['log(2)', 'pi**4']) == '((1/90)*pi**4)' | |
| mp.dps = 15 | |
| assert identify(exp(5)) == 'exp(5)' | |
| assert identify(exp(4)) == 'exp(4)' | |
| assert identify(log(5)) == 'log(5)' | |
| assert identify(exp(3*pi), ['pi']) == 'exp((3*pi))' | |
| assert identify(3, full=True) == ['3', '3', '1/(1/3)', 'sqrt(9)', | |
| '1/sqrt((1/9))', '(sqrt(12)/2)**2', '1/(sqrt(12)/6)**2'] | |
| assert identify(pi+1, {'a':+pi}) == '(1 + 1*a)' | |