Python Forum
How to find the cosine of an angle
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to find the cosine of an angle
#1
my question here:Hi all. I have not received my book yet, so I am unable to go on.

#file2.py
#module
# Import built-in module math
import math#the module is 'math'

content = dir(math)

print(content)

y=cos(pi/6)#NameError: 'cos' is not defined
z=math.y
print(z)
Reply
#2
import math

r = 2.13493356 

cos = math.cos(x) # the argument is radians

print(cos)
Output:
-0.5346869338289935
"As they say in Mexico 'dosvidaniya'. That makes two vidaniyas."
https://freedns.afraid.org
Reply
#3
Thanks, it works well. So r is an angle.For the coded tag I first begun with "copy as plain'text'" It is in the options of Edit of in pyCharm...For paste I go in the middle of your string. Right click, press 'paste'
Reply
#4
(May-25-2017, 03:43 PM)sylas Wrote: For paste I go in the middle of your string
you need to remove the placeholder text - delete it before paste or select it and then paste
Reply
#5
I go in the middle of the string, "code, here code'. I don't remember exactly this string. I right click, Between the options ypu have "paste". I choose that, press it,, and it is OK. Nowhere a "delete"
Reply
#6
I mean, delete text 'your code here'. It is just a placeholder for your code - as a hint where to paste your code.
I edited your first, because your code has been paste between 'your code' and 'here'
Reply
#7
I will try again on my next file.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  smallest Cosine distance in Graph vino689 3 2,328 Jan-12-2020, 08:06 AM
Last Post: rmspacedashrf
  How to map 360 degree angle over 1024 counts breadcat248 3 2,509 May-17-2019, 07:13 AM
Last Post: breadcat248
  Converting Angle to X and Y Values: 90/180/270 deg qrani 1 2,770 Nov-21-2018, 06:41 PM
Last Post: woooee
  finding angle between three points on a 2d graph qrani 4 14,093 Nov-20-2018, 06:10 AM
Last Post: Gribouillis
  Angle kripso 12 32,028 Oct-30-2017, 11:33 PM
Last Post: kripso

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020