Find sine of angle or sine inverse Java

sin(double a) method can be used to find sine of an angle and asin(double a) method can be used to find sine inverse or arc sine of a value in Java.

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


sin(double a)

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

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

Example

class MathTest{

public static void main(String args[]){

double angle=1.0472;

double sinoa=Math.sin(angle);

System.out.println("Sine of the angle is "+sinoa);

}

}

Output

Sine of the angle is 0.8660266281835431


asin(double a)

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

Parameter 'a' value should be the value whose arc sine is to be determined. The method returns the sine 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 value=1;

double asinov=Math.asin(value);

System.out.println("Sine inverse or arc sine of the value is "+asinov);

}

}

Output

Sine inverse or arc sine of the value is 1.5707963267948966