Python is the fastest growing programming language in the 21st century.
Before one can perform trigonometric mathematical calculations, he or she must follow the following steps
1. Import the maths module in python. To import the math module, one can import in the following ways,
import math
From math import *
Or he or she can import a specific function in the math module like, from math import sin, cos
2. Once you have imported the maths module into python, you can then go ahead and perform your operation. E.g You want to find cos(90) in degrees.
3. Since when you do the calculation directly like math.cos(90) will give you an answer in radian, we will then do the following rather,
We will call both the radians and the cos from the maths module as follows
math.cos(math.radians(90)).
In this case, the answer will be given in degrees but to many decimal places.
5. So the last operation we will perform is the round function.
That is, round (math.cos(math.radians(90)),4). This will round it to 4 decimal places
If you have any ways don't hesitate to share it. All your comments are also welcomed


No comments:
Post a Comment