Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to install sympy package in python

I am a beginner to python, I wanted to symbolic computations. I came to know with sympy installation into our pc we can do symbolic computation. I have installed python 3.6 and I am using anaconda nagavitor, through which I am using spyder as an editor. now I want to install symbolic package sympy how to do that. I checked some post which says use 'conda install sympy'. but where to type this? I typed this in spyder editor and I am getting syntax error. thankyou

like image 587
acoustic python Avatar asked Jan 26 '23 20:01

acoustic python


2 Answers

Agree with Dixit.

First Solution:

It's okay to use pip3 install sympy on MacOS.

  1. List item
  2. Open your "Terminal".
  3. Input pip3 install sympy and press enter.
  4. It will automatically download and install the Sympy Package.

Second Solution:

Using git. # Notice: Before install Sympy, it's necessary to install "mpmath". Like the First Solution,

  • 1) Open "Terminal";
  • 2) Input pip3 install mpmath

After installing "mpmath", then,

  1. List item
  2. Open your "Terminal" on MacOS or "win+r", then input "cmd" in Windows.
  3. Input "git clone git://github.com/sympy/sympy.git" and press enter;
  4. Input "python setup.py install"

After finish installation, you can open the Python IDLE and try:

from sympy import Symbol, cos
x = Symbol('x')
e = 1/cos(x)
print(e.series(x, 0, 10))
# Result
# 1 + x**2/2 + 5*x**4/24 + 61*x**6/720 + 277*x**8/8064 + O(x**10)

If the code works, it shows that your "Sympy" package has already been installed.

like image 92
pandalai Avatar answered Jan 29 '23 21:01

pandalai


In anaconda navigator:

  1. Click Environments (on the left)
  2. Choose your environment (if you have more than one)
  3. On the middle pick "All" from dropbox ("installed" by default)
  4. Write sympy in search-box on the right
  5. Check the package that showed out
  6. Click apply
like image 33
Arkady. A Avatar answered Jan 29 '23 20:01

Arkady. A