Welcome to collectivesolver - Programming & Software Q&A with code examples. A website with trusted programming answers. All programs are tested and work.

Contact: aviboots(AT)netvision.net.il

Buy a domain name - Register cheap domain names from $0.99 - Namecheap

Scalable Hosting That Grows With You

Secure & Reliable Web Hosting, Free Domain, Free SSL, 1-Click WordPress Install, Expert 24/7 Support

Semrush - keyword research tool

Boost your online presence with premium web hosting and servers

Disclosure: My content contains affiliate links.

39,926 questions

51,859 answers

573 users

How to use trigonometric math methods in Java

1 Answer

0 votes
public class MyClass {
    public static void main(String args[]) {
       System.out.println("1) " + Math.toDegrees(Math.PI /2));
       System.out.println("2) " + Math.toDegrees(Math.PI /4));
       
       System.out.println("3) " + Math.toRadians(30));
       System.out.println("4) " + Math.toRadians(36));
       
       System.out.println("5) " + Math.sin(0));
       System.out.println("6) " + Math.sin(Math.toRadians(180)));
       System.out.println("7) " + Math.sin(Math.PI / 2));
       System.out.println("8) " + Math.sin(Math.PI / 4));

       System.out.println("9) " + Math.cos(0));
       System.out.println("10) " + Math.cos(Math.PI / 2));
       System.out.println("11) " + Math.cos(Math.PI / 4));
       
       System.out.println("12) " + Math.asin(0.5));
       System.out.println("13) " + Math.asin(1));
       
       System.out.println("14) " + Math.acos(0.5));
       System.out.println("15) " + Math.acos(1));
       
       System.out.println("16) " + Math.atan(0.5));
       System.out.println("17) " + Math.atan(1.0));
    }
}



/*
run:

1) 90.0
2) 45.0
3) 0.5235987755982988
4) 0.6283185307179586
5) 0.0
6) 1.2246467991473532E-16
7) 1.0
8) 0.7071067811865475
9) 1.0
10) 6.123233995736766E-17
11) 0.7071067811865476
12) 0.5235987755982989
13) 1.5707963267948966
14) 1.0471975511965979
15) 0.0
16) 0.4636476090008061
17) 0.7853981633974483

*/

 



answered Jun 10, 2019 by avibootz

Related questions

1 answer 207 views
207 views asked Jun 11, 2019 by avibootz
1 answer 192 views
192 views asked Jun 10, 2019 by avibootz
1 answer 161 views
1 answer 117 views
1 answer 117 views
1 answer 123 views
...