[system] / trunk / pg / macros / contextPeriodic.pl Repository:
ViewVC logotype

Diff of /trunk/pg/macros/contextPeriodic.pl

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

Revision 4966 Revision 4967
1=head1 contextPeriodic.pl
2
3The features in this file will probably be added to the Real and
4Complex contexts in the future and this file will not be needed.
5
6=cut
7
8=head3 RealPeriodic
9
10 usage Context("RealPeriodic");
11 $a = Real("pi/2")->with(period=>pi);
12 $a->cmp # will match pi/2, 3pi/2 etc.
13
14=cut
15
16
17
1package RealPeriodic; 18package RealPeriodic;
2@ISA = ("Value::Real"); 19@ISA = ("Value::Real");
3 20
4sub new { 21sub new {
5 my $self = shift; my $class = ref($self) || $self; 22 my $self = shift; my $class = ref($self) || $self;
27 my $n = int($m); $n-- if $n > $m; # act as floor() rather than int() 44 my $n = int($m); $n-- if $n > $m; # act as floor() rather than int()
28 return $a - $n*$b; 45 return $a - $n*$b;
29} 46}
30 47
31sub isReal {1} 48sub isReal {1}
49
50=head3 ComplexPeriodic
51
52 usage Context("ComplexPeriodic");
53 $z0 = Real("i^i")->with(period=>2pi, logPeriodic=>1);
54 $z0->cmp # will match exp( i (ln(1) + Arg(pi/2)+2k pi ) )
55
56=cut
32 57
33 58
34package ComplexPeriodic; 59package ComplexPeriodic;
35@ISA = ("Value::Complex"); 60@ISA = ("Value::Complex");
36 61

Legend:
Removed from v.4966  
changed lines
  Added in v.4967

aubreyja at gmail dot com
ViewVC Help
Powered by ViewVC 1.0.9