Find tan of angle or tan inverse Java

tan(double a) method can be used to find the tangent of an angle and atan(double a) method can be used to find the tangent inverse or arc tangent of a value in Java.

tan(double a) and atan(double a) methods belongs to the Math class of java.lang package and both are static, so it can be called directly using class name without creating object.


tan(double a)

static double tan(double a) method since it is static we can call directly using class name Math. e.g Math.tan(60).

Parameter 'a' value should be the angle in radians. The method returns the tan value of the angle.

Example

class MathTest{

public static void main(String args[]){

double angle=1.042;

double tanoa=Math.tan(angle);

System.out.println("tan of the angle is "+tanoa);

}

}

Output

tan of the angle is 0.8634149422749642


atan(double a)

static double atan(double a) method is used to find the tan inverse of the value. Since it is static we can call directly using class name Math. e.g Math.atan(1).

Parameter 'a' value should be the value whose tan inverse or arc tan is to be determined. The method returns the tan inverse of the value in radians.

Returned value will be between -pi/2 and pi/2.

Example

class MathTest{

public static void main(String args[]){

double val1=0;

double atanov=Math.atan(val1);

System.out.println("tan inverse or arc tan of the value is "+atanov);

}

}

Output

tan inverse or arc tan of the value is 0.0