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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 5373 - (download) (as text) (annotate)
Sun Aug 19 02:01:57 2007 UTC (12 years, 3 months ago) by dpvc
File size: 3175 byte(s)
Normalized comments and headers to that they will format their POD
documentation properly.  (I know that the POD processing was supposed
to strip off the initial #, but that doesn't seem to happen, so I've
added a space throughout.)

    1 
    2 
    3 =head1 DESCRIPTION
    4 
    5  #
    6  #  Declares constructors for MathObjects
    7  #
    8 
    9 =cut
   10 
   11 =head3 Constructors for the various Mathobject types
   12 
   13 =pod
   14 
   15 MathObjects are objects which behave much like you would expect
   16 their true mathematical counterparts to behave.
   17 
   18 MathObject types (classes) -- defined in Value.pl
   19 
   20     Standard
   21         Real
   22               Behave like real numbers
   23         Infinity
   24               Extended real numbers (infinities)  -- Also complex
   25               numbers???
   26             infinity
   27             - infinity
   28             infinite (either plus or minus infinity)
   29         Complex
   30               Behave like complex numbers.  The interpretations of plus
   31               and times are those standardly used for mathematical
   32               complex numbers
   33     List objects -- which means that they involve delimiters
   34       (parentheses) of some type.
   35         Point
   36         Vector
   37         Matrix
   38         List
   39     Subsets of Reals
   40         Intervals
   41         Sets (finite collections of points
   42         Union (of intervals and sets)
   43     String   -- special purpose
   44           Allows comparison with a string
   45     Formula -- roughly a function with values as defined above.
   46         Complex object whose output is one of the MathObject values
   47           listed above.
   48         A formula object contains a parse tree inside it which allows
   49           you to calculate output values from given input values.
   50         This MathObject is more complicated than the ones above.
   51 
   52 Constructing MathObjects
   53   $a = Real(3.5);
   54   $a = Real("345/45");
   55   $c = Complex(5,4);
   56   $c = Complex("5+4i");
   57 
   58 See Value.pm for MathObject methods
   59 
   60 See Parser.pm for information on turning strings into MathObjects.
   61 
   62 =cut
   63 
   64 
   65 sub String   {Value->Package("String")->new(@_)}
   66 sub Real     {Value->Package("Real")->new(@_)}
   67 sub Complex  {Value->Package("Complex")->new(@_)}
   68 sub Point    {Value->Package("Point")->new(@_)}
   69 sub Vector   {Value->Package("Vector")->new(@_)}
   70 sub Matrix   {Value->Package("Matrix")->new(@_)}
   71 sub List     {Value->Package("List")->new(@_)}
   72 sub Interval {Value->Package("Interval")->new(@_)}
   73 sub Set      {Value->Package("Set")->new(@_)}
   74 sub Union    {Value->Package("Union")->new(@_)}
   75 
   76 sub ColumnVector {Value->Package("Vector")->new(@_)->with(ColumnVector=>1,open=>undef,close=>undef)}
   77 
   78 # sub Formula  {Value->Package("Formula")->new(@_)}  # in Parser.pl
   79 
   80 =head3 Closed($point)
   81 
   82  #
   83  #  Make a point or list a closed interval.
   84  #  (Obsolete: use $x->with(open=>'[',close=>']') instead.)
   85  #
   86 
   87 =cut
   88 
   89 sub Closed {
   90   my $x = shift;
   91   if (Value::isValue($x)) {$x->{open} = '['; $x->{close} = ']'}
   92   return $x;
   93 }
   94 
   95 =head3 NOTE:
   96 
   97  ###########################################################################
   98  #
   99  #  Make it possible to use  1+3*i  in perl rather than  1+3*$i or 1+3*i()
  100  #  as well as 3*pi instead of 3*pi()
  101 
  102  #sub i ()  {Value->Package("Complex")->i};   #  defined in Parser.pl
  103  #sub pi () {Value->Package("Complex")->pi};  #  defined in dangerousMacros.pl
  104  #sub Infinity () {Value->Package("Infinity")->new()} # defined in dangerousMacros.pl
  105 
  106 =cut
  107 
  108 sub _Value_init {};  # don't let loadMacros load it again
  109 
  110 ###########################################################################
  111 
  112 1;

aubreyja at gmail dot com
ViewVC Help
Powered by ViewVC 1.0.9