网站开发发展趋势,手机网站打不开是什么原因造成的,徐州seo企业,wordpress超人采集侠学习Python中的一些数学函数与函数的绘图
主要用到numpy 与 matplotlib 如果有什么不正确#xff0c;欢迎指教。
图片不知道怎样批量上传#xff0c;一个一个怎么感觉很小#xff0c;请见谅
自行复制拷贝#xff0c;到vs#xff0c;jupyter notebook, spyder都可以
函…学习Python中的一些数学函数与函数的绘图
主要用到numpy 与 matplotlib 如果有什么不正确欢迎指教。
图片不知道怎样批量上传一个一个怎么感觉很小请见谅
自行复制拷贝到vsjupyter notebook, spyder都可以
函数 yx−sinxy x - sinx yx−sinx
%matplotlib inline
%config InlineBackend.figure_format svg
import numpy as np
import matplotlib.pyplot as plt
from scipy import signal
plt.rcParams[figure.figsize] (8, 4.5)
plt.rcParams[figure.dpi] 150
plt.rcParams[font.sans-serif] [Simhei] #替代字体
plt.rcParams[axes.unicode_minus] False #解决坐标轴负数的铅显示问题x1 np.linspace(-np.pi, np.pi, 1000)
y1 x1 - np.sin(x1)plt.plot(x1, y1, c k, label r$ yx-sinx $)plt.grid()
plt.legend()
plt.show()函数 y3x4−4x31y 3x^4 - 4x^3 1 y3x4−4x31
%matplotlib inline
%config InlineBackend.figure_format svg
import numpy as np
import matplotlib.pyplot as plt
from scipy import signal
plt.rcParams[figure.figsize] (8, 4.5)
plt.rcParams[figure.dpi] 150
plt.rcParams[font.sans-serif] [Simhei] #替代字体
plt.rcParams[axes.unicode_minus] False #解决坐标轴负数的铅显示问题x1 np.linspace(-1, 1.5, 1000)
y1 3 * (x1 ** 4) - 4 * (x1 ** 3) 1
plt.plot(x1, y1, label r$ y 3x^4 - 4x^3 1 $)plt.grid()
plt.legend()
plt.show()函数 yx4y x^4 yx4
%matplotlib inline
%config InlineBackend.figure_format svg
import numpy as np
import matplotlib.pyplot as plt
from scipy import signal
plt.rcParams[figure.figsize] (8, 4.5)
plt.rcParams[figure.dpi] 150
plt.rcParams[font.sans-serif] [Simhei] #替代字体
plt.rcParams[axes.unicode_minus] False #解决坐标轴负数的铅显示问题x1 np.linspace(-5, 5, 1000)
y1 x1 ** 4plt.plot(x1, y1, label r$ y x^4 $)plt.grid()
plt.legend()
plt.show()函数 yx3y \sqrt[3]{x} y3x
%matplotlib inline
%config InlineBackend.figure_format svg
import numpy as np
import matplotlib.pyplot as plt
from scipy import signal
plt.rcParams[figure.figsize] (8, 4.5)
plt.rcParams[figure.dpi] 150
plt.rcParams[font.sans-serif] [Simhei] #替代字体
plt.rcParams[axes.unicode_minus] False #解决坐标轴负数的铅显示问题x1 np.linspace(0, 5, 1000)
y1 x1 ** (1/3)plt.plot(x1, y1, label r$ y \sqrt[3]{x} $)# plt.xlim([-np.pi, np.pi])
# plt.ylim([-1.5, 1.5])
plt.grid()
plt.legend()
plt.show()函数 y2x3−9x212x−3y2x^3-9x^212x-3 y2x3−9x212x−3
%matplotlib inline
%config InlineBackend.figure_format svg
import numpy as np
import matplotlib.pyplot as plt
from scipy import signal
plt.rcParams[figure.figsize] (8, 4.5)
plt.rcParams[figure.dpi] 150
plt.rcParams[font.sans-serif] [Simhei] #替代字体
plt.rcParams[axes.unicode_minus] False #解决坐标轴负数的铅显示问题x1 np.linspace(-2, 5, 1000)
y1 2 * (x1 ** 3) - 9 * (x1 ** 2) 12 * x1 - 3plt.plot(x1, y1, label r$ y2x^3-9x^212x-3 $)plt.grid()
plt.legend()
plt.show()函数 y2x3−6x2−18x7y2x^3-6x^2-18x7 y2x3−6x2−18x7
%matplotlib inline
%config InlineBackend.figure_format svg
import numpy as np
import matplotlib.pyplot as plt
from scipy import signal
plt.rcParams[figure.figsize] (8, 4.5)
plt.rcParams[figure.dpi] 150
plt.rcParams[font.sans-serif] [Simhei] #替代字体
plt.rcParams[axes.unicode_minus] False #解决坐标轴负数的铅显示问题x1 np.linspace(-3, 5, 1000)
y1 2 * (x1 ** 3) - 6 * (x1 ** 2) - 18 * x1 7plt.plot(x1, y1, label r$ y2x^3-6x^2-18x7 $)# plt.axis(equal)
plt.grid()
plt.legend()
plt.show()三次抛物线 yx3y x^3 yx3
%matplotlib inline
%config InlineBackend.figure_format svg
import numpy as np
import matplotlib.pyplot as plt
from scipy import signal
plt.rcParams[figure.figsize] (8, 4.5)
plt.rcParams[figure.dpi] 150
plt.rcParams[font.sans-serif] [Simhei] #替代字体
plt.rcParams[axes.unicode_minus] False #解决坐标轴负数的铅显示问题ax plt.gca()
ax.spines[right].set_color(none)
ax.spines[top].set_color(none)
ax.xaxis.set_ticks_position(bottom)
ax.spines[bottom].set_position((data, 0))
ax.yaxis.set_ticks_position(left)
ax.spines[left].set_position((data, 0))x1 np.linspace(-5, 5, 1000)
y1 x1 ** 3plt.plot(x1, y1, label r$ y x^3 $)plt.grid()
plt.legend()
plt.show()半立方抛物线 y2ax3y^2 ax^3 y2ax3
%matplotlib inline
%config InlineBackend.figure_format svg
import numpy as np
import matplotlib.pyplot as plt
from scipy import signal
plt.rcParams[figure.figsize] (8, 4.5)
plt.rcParams[figure.dpi] 150
plt.rcParams[font.sans-serif] [Simhei] #替代字体
plt.rcParams[axes.unicode_minus] False #解决坐标轴负数的铅显示问题a 0.1
t np.linspace(-5, 5, 1000)
x t ** 2
y a * (t ** 3)
plt.plot(x, y, label ry^2 ax^3|a0.1)a 1
y1 a * (t ** 3)
plt.plot(x, y1, label ry^2 ax^3|a1)# plt.xlim([-np.pi, np.pi])
# plt.ylim([-1.5, 1.5])
plt.grid()
plt.legend()
plt.show()概率曲线 ye−x2ye^{-x^2} ye−x2
%matplotlib inline
%config InlineBackend.figure_format svg
import numpy as np
import matplotlib.pyplot as plt
from scipy import signal
plt.rcParams[figure.figsize] (8, 4.5)
plt.rcParams[figure.dpi] 150
plt.rcParams[font.sans-serif] [Simhei] #替代字体
plt.rcParams[axes.unicode_minus] False #解决坐标轴负数的铅显示问题t np.linspace(-2, 2, 1000)
x t
y np.e ** -(x ** 2)
plt.plot(x, y, label r$ ye^{-x^2} $)plt.axis(equal)
# plt.grid()
plt.legend()
plt.show()箕舌线 y8a3x24a2y \frac{8a^3}{x^24a^2} yx24a28a3
%matplotlib inline
%config InlineBackend.figure_format svg
import numpy as np
import matplotlib.pyplot as plt
from scipy import signal
plt.rcParams[figure.figsize] (8, 4.5)
plt.rcParams[figure.dpi] 150
plt.rcParams[font.sans-serif] [Simhei] #替代字体
plt.rcParams[axes.unicode_minus] False #解决坐标轴负数的铅显示问题a 1
t np.linspace(-5, 5, 1000)
x t
y (8 * a ** 2) / (x ** 2 4 * a ** 2)
plt.plot(x, y, label r$ y \frac{8a^3}{x^24a^2} |_{a1} $)a 2
y1 (8 * a ** 2) / (x ** 2 4 * a ** 2)
plt.plot(x, y1, label r$ y \frac{8a^3}{x^24a^2} |_{a2} $)plt.axis(equal)
# plt.grid()
plt.legend()
plt.show()蔓叶线 y2(2a−x)x3y^2(2a-x)x^3 y2(2a−x)x3 或 x2asin2θ,y2a2tan2θsin4θx2asin^2\theta, y2a^2tan^2\theta sin^4\theta x2asin2θ,y2a2tan2θsin4θ
修改之前x的取值是−3.6≤x≤3.6-3.6\leq x \leq3.6−3.6≤x≤3.6, 实际上x的值是 ≥0\geq 0≥0
%matplotlib inline
%config InlineBackend.figure_format svg
import numpy as np
import matplotlib.pyplot as plt
from scipy import signal
plt.rcParams[figure.figsize] (8, 4.5)
plt.rcParams[figure.dpi] 150
plt.rcParams[font.sans-serif] [Simhei] #替代字体
plt.rcParams[axes.unicode_minus] False #解决坐标轴负数的铅显示问题a 2
#这是原来的取值范围
#t np.linspace(-3.6, 3.6, 1000)
#x np.abs(t)
#这是现在的取值范围
t np.linspace(0, 3.6, 1000)
x t
#还有我用power替代了sqrt开根号
y np.power((x ** 3) / (2 * a - x), 1/2)
plt.plot(x, y, b, x, -y, b, label r$ y^2(2a-x)x^3 $)plt.grid()
plt.legend()
plt.show()ρ2a−tan2θ\rho2a-tan^2\theta ρ2a−tan2θ
%matplotlib inline
%config InlineBackend.figure_format svg
import numpy as np
import matplotlib.pyplot as plt
from scipy import signal
plt.rcParams[figure.figsize] (8, 4.5)
plt.rcParams[figure.dpi] 150
plt.rcParams[font.sans-serif] [Simhei] #替代字体
plt.rcParams[axes.unicode_minus] False #解决坐标轴负数的铅显示问题#极坐标
plt.subplot(111, polar True)
plt.ylim([0, 6])a 1
theta np.arange(0, 2 * np.pi, np.pi / 100)
rho 2 * a - np.tan(theta) ** 2
plt.plot(theta, rho, label r$\rho2a-tan^2\theta \quad |a1$)a 1.5
r2 a * rho
plt.plot(theta, r2, label r$\rho2a-tan^2\theta \quad |a1.5$)a 2.5
r2 a * rho
plt.plot(theta, r2, label r$\rho2a-tan^2\theta \quad |a2.5$)plt.legend()
plt.show()笛卡儿叶形线画图 极坐标 r3asinθcosθsin3θcos3θr \frac{3asin\theta cos\theta}{sin^3\theta cos^3\theta} rsin3θcos3θ3asinθcosθ
%matplotlib inline
%config InlineBackend.figure_format svg
import numpy as np
import matplotlib.pyplot as plt
from scipy import signal
plt.rcParams[figure.figsize] (8, 4.5)
plt.rcParams[figure.dpi] 150
plt.rcParams[font.sans-serif] [Simhei] #替代字体
plt.rcParams[axes.unicode_minus] False #解决坐标轴负数的铅显示问题#极坐标
plt.subplot(111, polar True)
plt.ylim([0, 6])a 1
theta np.arange(0, 2 * np.pi, np.pi / 100)
r 3 * a * np.sin(theta) * np.cos(theta) / (np.sin(theta) ** 3 np.cos(theta) ** 3)
plt.plot(theta, r, label r$ r \frac{3asin\theta cos\theta}{sin^3\theta cos^3\theta} $)a 1.5
r2 a * r
plt.plot(theta, r2)a 2.5
r2 a * r
plt.plot(theta, r2)# plt.grid()
plt.legend()
plt.show()笛卡儿叶形线 直角坐标 x3y3−3axy0x^3y^3-3axy0 x3y3−3axy0 或 x3at1t3,y3at21t3x\frac{3at}{1t^3}, y\frac{3at^2}{1t^3} x1t33at,y1t33at2
%matplotlib inline
%config InlineBackend.figure_format svg
import numpy as np
import matplotlib.pyplot as plt
from scipy import signal
plt.rcParams[figure.figsize] (8, 4.5)
plt.rcParams[figure.dpi] 150
plt.rcParams[font.sans-serif] [Simhei] #替代字体
plt.rcParams[axes.unicode_minus] False #解决坐标轴负数的铅显示问题#极坐标
# plt.subplot(111, polar True)
# plt.ylim([0, 6])a 1
# t np.arange(-0.1, 4 * np.pi, np.pi / 180)
t np.linspace(-0.5, 200, 5000)
x (3 * a * t) / (1 t ** 3)
y (3 * a * t ** 2) / (1 t ** 3)
plt.plot(x, y, label r$ x\frac{3at}{1t^3}, y\frac{3at^2}{1t^3} $)a 1.5
x1 (3 * a * t) / (1 t ** 3)
y1 (3 * a * t ** 2) / (1 t ** 3)
plt.plot(x1, y1, label r$ x\frac{3at}{1t^3}, y\frac{3at^2}{1t^3} $)# plt.grid()
plt.legend()
plt.show()星形线内摆线的一种 x23y23a23x^\frac{2}{3}y^\frac{2}{3}a^\frac{2}{3} x32y32a32 或 {xacos3θyasin3θ\begin{cases} xacos^3\theta \\ yasin^3\theta \end{cases} {xacos3θyasin3θ
%matplotlib inline
%config InlineBackend.figure_format svg
import numpy as np
import matplotlib.pyplot as plt
from scipy import signal
plt.rcParams[figure.figsize] (8, 4.5)
plt.rcParams[figure.dpi] 150
plt.rcParams[font.sans-serif] [Simhei] #替代字体
plt.rcParams[axes.unicode_minus] False #解决坐标轴负数的铅显示问题a 1
theta np.arange(0, 2 * np.pi, np.pi / 180)
x a * np.cos(theta) ** 3
y a * np.sin(theta) ** 3
plt.plot(x, y, label r$ xacos^3\theta, yasin^3\theta \quad|a1$)a 2
x1 a * x
y1 a * y
plt.plot(x1, y1, label r$ xacos^3\theta, yasin^3\theta \quad|a2$)a 3
x2 a * x
y2 a * y
plt.plot(x2, y2, label r$ xacos^3\theta, yasin^3\theta \quad|a3$)ax plt.gca()
ax.spines[right].set_color(none)
ax.spines[top].set_color(none)
ax.xaxis.set_ticks_position(bottom)
ax.spines[bottom].set_position((data, 0))
ax.yaxis.set_ticks_position(left)
ax.spines[left].set_position((data, 0))plt.axis(equal)
plt.legend()
plt.show()摆线 {xa(θ−sinθ)ya(1−cosθ)\begin{cases} xa(\theta-sin\theta) \\ ya(1-cos\theta) \end{cases} {xa(θ−sinθ)ya(1−cosθ)
%matplotlib inline
%config InlineBackend.figure_format svg
import numpy as np
import matplotlib.pyplot as plt
from scipy import signal
plt.rcParams[figure.figsize] (8, 4.5)
plt.rcParams[figure.dpi] 150
plt.rcParams[font.sans-serif] [Simhei] #替代字体
plt.rcParams[axes.unicode_minus] False #解决坐标轴负数的铅显示问题#极坐标
# plt.subplot(111, polar True)
# plt.ylim([0, 6])a 1
theta np.arange(0, 4 * np.pi, np.pi / 180)
x a * (theta - np.sin(theta))
y a * (1 - np.cos(theta))
plt.plot(x, y, label r$ xa(\theta-sin\theta),\quad ya(1-cos\theta) \quad|a1$)a 2
x1 a * x
y1 a * y
plt.plot(x1, y1, label r$ xa(\theta-sin\theta),\quad ya(1-cos\theta) \quad|a2$)a 3
x2 a * x
y2 a * y
plt.plot(x2, y2, label r$ xa(\theta-sin\theta),\quad ya(1-cos\theta) \quad|a3$)ax plt.gca()
ax.spines[right].set_color(none)
ax.spines[top].set_color(none)
ax.xaxis.set_ticks_position(bottom)
ax.spines[bottom].set_position((data, 0))
ax.yaxis.set_ticks_position(left)
ax.spines[left].set_position((data, 0))plt.axis(equal)
plt.legend()
plt.show()心形线外摆线的一种 KaTeX parse error: Cant use function $ in math mode at position 27: …a\sqrt{x^2y^2}$̲ 或 $ \rhoa(1-c…
%matplotlib inline
%config InlineBackend.figure_format svg
import numpy as np
import matplotlib.pyplot as plt
from scipy import signal
plt.rcParams[figure.figsize] (8, 4.5)
plt.rcParams[figure.dpi] 150
plt.rcParams[font.sans-serif] [Simhei] #替代字体
plt.rcParams[axes.unicode_minus] False #解决坐标轴负数的铅显示问题#极坐标
plt.subplot(111, polar True)
# plt.ylim([0, 6])a 1
theta np.arange(0, 2 * np.pi, np.pi / 180)
y a * (1 - np.cos(theta))
plt.plot(theta, y, label r$ \rhoa(1-cos\theta) $)y1 a * (1 - np.sin(theta))
plt.plot(theta, y1, label r$ \rhoa(1-sin\theta) $)# a 2
# x1 a * x
# y1 a * y
# plt.plot(x1, y1, label r$ xa(\theta-sin\theta),\quad ya(1-cos\theta) \quad|a2$)# a 3
# x2 a * x
# y2 a * y
# plt.plot(x2, y2, label r$ xa(\theta-sin\theta),\quad ya(1-cos\theta) \quad|a3$)# ax plt.gca()
# ax.spines[right].set_color(none)
# ax.spines[top].set_color(none)
# ax.xaxis.set_ticks_position(bottom)
# ax.spines[bottom].set_position((data, 0))
# ax.yaxis.set_ticks_position(left)
# ax.spines[left].set_position((data, 0))# plt.axis(equal)
plt.legend()
plt.show()xsinθ,ycosθx23xsin\theta,\quad ycos\theta\sqrt[3]{x^2}xsinθ,ycosθ3x2
%matplotlib inline
%config InlineBackend.figure_format svg
import numpy as np
import matplotlib.pyplot as plt
from scipy import signal
plt.rcParams[figure.figsize] (8, 4.5)
plt.rcParams[figure.dpi] 150
plt.rcParams[font.sans-serif] [Simhei] #替代字体
plt.rcParams[axes.unicode_minus] False #解决坐标轴负数的铅显示问题a 1
theta np.arange(0, 2 * np.pi, np.pi / 180)
x np.sin(theta)
y np.cos(theta) np.power((x ** 2), 1 / 3) #原来用 y np.cos(theta) np.power(x, 2/3)只画出一半而且报power的错
plt.plot(x, y, label r$xsin\theta,\quadycos\theta\sqrt[3]{x^2}$)# ax plt.gca()
# ax.spines[right].set_color(none)
# ax.spines[top].set_color(none)
# ax.xaxis.set_ticks_position(bottom)
# ax.spines[bottom].set_position((data, 0))
# ax.yaxis.set_ticks_position(left)
# ax.spines[left].set_position((data, 0))plt.axis(equal) #等比例会好看点
plt.legend()
plt.show()阿基米德螺线 ρaθ\rhoa\thetaρaθ
%matplotlib inline
%config InlineBackend.figure_format svg
import numpy as np
import matplotlib.pyplot as plt
from scipy import signal
plt.rcParams[figure.figsize] (8, 4.5)
plt.rcParams[figure.dpi] 150
plt.rcParams[font.sans-serif] [Simhei] #替代字体
plt.rcParams[axes.unicode_minus] False #解决坐标轴负数的铅显示问题#极坐标
plt.subplot(111, polar True)
# plt.ylim([0, 6])a 1
theta np.arange(0, 4 * np.pi, np.pi / 180)
rho a * theta
plt.plot(theta, rho, label r$\rhoa\theta$, linestyle solid)# rho1 - a * theta
# plt.plot(theta, rho1, label r$\rhoa\theta$)plt.legend()
plt.show()对数螺线 ρeaθ\rhoe^{a\theta} ρeaθ
%matplotlib inline
%config InlineBackend.figure_format svg
import numpy as np
import matplotlib.pyplot as plt
from scipy import signal
plt.rcParams[figure.figsize] (8, 4.5)
plt.rcParams[figure.dpi] 150
plt.rcParams[font.sans-serif] [Simhei] #替代字体
plt.rcParams[axes.unicode_minus] False #解决坐标轴负数的铅显示问题#极坐标
plt.subplot(111, polar True)
plt.ylim([0, 10])a 0.1
theta np.arange(0, 6 * np.pi, np.pi / 180)
rho np.e ** (a * theta)
plt.plot(theta, rho, label r$ \rhoe^{a\theta} $, linestyle solid)a 0.2
rho1 np.e ** (a * theta)
plt.plot(theta, rho1, label r$ \rhoe^{a\theta} $, linestyle solid)plt.legend()
plt.show()双曲螺旋线 ρθa\rho\thetaa ρθa
%matplotlib inline
%config InlineBackend.figure_format svg
import numpy as np
import matplotlib.pyplot as plt
from scipy import signal
plt.rcParams[figure.figsize] (8, 4.5)
plt.rcParams[figure.dpi] 150
plt.rcParams[font.sans-serif] [Simhei] #替代字体
plt.rcParams[axes.unicode_minus] False #解决坐标轴负数的铅显示问题#极坐标
plt.subplot(111, polar True)
plt.ylim([0, 30])a 30
theta np.arange(0.01, 6 * np.pi, np.pi / 180)
rho a / theta
plt.plot(theta, rho, label r$ \rho\thetaa \quad |a30 $, linestyle solid)a 50
rho1 a / theta
plt.plot(theta, rho1, label r$ \rho\thetaa \quad |a50 $, linestyle solid)plt.legend()
plt.show()伯努利双纽线 (x2y2)22a2xy(x^2y^2)^22a^2xy(x2y2)22a2xy 或 (x2y2)2a2(x2−y2)(x^2y^2)^2a^2(x^2-y^2)(x2y2)2a2(x2−y2) 或 ρ2a2sin2θ\rho^2a^2sin2\theta ρ2a2sin2θ 或 ρ2a2cos2θ\rho^2a^2cos2\thetaρ2a2cos2θ
%matplotlib inline
%config InlineBackend.figure_format svg
import numpy as np
import matplotlib.pyplot as plt
from scipy import signal
plt.rcParams[figure.figsize] (8, 4.5)
plt.rcParams[figure.dpi] 150
plt.rcParams[font.sans-serif] [Simhei] #替代字体
plt.rcParams[axes.unicode_minus] False #解决坐标轴负数的铅显示问题#极坐标
# plt.subplot(111, polar True)
# plt.ylim([0, 30])a 1
theta np.linspace(-np.pi, np.pi, 200)
x a * np.sqrt(2) * np.cos(theta) / (np.sin(theta) ** 2 1)
y a * np.sqrt(2) * np.cos(theta) * np.sin(theta) / (np.sin(theta) ** 2 1)
plt.plot(x, y, label r$ \rho^2a^2cos2\theta \quad |a1 $, linestyle solid)plt.axis(equal)
plt.legend()
plt.show()三叶玫瑰线 ρacos3θ\rhoacos3\thetaρacos3θ 或 ρasin3θ\rhoasin3\theta ρasin3θ
%matplotlib inline
%config InlineBackend.figure_format svg
import numpy as np
import matplotlib.pyplot as plt
from scipy import signal
# plt.rcParams[figure.figsize] (8, 4.5)
# plt.rcParams[figure.dpi] 150
plt.rcParams[font.sans-serif] [Simhei] #替代字体
plt.rcParams[axes.unicode_minus] False #解决坐标轴负数的铅显示问题#极坐标
plt.subplot(111, polar True)
# plt.ylim([0, 30])a 1
theta np.linspace(0, 2 * np.pi, 200)
rho a * np.cos(3 * theta)
plt.plot(theta, rho, label r$ \rhoacos3\theta \quad |a1 $, linestyle solid)# a 2
# rho1 a * rho
# plt.plot(theta, rho1, label r$ \rhoacos3\theta \quad |a2 $, linestyle solid)a 1
rho2 a * np.sin(3 * theta)
plt.plot(theta, rho2, label r$ \rhoasin3\theta \quad |a1 $, linestyle solid)plt.legend()
plt.show()四叶玫瑰线 ρacos2θ\rhoacos2\theta ρacos2θ 或 ρasin2θ\rhoasin2\theta ρasin2θ
%matplotlib inline
%config InlineBackend.figure_format svg
import numpy as np
import matplotlib.pyplot as plt
from scipy import signal
# plt.rcParams[figure.figsize] (8, 4.5)
# plt.rcParams[figure.dpi] 150
plt.rcParams[font.sans-serif] [Simhei] #替代字体
plt.rcParams[axes.unicode_minus] False #解决坐标轴负数的铅显示问题#极坐标
plt.subplot(111, polar True)
# plt.ylim([0, 30])a 1
theta np.linspace(0, 2 * np.pi, 200)
rho a * np.cos(4 * theta)
plt.plot(theta, rho, label r$ \rhoacos2\theta \quad |a1 $, linestyle solid)a 2
rho1 a * rho
plt.plot(theta, rho1, label r$ \rhoacos2\theta \quad |a2 $, linestyle solid)# a 1
# rho2 a * np.sin(4 * theta)
# plt.plot(theta, rho2, label r$ \rhoasin2\theta \quad |a1 $, linestyle solid)plt.legend()
plt.show()%matplotlib inline
%config InlineBackend.figure_format svg
import numpy as np
import matplotlib.pyplot as plt
from scipy import signal
# plt.rcParams[figure.figsize] (8, 4.5)
# plt.rcParams[figure.dpi] 150
plt.rcParams[font.sans-serif] [Simhei] #替代字体
plt.rcParams[axes.unicode_minus] False #解决坐标轴负数的铅显示问题#极坐标
plt.subplot(111, polar True)
# plt.ylim([0, 30])theta np.linspace(0, 2 * np.pi, 200)a 1
rho a * np.sin(4 * theta)
plt.plot(theta, rho, label r$ \rhoasin2\theta \quad |a1 $, linestyle solid)a 2
rho1 a * np.sin(4 * theta)
plt.plot(theta, rho1, label r$ \rhoasin2\theta \quad |a2 $, linestyle --)plt.legend()
plt.show()多叶玫瑰线 ρacosnθ\rhoacosn\theta ρacosnθ 或 ρasinnθ,∣n1,2,3...\rhoasinn\theta,\quad|n1,2,3...ρasinnθ,∣n1,2,3...
%matplotlib inline
%config InlineBackend.figure_format svg
import numpy as np
import matplotlib.pyplot as plt
from scipy import signal
# plt.rcParams[figure.figsize] (8, 4.5)
# plt.rcParams[figure.dpi] 150
plt.rcParams[font.sans-serif] [Simhei] #替代字体
plt.rcParams[axes.unicode_minus] False #解决坐标轴负数的铅显示问题#极坐标
plt.subplot(111, polar True)
# plt.ylim([0, 30])theta np.linspace(0, 2 * np.pi, 200)a 1
n 20
rho a * np.sin(10 * theta)
plt.plot(theta, rho, label r$ \rhoasinn\theta \quad |a1,n10 $, linestyle solid)plt.legend()
plt.show()函数 四叶线 xaρsinθ,yaρcosθ,ρ2sinsin2θxa\rho sin\theta,ya\rho cos\theta, \rho \sqrt{2}sin{sin2\theta}xaρsinθ,yaρcosθ,ρ2sinsin2θ
%matplotlib inline
%config InlineBackend.figure_format svg
import numpy as np
import matplotlib.pyplot as plt
from scipy import signal
plt.rcParams[figure.figsize] (8, 4.5)
plt.rcParams[figure.dpi] 150
plt.rcParams[font.sans-serif] [Simhei] #替代字体
plt.rcParams[axes.unicode_minus] False #解决坐标轴负数的铅显示问题#极坐标
# plt.subplot(111, polar True)
# plt.ylim([0, 30])a 1
theta np.linspace(-np.pi, np.pi, 200)
rho np.sqrt(2) * np.sin(np.sin(2*theta))
x a * rho * np.sin(theta)
y a * rho * np.cos(theta)
plt.plot(x, y, label r$xa\rho sin\theta,ya\rho cos\theta, \rho \sqrt{2}sin{sin2\theta}$, linestyle solid)plt.axis(equal)
plt.legend()
plt.show()[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-vELrwNwd-1589013522141)(output_52_0.svg)]
%matplotlib inline
%config InlineBackend.figure_format svg
import numpy as np
import matplotlib.pyplot as plt
from scipy import signal
plt.rcParams[figure.figsize] (8, 4.5)
plt.rcParams[figure.dpi] 150
plt.rcParams[font.sans-serif] [Simhei] #替代字体
plt.rcParams[axes.unicode_minus] False #解决坐标轴负数的铅显示问题#极坐标
# plt.subplot(111, polar True)
# plt.ylim([0, 30])a 1
theta np.linspace(-np.pi, np.pi, 200)
rho np.sqrt(2) * np.sin(np.sin(4*theta))
x a * rho * np.sin(theta)
y a * rho * np.cos(theta)
plt.plot(x, y, label r$xa\rho sin\theta,ya\rho cos\theta, \rho \sqrt{2}sin{sin2\theta}$, linestyle solid)plt.axis(equal)
plt.legend()
plt.show()函数 四叶线 xaρsinθ,yaρcosθ,ρ2sin∣sin2θ∣xa\rho sin\theta,ya\rho cos\theta, \rho \sqrt{2}sin{\vert sin2\theta \vert}xaρsinθ,yaρcosθ,ρ2sin∣sin2θ∣
%matplotlib inline
%config InlineBackend.figure_format svg
import numpy as np
import matplotlib.pyplot as plt
from scipy import signal
# plt.rcParams[figure.figsize] (8, 4.5)
# plt.rcParams[figure.dpi] 150
plt.rcParams[font.sans-serif] [Simhei] #替代字体
plt.rcParams[axes.unicode_minus] False #解决坐标轴负数的铅显示问题#极坐标
# plt.subplot(111, polar True)
# plt.ylim([0, 30])a 1
theta np.linspace(-np.pi, np.pi, 1000)
rho np.sqrt(2) * np.sqrt(abs(np.sin(10*theta)) 0.5)
x a * rho * np.sin(theta)
y a * rho * np.cos(theta)
plt.plot(x, y, linestyle solid)# label r$xa\rho sin\theta,ya\rho cos\theta, \rho \sqrt{2}sin{sin2\theta}$,plt.axis(equal)
# plt.legend()
plt.show()