【问题标题】:Calculation of a formula with Python's math library使用 Python 的数学库计算公式
【发布时间】:2022-07-04 15:00:18
【问题描述】:

enter image description here

根据包含公式的图片,我写了以下代码
但是我输入的数字是错误的

import math as m
x = int(input())
r=m.ceil(m.pow(x,(5/3))+m.tan(x))
y = m.floor(m.pow(m.pi, 2+m.atan(m.pow(m.sin(m.radians(x)), 2))))
print(m.gcd(r,y))

【问题讨论】:

    标签: python python-3.x math


    【解决方案1】:

    使用math.tan()时需要转换为弧度

    import math as m
    x = int(input())
    r=m.ceil(m.pow(x,(5/3))+m.tan(m.radians(x)))
    y = m.floor(m.pow(m.pi, 2+m.atan(m.pow(m.sin(m.radians(x)), 2))))
    print(m.gcd(r,y))
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2022-07-25
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-02-25
      相关资源
      最近更新 更多