1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82
|
=head1 NAME
PDL::Constants -- basic compile time constants for PDL
=head1 DESCRIPTION
This module is used to define compile time constant
values for PDL. It uses Perl's L<constant> pragma for
simplicity and availability.
=head1 SYNOPSIS
use PDL::Constants qw(PI E);
print 'PI is ' . PI . "\n";
print 'E is ' . E . "\n";
=cut
package PDL::Constants;
our $VERSION = "0.02";
$VERSION = eval $VERSION;
require Exporter;
@ISA = qw(Exporter);
@EXPORT_OK = qw(PI DEGRAD E I J); # symbols to export
use PDL::Lite;
use PDL::Complex qw(i);
=head2 PI
The ratio of a circle's circumference to its diameter
=cut
use constant PI => 4 * atan2(1, 1);
=head2 DEGRAD
The number of degrees of arc per radian (180/PI)
=cut
use constant DEGRAD => 180/PI;
=head2 E
The base of the natural logarithms or Euler's number
=cut
use constant E => exp(1);
=head2 I
The imaginary unit, C< I*I == -1 >
=cut
use constant I => i;
=head2 J
The imaginary unit for engineers, C< J*J == -1 >
=cut
use constant J => i;
=head1 COPYRIGHT & LICENSE
Copyright 2010 Chris Marshall (chm at cpan dot org).
This program is free software; you can redistribute it and/or modify it
under the terms of either: the GNU General Public License as published
by the Free Software Foundation; or the Artistic License.
See http://dev.perl.org/licenses/ for more information.
=cut
1;
|