Posted in : Java Beginners

How to get inverse of trigonometric functions in java?

View Answers

May 18, 2012 at 2:37 PM

public class InverseTrigno { public static void main(String[] args) { double degrees = 30; double radians = Math.toRadians(degrees); double sin, cos, tan; sin=Math.sin(radians); cos=Math.cos(radians); tan=Math.tan(radians); System.out.format("Value of Sin%.0f " + "degrees is %.4f%n", degrees, sin); System.out.format("Value of Cos%.0f " + "degrees is %.4f%n", degrees, cos); System.out.format("Value of Tan%.0f " + "degrees is %.4f%n", degrees, tan); System.out.format("Inverse of Sin%.0f " + " is %.0f%n", degrees, Math.toDegrees(Math.asin(sin))); System.out.format("Inverse of Cos%.0f " + "is %.0f%n", degrees, Math.toDegrees(Math.acos(cos))); System.out.format("Inverse of tan%.0f " + "is %.0f%n", degrees, Math.toDegrees(Math.atan(tan))); } }

*output:*

Value of Sin30 degrees is 0.5000 Value of Cose30 degrees is 0.8660 Value of Tan30 degrees is 0.5774 Inverse of Sin30 is 30 Inverse of Cose30 is 30 Inverse of tan30 is 30

** Description:** The basic Trigonometric functions are sin, cos and tan. Inverse of these functions
are called arc sine ,arc cos and arc tan.In Math library it is represented as asin(),acos(),atan().

toRadians(angel)?It converts an angle measured in degrees to an approximately equivalent angle measured in radians. toDegrees(angel) ? it converts an angle measured in radians to an approximately equivalent angle measured in degrees. sin() : Returns the trigonometric sine of an angle. cos() : Returns the trigonometric cosine of an angle. tan() : Returns the trigonometric tangent of an angle. asin(): It returns the arc sine of the specified double value. acos(): It returns the arc cosine of the specified double value. atan(): It returns the arc tangent of the specified double value.

Related Tutorials/Questions & Answers:

- Java Tutorials
- Java Code example
- Java Programming
- Java Beginners Examples
- Applet Tutorials
- Awt Tutorials
- Java Certification
- Interview Question
- Java Servlets Tutorial
- Jsp Tutorials
- Java Swing Tutorials
- JDBC Tutorial
- EJB Tutorials
- Java Server Faces (JSF) Tutorial
- WAP Tutorial
- Struts Tutorial
- JAXB Tutorial
- Spring FrameWork Tutorial
- SOA&Web Services Tutorials
- Bioinformatics Tutorials
- MySQL Tutorials
- JAVA DOM Tutorial
- XML Tutorial
- EAI Articles
- Many Programming Tutorials Links
- Tutorials Books
**Java Script Tutorial****Ajax Tutorial****Dojo Tutorials****Programming Books****Trainings****Flex****Ant****RDF**