[system] / trunk / pg / macros / Value.pl Repository: Repository Listing bbplugincoursesdistsnplrochestersystemwww # Diff of /trunk/pg/macros/Value.pl

Revision 5372 Revision 5373
1 1
2 2
4 4
5# 5 #
6# Declares constructors for MathObjects 6 # Declares constructors for MathObjects
7 #
7 8
8=cut 9=cut
9 10
10=head3 Constructors for the various Mathobject types 11=head3 Constructors for the various Mathobject types
11 12
12=pod 13=pod
13 14
15MathObjects are objects which behave much like you would expect
16their true mathematical counterparts to behave.
14 17
15
16MathObjects are objects which behave much like you would expect
17their true mathematical counterparts to behave.
18
19MathObject types (classes) -- defined in Value.pl 18MathObject types (classes) -- defined in Value.pl
20 19
21 Standard 20 Standard
22 Real 21 Real
23 Behave like real numbers 22 Behave like real numbers
47 Complex object whose output is one of the MathObject values 46 Complex object whose output is one of the MathObject values
48 listed above. 47 listed above.
49 A formula object contains a parse tree inside it which allows 48 A formula object contains a parse tree inside it which allows
50 you to calculate output values from given input values. 49 you to calculate output values from given input values.
51 This MathObject is more complicated than the ones above. 50 This MathObject is more complicated than the ones above.
52 51
53Constructing MathObjects 52Constructing MathObjects
54 \$a = Real(3.5); 53 \$a = Real(3.5);
55 \$a = Real("345/45"); 54 \$a = Real("345/45");
56 \$c = Complex(5,4); 55 \$c = Complex(5,4);
57 \$c = Complex("5+4i"); 56 \$c = Complex("5+4i");
78 77
79# sub Formula {Value->Package("Formula")->new(@_)} # in Parser.pl 78# sub Formula {Value->Package("Formula")->new(@_)} # in Parser.pl
80 79
82 81
83# 82 #
84# Make a point or list a closed interval. 83 # Make a point or list a closed interval.
86# 85 #
87 86
88=cut 87=cut
89 88
90sub Closed { 89sub Closed {
91 my \$x = shift; 90 my \$x = shift;
97 96
98 ########################################################################### 97 ###########################################################################
99 # 98 #
100 # Make it possible to use 1+3*i in perl rather than 1+3*\$i or 1+3*i() 99 # Make it possible to use 1+3*i in perl rather than 1+3*\$i or 1+3*i()
101 # as well as 3*pi instead of 3*pi() 100 # as well as 3*pi instead of 3*pi()
102 101
103 #sub i () {Value->Package("Complex")->i}; # defined in Parser.pl 102 #sub i () {Value->Package("Complex")->i}; # defined in Parser.pl
104 #sub pi () {Value->Package("Complex")->pi}; # defined in dangerousMacros.pl 103 #sub pi () {Value->Package("Complex")->pi}; # defined in dangerousMacros.pl
105 #sub Infinity () {Value->Package("Infinity")->new()} # defined in dangerousMacros.pl 104 #sub Infinity () {Value->Package("Infinity")->new()} # defined in dangerousMacros.pl
106
107 105
108=cut 106=cut
109 107