1 | |
1 | |
2 | |
2 | |
3 | =head1 Value.pl DESCRIPTION |
3 | =head1 DESCRIPTION |
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 | |
|
|
15 | MathObjects are objects which behave much like you would expect |
|
|
16 | their true mathematical counterparts to behave. |
14 | |
17 | |
15 | |
|
|
16 | MathObjects are objects which behave much like you would expect |
|
|
17 | their true mathematical counterparts to behave. |
|
|
18 | |
|
|
19 | MathObject types (classes) -- defined in Value.pl |
18 | MathObject 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 | |
53 | Constructing MathObjects |
52 | Constructing 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 | |
81 | =head3 Closed($point) |
80 | =head3 Closed($point) |
82 | |
81 | |
83 | # |
82 | # |
84 | # Make a point or list a closed interval. |
83 | # Make a point or list a closed interval. |
85 | # (Obsolete: use $x->with(open=>'[',close=>']') instead.) |
84 | # (Obsolete: use $x->with(open=>'[',close=>']') instead.) |
86 | # |
85 | # |
87 | |
86 | |
88 | =cut |
87 | =cut |
89 | |
88 | |
90 | sub Closed { |
89 | sub 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 | |
110 | sub _Value_init {}; # don't let loadMacros load it again |
108 | sub _Value_init {}; # don't let loadMacros load it again |
111 | |
109 | |