Mathematical Library Methods
Mathematical Library Methods
methods
Angle conversions
• Two basic units of measuring angles: Degree and radians
• Angle conversion in Java refers to converting an angle from one unit
to another, typically between degrees and radians. These two units
are commonly used in trigonometric and mathematical calculations.
• In trigonometrical calculations we need to convert angles from degree
to radian and vice versa
• Java provides methods in the Math class for these conversions:
• 1. Degrees to Radians
• To convert degrees to radians, use the formula:
Or
radian= Math.PI/180*degree
Or
By using mathematical function
Math.toDegrees(double radians)
Input
Enter angle in degrees: 90
Enter angle in radians: 1.5708
output
Angle in radians: 1.5707963267948966
Angle in degrees: 89.99984796050427
Trigonometrical functions
• Java provides a rich set of trigonometric functions in the Math
class to perform various calculations.
• These methods operate on angles measured in radians (not
degrees).
• You can use the Math.toRadians() and Math.toDegrees() methods
to convert between radians and degrees as needed.
Angles in trigonometric functions are in radians, not
degrees.
Eg::
double val=Math.sin(angle);
To find an angle if trigonometrical
ratio is known
• The returned angle will be in radian you need to convert it into degree