home | O'Reilly's CD bookshelfs | FreeBSD | Linux | Cisco | Cisco Exam  


Book Home Programming PerlSearch this book

32.34. Math::Trig

use Math::Trig;

$x = tan(0.9);
$y = acos(3.7);
$z = asin(2.4);

$halfpi = pi/2;

$rad = deg2rad(120);
Perl itself defines only three trigonometric functions: sin, cos, and atan2. The Math::Trig module overrides these with fancier versions and supplies all the rest of the trig functions, including tan, csc, cosec, sec, cot, cotan, asin, acos, atan, sinh, cosh, tanh, and many others. Additionally, the constant pi is defined, as are conversion functions like deg2rad and grad2rad. Support is provided for Cartesian, spherical, and cylindrical coordinates systems. This module makes implicit use of Math::Complex as needed (and vice versa) for computations requiring imaginary numbers.



Library Navigation Links

Copyright © 2001 O'Reilly & Associates. All rights reserved.