3715的python哟
3715的python
#最后一题用第一个可以做!!真的我试了 但我函数敲错了 改一下函数就行!!
from sympy import *
x, y = symbols(‘x y’)
a = expand((2*x + y)**4)
a
simplify(cos(x)/sin(2*x))
limit(x*sin(1/x),x,0,’-’)
diff(exp(x)*cos(x))
integrate(sin(x)**3,x)
integrate(exp(x**1/2))
integrate(sin(x)**2,(x,0,pi/2))
integrate(1/(exp(x)+exp(-x)),(x,0,1))
solveset(x**5+1,x)
solution=solve((3x+4y-10,5x-2y-12),(x,y))
solution[x],solution[y]
import numpy as np
A=np.array([[2,5,7],[4,1,3],[6,9,5]])
A
np.linalg.inv(A)
a=np.array([[1,0,3],[2,5,1],[4,0,3]])
b=np.array([[3,1,2],[2,7,0],[5,1,1]])
np.dot(a,b)
import matplotlib.pyplot as plt
import numpy as np
import math
x = np.linspace(-10,10,1000)
y = [math.exp(-t) for t in x]
plt.plot(x, y)
plt.show()
下面三个不一定对,我先写在这里,到时候你们选择性的用,记得改一下解析式。
1
from pylab import *
from mpl_toolkits.mplot3d import Axes3D
x, y = meshgrid(arange(-5, 5.5, 0.05), arange(-5, 5.5, 0.05))
z = 1-x**-y**2/4
ax = gca(projection=‘3d’)
ax.plot_surface(x, y, z)
show()
2
from matplotlib import pyplot as plt
import numpy as np
from mpl_toolkits.mplot3d import Axes3D
fig = plt.figure()
ax = Axes3D(fig)
X = np.arange(-4, 4, 0.25)
Y = np.arange(-4, 4, 0.25)
X, Y = np.meshgrid(X, Y)
R = np.sqrt(X2 + Y2)
Z = X*Y
ax.plot_surface(X, Y, Z, rstride=1, cstride=1, cmap=‘rainbow’)
plt.draw()
plt.pause(10)
plt.savefig(‘3D.jpg’)
plt.close()
3
import numpy as np
import matplotlib.pyplot as mp
from mpl_toolkits.mplot3d import Axes3D
n = 1000
x, y = np.meshgrid(np.linspace(-3, 3, n),
np.linspace(-3, 3, n))
z = (1 - x / 2 + x ** 5 + y ** 3) *
np.exp(-x ** 2 - y ** 2)
fig = mp.figure(“3D Surface”, facecolor=“lightgray”)
mp.title(“3D Surface”, fontsize=18)
ax3d = Axes3D(fig)
ax3d.set_xlabel(“X”)
ax3d.set_ylabel(“Y”)
ax3d.set_zlabel(“Z”)
mp.tick_params(labelsize=10)
ax3d.plot_surface(x, y, z, cstride=20, rstride=20, cmap=“jet”)
mp.show()
本文地址:https://blog.csdn.net/Ayanokei/article/details/110915616
上一篇: 骁龙888对比骁龙750G哪个更好
下一篇: 告诉你压力变送器选型参考大全!