Angular Math methods
Two Java Math functions are used in accomplishing the
conversion process from degree to radians and vice versa.
·
Math.toDegrees
converts the given radian value to its degree equivalent value
·
Math.toRadians
converts the input degree value to its equivalent radian value
class java {
public static void main(String args[]) {
double a=3.14;
System.out.println("The degree
conversion output is");
System.out.println(Math.toDegrees(a));
double k=180;
System.out.println("The radians
conversion output is");
System.out.println(Math.toRadians(k));
}
}
Output
Trigonometric Math methods
These Math functions include Math.sin(), Math.cos(),
Math.tan() which is used to return sine, cosine and tangent values of the input
trigonometric variables. Math.asin(), Math.acos() and Math.atan() functions are
used to return Arc sine, Arc cosine and Arc Tangent values of the input double
variable.
class java {
public static void main(String args[]) {
double a=90;
double k=Math.toRadians(a);
System.out.println("The sine output is:");
System.out.println(Math.sin(k));
System.out.println("The cosine output is:");
System.out.println(Math.cos(k));
System.out.println("The tangent output is:");
System.out.println(Math.tan(k));
System.out.println("The arc sine output is:");
System.out.println(Math.asin(k));
System.out.println("The arc cosine output is:");
System.out.println(Math.acos(k));
System.out.println("The arc tangent output is:");
System.out.println(Math.atan(k));
}
Output
Hyperbolic Math methods
These set of Math functions include Math.sinh(), Math.cosh()
and Math.tanh() which return hyperbolic sine, cosine and tangent values
respectively.
class java {
public static void main(String args[]) {
double a=90;
double k=Math.toRadians(a);
System.out.println("The hyperbolic sine output is:");
System.out.println(Math.sinh(k));
System.out.println("The hyperbolic cosine output is:");
System.out.println(Math.cosh(k));
System.out.println("The hyperbolic tan output is:");
System.out.println(Math.tanh(k));
}
}
Output
PREVIOUS





0 Comments