python - Python简单绘图中这条线的方程是什么?

标签 python python-3.x plot graphing

请帮我算出这条线的方程式是什么:

import matplotlib.pyplot as plt
import numpy as np

#start, stop, num (* is args [positional], ** is kwargs[keyword])
x = np.linspace(0, 2*np.pi, 400)
y = np.sin(x ** 2)

#this closes *args
plt.close('all')

#one figure and one subplot
f, ax = plt.subplots()
ax.plot(x,y)
ax.set_title("simple plot")
plt.xlabel('x-axis')
plt.ylabel('y-axis')
plt.show()

代码运行,并发送回一个图表,但我无法弄清楚该图表的方程是什么。请帮助我,如果您能解释一下代码是如何绘制该方程的。我对 python 很陌生。 :)谢谢!

最佳答案

x**2 在 Python 中表示 x 的 2 次方。在其他编程语言中,它通常被标记为x^2。所以你的函数是y = sin(x*x)

关于python - Python简单绘图中这条线的方程是什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52993503/

相关文章:

python - 从模块访问全局变量

python - 这个 for 循环如何处理以下字符串?

python - 使用 Python 从 .swf 中提取视频

python - Django 1.9 教程 __str__ () 不工作

r - eulerr 包中的调色板

matlab - 如何在 Matlab 绘图中遮蔽水平线和曲线之间的区域

Python Scrapy Parse 提取的链接与另一个函数

mysql - JSON/MySQL : list indices must be integers or slices, 不是 str

python - 字典查询Python?

r - 图 R |如何为每个节点添加第二个内圈?