首页 > 代码库 > Scipy - Python library - Math tool - Begin
Scipy - Python library - Math tool - Begin
Introduction
Scientific Computing Tools for Python. Seen in Scipy.org.
Environment
Linux, CentOS 7 with KDE, python 2.7
Installation
1 python -m pip install --upgrade pip 2 # Do not use sudo for the next command 3 pip install --user numpy scipy matplotlib ipython jupyter pandas sympy nose 4 # change the environment 5 vim ~/.bashrc 6 # export PATH=$PATH:/home/leaf/.local/bin
A simple demo to solve a Bessel function
Bessel function: most commonly, the canonical solutions y(x) of the differential equation. Seen in wiki.
Code (Python):
1 from matplotlib.pyplot import * 2 from numpy import * 3 from scipy import special, optimize 4 f = lambda x: -special.jv(3,x) 5 sol = optimize.minimize(f, 1.0) 6 x = linspace(0, 10, 5000) 7 x 8 plot(x, special.jv(3, x), ‘-‘, sol.x, -sol.fun, ‘o‘) 9 savefig(‘plot.png‘, dpi=96)
Result:
Simple case. Just for the beginning of applying Scipy.
Scipy - Python library - Math tool - Begin
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。