Math class method is used for Trigonometric function in java. Trigonometric function like cosine, sine hyperbolic sine, arc sine can be used in java using math class methods

Math.method(Variable)

method can be replaced by any Trigonometric function

List Trigonometric function used in java

toDegrees(variable)

toDegrees Converts an angle measured in radians to an approximately equivalent angle measured in degrees.

toRadians(variable)

Converts an angle measured in degrees to an approximately equivalent angle measured in radians.

import java.util.Scanner;

class group{

public static void main(String angt[]){

Scanner data = new Scanner(System.in);

double num,num1;

System.out.println("Enter a number");

num1=data.nextDouble();

num=Math.cos(num1);

System.out.println("Answer:"+num);

num=Math.sinh(num1);

System.out.println("Answer:"+num);

num=Math.atan(num1);

System.out.println("Answer:"+num);

num=Math.toDegrees(num1);

System.out.println("Answer:"+num);

}

}

Enter a number

2

Answer:-0.4161468365471424

Answer:3.626860407847019

Answer:1.1071487177940904

Answer:114.59155902616465

Logarithm function in java

Java codes

List of Java Programs

**Syntax:-**Math.method(Variable)

method can be replaced by any Trigonometric function

List Trigonometric function used in java

Method | Operation | Datatype used |

Math.sin(variable) | sine | Double |

Math.cos(variable) | cosine | Double |

Math.tan(variable) | tan | Double |

Math.sinh(variable) | hyperbolic sine | Double |

Math.cosh(variable) | hyperbolic cosin | Double |

Math.tanh(variable) | hyperbolic tan | Double |

Math.asin(variable) | arc sine | Double |

Math.acos(variable) | arc cosine | Double |

Math.atan(variable) | arc tan | Double |

**Convert radians to degrees in java****Syntax:-**toDegrees(variable)

toDegrees Converts an angle measured in radians to an approximately equivalent angle measured in degrees.

**Convert degrees to radians in java****Syntax:-**toRadians(variable)

Converts an angle measured in degrees to an approximately equivalent angle measured in radians.

**Example:-**import java.util.Scanner;

class group{

public static void main(String angt[]){

Scanner data = new Scanner(System.in);

double num,num1;

System.out.println("Enter a number");

num1=data.nextDouble();

num=Math.cos(num1);

System.out.println("Answer:"+num);

num=Math.sinh(num1);

System.out.println("Answer:"+num);

num=Math.atan(num1);

System.out.println("Answer:"+num);

num=Math.toDegrees(num1);

System.out.println("Answer:"+num);

}

}

**Output:-**Enter a number

2

Answer:-0.4161468365471424

Answer:3.626860407847019

Answer:1.1071487177940904

Answer:114.59155902616465

**Previous Code:-**

Logarithm function in java

**List Code:-**

Java codes

**Next Code:-**

**Java Programs:-**

List of Java Programs

Great Article

ReplyDeleteOnline Java Training | Java EE course

Java Course in Chennai | Java Training in Chennai | Java Training Institutes in Chennai | J2EE Training in Chennai | java j2ee training institutes in chennai

Java 360 | IT Technical Articles |Java Training Institutes

You shared very useful post. Thanks for sharing.

ReplyDeletehtml training in chennai

Great Blog.......

ReplyDeleteBuzz For Android

careful voice reaction, is a what blessings telephone structures to process touch tones or voice waves amidst a phone call.

ReplyDeleteivr software

Nice blog. Thanks for sharing such a useful post.

ReplyDeleteWordpress development services in chennai

It’s always so sweet and also full of a lot of fun for me personally and my office colleagues to search your blog a minimum of thrice in a week to see the new guidance you have got.

ReplyDeletejava training in bangalore