java - Does trigonometry need some library -


i trying run code nothing get..is wrong code or compiler? can point me still new on java

public class mathtrigonometricexample {     public static void main(string[] args) {         double radians = 45.0;          double sine = math.sin(radians);         system.out.println("the sin of " + radians + " = " + sine);          double cosine = math.cos(radians);         system.out.println("the cos of " + radians + " = " + cosine);          double tan = math.tan(radians);         system.out.println("the tan of " + radians + " = " + tan);          double asine = math.asin(sine);         system.out.println("arcsine of " + sine + " = " + asine);          double acosine = math.acos(cosine);         system.out.println("arccosine of " + cosine + " = " + acosine);          double atan = math.atan(tan);         system.out.println("arctangent of " + tan + " = " + atan);          double sinh = math.sinh(radians);         system.out.println("hyperbolic sine of " + radians + " = " + sinh);          double cosh = math.cosh(radians);         system.out.println("hyperbolic cos of " + radians + " = " + cosh);          double tanh = math.tanh(radians);         system.out.println("hyperbolic tan of " + radians + " = " + tanh);     } } 

the tri functions take radians, not degrees. 45.0 looks degrees, whereas math.pi/4 looks radians.

the answer is, can use built in libraries, provided use radians. if need convert degrees radian can sue following.

double degress = 45.0; double radians = degress * math.pi / 180; 

exception in thread "main java.lang.noclssdeffounderror: mathtrygonometric example(wrong name : cin/java/connect/math/mathtrigonometricexample)

this suggests trying run wrong class name. when asking question worth including relevant error messages cannot read mind. ;)

i suggest use ide make editing, compiling , running program easier.


Comments

Popular posts from this blog

Hatching array of circles in AutoCAD using c# -

ios - UITEXTFIELD InputView Uipicker not working in swift -

Python Pig Latin Translator -