欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  IT编程

3715的python哟

程序员文章站 2022-03-19 16:20:33
3715的pythonfrom sympy import *x, y = symbols(‘x y’)a = expand((2*x + y)**4)asimplify(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(-...

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()

3715的python哟
3715的python哟3715的python哟下面三个不一定对,我先写在这里,到时候你们选择性的用,记得改一下解析式。
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

相关标签: 3715 python