trig!
This commit is contained in:
parent
d111c64825
commit
26b04bba71
1 changed files with 22 additions and 0 deletions
22
python/calculators/Trigometric Functions.py
Normal file
22
python/calculators/Trigometric Functions.py
Normal file
|
@ -0,0 +1,22 @@
|
|||
from math import e
|
||||
from _helpers import floatInput
|
||||
|
||||
def sin(radians):
|
||||
x = radians
|
||||
return (((e ** (1j * x)) - (e ** -(1j * x))) / 2j).real
|
||||
|
||||
def cos(radians):
|
||||
x = radians
|
||||
return (((e ** (1j * x)) + (e ** -(1j * x))) / 2).real
|
||||
|
||||
def tan(radians):
|
||||
x = radians
|
||||
return (((e ** (1j * x)) - (e ** -(1j * x))) / (1j * ((e ** (1j * x)) + (e ** -(1j * x))))).real
|
||||
|
||||
a = floatInput("Please enter an amount of radians: ")
|
||||
|
||||
print("""Where x = %i:
|
||||
sin(x) = %f
|
||||
cos(x) = %f
|
||||
tan(x) = %f
|
||||
""" % (a, sin(a), cos(a), tan(a)))
|
Loading…
Reference in a new issue