Setting up mpmath ================= Download and installation ------------------------- If you have `setuptools `_ installed, you can download and install the latest release of mpmath in one step by running: ``python -m easy_install mpmath`` Alternatively, setup files can be downloaded manually from the `mpmath download page `_ or the `Python Package Index `_. If you are using Windows, you can pick the binary installer (mpmath-version.win32.exe). Otherwise, download the source package (available as both .zip and .tar.gz), extract it, open the extracted directory, and run ``python setup.py install`` Debian and Ubuntu users can apt-get mpmath. See `package information `_; please verify that you are getting the latest version. After the setup has completed, you should be able to fire up the interactive Python interpreter and do the following:: >>> from mpmath import * >>> mp.dps = 50 >>> print mpf(2) ** mpf('0.5') 1.4142135623730950488016887242096980785696718753769 >>> print 2*pi 6.2831853071795864769252867665590057683943387987502 *Note: if you have mpmath 0.6 or earlier installed, you may have to either first uninstall the old version, or manually delete the obsolete mpmath/lib directory. Otherwise this directory will be imported erroneously.* Running tests ------------- It is recommended that you run the mpmath unit tests to make sure everything works. The tests are located in the ``tests`` subdirectory of the main mpmath directory. They can be run via ``python runtests.py`` The tests should finish in about a minute. If you have `psyco `_ installed, the tests can also be run with ``python runtests.py -psyco`` which will cut the running time in half. If any test fails, please send a detailed bug report to the `mpmath issue tracker `_. The tests can also be run with `py.test `_. This will sometimes generate more useful information in case of a failure. Compiling the documentation --------------------------- If you downloaded the source package, the text source for these documentation pages is included in the ``doc`` directory. The documentation can be compiled to pretty HTML using `Sphinx `_. Go to the ``doc`` directory and run ``python build.py`` You can also test that all the interactive examples in the documentation work by running ``python run_doctest.py`` (The doctests may take several minutes.) Finally, some additional demo scripts are available in the ``demo`` directory included in the source package.