首页 > 编程语言 > 详细

Scipy - Python library - Math tool - Begin

时间:2016-11-28 20:53:03      阅读:308      评论:0      收藏:0      [点我收藏+]

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

原文:http://www.cnblogs.com/loadofleaf/p/6110836.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!