[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 5145 - (download) (as text) (annotate)
Wed Jul 11 19:28:21 2007 UTC (12 years, 6 months ago) by gage
File size: 3195 byte(s)
More detailed doucmentation on MathObjects

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

aubreyja at gmail dot com
ViewVC Help
Powered by ViewVC 1.0.9