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

# View of /trunk/pg/macros/Value.pl

Sun Jun 5 23:25:20 2005 UTC (14 years, 8 months ago) by dpvc
File size: 1424 byte(s)
```Allow for vectors to be marked as Column Vectors.
```

```    1 ###########################################################################
2 #
3 #  Declares functions needed for Value.pm
4 #
5
6 #
7 #  Constructors for the various types
8 #
9 sub String   {Value::String->new(@_)}
10 sub Real     {Value::Real->new(@_)}
11 sub Complex  {Value::Complex->new(@_)}
12 sub Point    {Value::Point->new(@_)}
13 sub Vector   {Value::Vector->new(@_)}
14 sub Matrix   {Value::Matrix->new(@_)}
15 sub List     {Value::List->new(@_)}
16 sub Interval {Value::Interval->new(@_)}
17 sub Union    {Value::Union->new(@_)}
18
19 sub ColumnVector {Value::Vector->new(@_)->with(ColumnVector=>1,open=>undef,close=>undef)}
20
21 # sub Formula  {Value::Formula->new(@_)}
22 #
23 # #
24 # #  Parse a formula and evaluate it
25 # #
26 # sub Compute {
27 #   my \$formula = Formula(shift);
28 #   return \$formula->eval(@_);
29 # }
30
31 #
32 # Make a point or list a closed interval
33 #
34 sub Closed {
35   my \$x = shift;
36   if (Value::isValue(\$x)) {\$x->{open} = '['; \$x->{close} = ']'}
37   return \$x;
38 }
39
40 ###########################################################################
41 #
42 #  Make it possible to use  1+3*i  in perl rather than  1+3*\$i or 1+3*i()
43 #
44 #sub i ()  {Value::Complex->i};   #  defined in Parser.pl
45 #sub pi () {Value::Complex->pi};  #  defined in dangerousMacros.pl
46
47 ###########################################################################
48