2017年5月4日

python 实现数值积分与画图

摘要: import numpy as np from scipy import integrate def half_circle(x): return (1 - x ** 2) ** 0.5 N = 10000 x = np.linspace(-1, 1, N) dx = 2. / N; y = half_circle(x) area =sum( dx * y)#利用矩形面积法 ... 阅读全文

posted @ 2017-05-04 17:59 Kermit.Li 阅读(5836) 评论(0) 推荐(0) 编辑

python scipy 求解简单线性方程组和fmin求函数最小值

摘要: ###这是一个利用内置函数求最小值#####def func(x): return x ** 2 - 2 *x x = 1 func(x) opt.fmin(func ,x)## 用scipy求解线性方程组 from scipy.optimize import fsolve from math import sin, cos def f(x): x0 = float(x[0]... 阅读全文

posted @ 2017-05-04 16:55 Kermit.Li 阅读(6257) 评论(0) 推荐(0) 编辑

导航