Python中的参数方程问题

2024-09-29 06:30:35 发布

您现在位置:Python中文网/ 问答频道 /正文

我试图确定一个半径为r的圆上的点x,y,我想应用参数方程,如: https://www.mathopenref.com/coordparamcircle.html

import math

radius = 45
t = 10

x = radius*math.cos(t)
y = radius*math.sin(t)

对于x和y,我得到以下输出:

x
Out[217]: 5.253219888177298

y
Out[218]: 8.509035245341185

我不明白为什么。据我所知,如果r是45,x和y应该有相同的值。知道吗


Tags: httpsimportcom参数htmlwww半径math
1条回答
网友
1楼 · 发布于 2024-09-29 06:30:35

注意这里t是10

当t的输入是45度时,它们应该给你相同的值。你必须把它们转换成弧度

import math

radius = 10
t = 45

x = radius*math.cos(math.radians(t))
y = radius*math.sin(math.radians(t))
print(x,y)

给了我们

7.07106781187 7.07106781187

相关问题 更多 >