Java Reference
In-Depth Information
/** Convert the angle in degrees to an angle in radians */
public static double toRadians( double degree)
/** Convert the angle in radians to an angle in degrees */
public static double toDegrees( double radians)
/** Return the angle in radians for the inverse of sin */
public static double asin( double a)
/** Return the angle in radians for the inverse of cos */
public static double acos( double a)
/** Return the angle in radians for the inverse of tan */
public static double atan( double a)
The parameter for sin , cos , and tan is an angle in radians. The return value for asin , acos , and
atan is a degree in radians in the range between
-
p /2
and
p /2.
One degree is equal to
p /180
in radians, 90 degrees is equal to
p /2
in radians, and 30 degrees is equal to
p /6
in radians.
For example,
Math.toDegrees(Math.PI / 2 ) returns 90.0
Math.toRadians( 30 ) returns 0.5236 ( same as π /6)
Math.sin( 0 ) returns 0.0
Math.sin(Math.toRadians( 270 )) returns -1.0
Math.sin(Math.PI / 6 ) returns 0.5
Math.sin(Math.PI / 2 ) returns 1.0
Math.cos( 0 ) returns 1.0
Math.cos(Math.PI / 6 ) returns 0.866
Math.cos(Math.PI / 2 ) returns 0
Math.asin( 0.5 ) returns 0.523598333 (same as π /6 )
5.10.2 Exponent Methods
There are five methods related to exponents in the Math class:
/** Return e raised to the power of x (e x ) */
public static double exp( double x)
/** Return the natural logarithm of x (ln(x) = log e (x)) */
public static double log( double x)
/** Return the base 10 logarithm of x (log 10 (x)) */
public static double log10( double x)
/** Return a raised to the power of b (a b ) */
public static double pow( double a, double b)
/** Return the square root of x
for x >= 0 */
2 x
public static double sqrt( double x)
For example,
Math.exp( 1 ) returns 2.71828
Math.log(Math.E) returns 1.0
Math.log10( 10 ) returns 1.0
Math.pow( 2 , 3 ) returns 8.0
Math.pow( 3 , 2 ) returns 9.0
Math.pow( 3.5 , 2.5 ) returns 22.91765
 
Search WWH ::




Custom Search