Dependencies

Gaurav Dhingra edited this page Dec 16, 2017 · 53 revisions
Clone this wiki locally

The SymPy CAS can be installed on virtually any computer with Python 2.7 or above (see supported versions). SymPy does require mpmath python library to be installed first.

However, there are several packages that are not required to use SymPy, but that will enhance SymPy if they are installed. These packages are:

IPython(http://ipython.org/). IPython is a third party Python interactive shell that has many more features over the built-in Python interactive shell, such as tab-completetion, magic functions, debugging etc. If IPython is installed, isympy (executed by /bin/isympy) will automatically use it. Otherwise, it will fall back to the regular Python interactive shell. You can override this behavior by setting the -c option to isympy, like isympy -c python.

gmpy (https://pypi.python.org/pypi/gmpy2). gmpy is a Python wrapper around the GNU Multiple Precision Arithmetic Library (GMP). If gmpy is installed, it may make certain operations in SymPy faster, because it will use gmpy as the ground type instead of the built-in Python ground types. If gmpy is not installed, it will fall back to the default Python ground types. You can override this behavior by setting the SYMPY_GROUND_TYPES environment variable, such as SYMPY_GROUND_TYPES=python isympy. [Note: this should be an option to isympy!]

Cython (http://cython.org/). [What exactly is the situation with Cython?] Cython is a compiler which compiles Python-like code files to C code. Still, Cython is not a Python to C translator. That is, it doesn't take your full program and "turns it into C" -- rather, the result makes full use of the Python runtime environment. A way of looking at it may be that your code is still Python in that it runs within the Python runtime environment, but rather than compiling to interpreted Python bytecode one compiles to native machine code (but with the addition of extra syntax for easy embedding of faster C-like code). If cython is installed then some parts of sympy's code with be compiled to C and sympy will run faster.

The following are the modules of SymPy that use Cython:

  • Autowrap

Numpy (http://www.numpy.org/) [Ditto] NumPy is the fundamental package needed for scientific computing with Python. It contains among other things:

  • a powerful N-dimensional array object

  • sophisticated (broadcasting) functions

  • tools for integrating C/C++ and Fortran code

  • useful linear algebra, Fourier transform, and random number capabilities.

Besides its obvious scientific uses, NumPy can also be used as an efficient multi-dimensional container of generic data. Arbitrary data-types can be defined. This allows NumPy to seamlessly and speedily integrate with a wide variety of databases. If it is installed then Numerical Python will add a fast, compact, multidimensional array facility to Python. NumPy is the successor to both Numeric and Numarray.

The following are the modules of SymPy that use Numpy:

  • Autowrap

  • GAsympy

  • Matrices

  • Latex_ex

  • circuitplot

  • dagger

  • gate

  • matrixcache

  • matrixutils

  • qexpr

  • qubit

  • represent

  • tensorproduct.

Scipy. [Ditto] SciPy is open-source software for mathematics, science, and engineering. It is also the name of a very popular conference on scientific programming with Python. The SciPy library depends on NumPy, which provides convenient and fast N-dimensional array manipulation. The SciPy library is built to work with NumPy arrays, and provides many user-friendly and efficient numerical routines such as routines for numerical integration and optimization. Together, they run on all popular operating systems, are quick to install, and are free of charge.

The jn_zeros function uses scipy.

The following are the modules of SymPy that use Scipy:

  • dagger

  • gate

  • matrixcache

  • matrixutils

  • qexpr

  • qubit

  • represent

  • tensorproduct.

• [Code generation dependencies?]

• [Other dependencies?]

  •  **matplotlib.**  is a python 2D plotting library which produces publication quality figures in a variety of hardcopy formats and interactive environments across platforms. matplotlib can be used in python scripts, the python and ipython shell (ala MATLAB®* or Mathematica®†), web application servers, and six graphical user interface toolkits.
    

matplotlib tries to make easy things easy and hard things possible. You can generate plots, histograms, power spectra, bar charts, errorcharts, scatterplots, etc, with just a few lines of code. For example, using "ipython -pylab" to provide an interactive environment, to generate 10,000 gaussian random numbers and plot a histogram with 100 bins, you simply need to type

x = randn(10000) , hist(x, 100)

If matplotlib is available, the functions plot and cplot in mpmath can be used to plot functions respectively as x-y graphs and in the complex plane. Also, splot can be used to produce 3D surface plots.

Modules used by the external dependency-matplotlib are

  • circuitplot

  • state

  • tensorproduct