omz:forum

    • Register
    • Login
    • Search
    • Recent
    • Popular

    Welcome!

    This is the community forum for my apps Pythonista and Editorial.

    For individual support questions, you can also send an email. If you have a very short question or just want to say hello — I'm @olemoritz on Twitter.


    [Solved] Wrong cosine? Why?

    Pythonista
    cosine
    3
    4
    1161
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • GiovaBici
      GiovaBici last edited by ccc

      Hello everybody. I would need to calculate the cosine of an angle. I used the math.cos () function, but the result I am getting is wrong. can anyone tell me why? thank you.
      I am attaching the text:

      import math
      print(math.cos(60))
      

      in the console, as a result, is:

      -0.9524129804151563

      Otherwise, can you tell me another method with which to calculate the cosine?
      Thank you

      1 Reply Last reply Reply Quote 0
      • ccc
        ccc last edited by ccc

        RTFM... https://docs.python.org/3/library/math.html#math.cos Return the cosine of x radians.

        https://www2.clarku.edu/faculty/djoyce/trig/cosines.html

        cvp 1 Reply Last reply Reply Quote 0
        • cvp
          cvp @ccc last edited by

          @ccc said:

          returns its results in radians

          The angle has to be given in radians but cos returns a number between -1 and +1

          1 Reply Last reply Reply Quote 0
          • GiovaBici
            GiovaBici last edited by

            thank you so much. I had foolishly forgotten ...

            1 Reply Last reply Reply Quote 0
            • First post
              Last post
            Powered by NodeBB Forums | Contributors