- 随机数和蒙特卡洛模拟
- 求解单一变量非线性方程
- 求解线性系统方程
- 函数的数学积分
- 常微分方程的数值解
- 等势线绘图和曲线
- 等势线
-
import numpy as np import matplotlib.pyplot as plt from mpl_toolkits.mplot3d import Axes3D x_vals = np.linspace(-5,5,20) y_vals = np.linspace(0,10,20) X,Y = np.meshgrid(x_vals,y_vals) Z = X**2 * Y**0.5 line_count = 15 ax = Axes3D(plt.figure()) ax.plot_surface(X,Y,Z,rstride=1,cstride=1) plt.show()
-
非线性方程的数学解
-
一般实函数 Scipy.optimize
-
fsolve函数求零点(限定只给实数解)
-
import scipy.optimize as so from scipy.optimize import fsolve f = lambda x:x**2-1 fsolve(f,0.5) fsolve(f,-0.5) fsolve(f,[-0.5,0.5]) >>>fsolve(f,-0.5,full_output=True) >>>(array([-1.]), {'nfev': 9, 'fjac': array([[-1.]]), 'r': array([1.99999875]), 'qtf': array([3.82396337e-10]), 'fvec': array([4.4408921e-16])}, 1, 'The solution converged.') >>>help(fsolve) >>>Help on function fsolve in module scipy.optimize._minpack_py: fsolve(func, x0, args=(), fprime=None, full_output=0, col_deriv=0, xtol=1.49012e-08, maxfev=0, band=None, epsfcn=None, factor=100, diag=None) Find the roots of a function. Return the roots of the (non-linear) equations defined by ``func(x) = 0`` given a starting estimate.
-
-
-