Show pageOld revisionsBacklinksExport to PDFBack to top This page is read only. You can view the source, but not change it. Ask your administrator if you think this is wrong. ====== Using Python as a math shell ====== Python can be used as a MATLAB-like shell for math and stuff. The following components are needed (in order of decreasing importance): * IPython * NumPy * Matplotlib * SciPy * SymPy IPython makes the Python shell behave more like tools such as MATLAB. ===== Creating IPython profile for math ===== We need to set up an IPython profile that automatically imports the aforementioned math-related libraries. First, create a new IPython profile: <code> $ ipython profile create math </code> Then, add a startup script to this profile. Create a Python file in the startup directory, which is found at ''~/.ipython/profile_math/startup'' In this file, import all the necessary math libraries. Here's an example: <code python 0-init.py> import numpy as np import scipy import sympy import matplotlib.pyplot as plt </code> ===== Running profile ===== To run this profile, run the following command: <code> ipython --profile=math </code> ==== Create bash alias ==== In order to not have to run that command every time, you can create a bash alias. Add this line to ''~/.bashrc'': <code bash> alias matpy-shell="ipython --profile=math" </code> kb/python_math_shell.txt Last modified: 2024-04-30 04:03by 127.0.0.1