home *** CD-ROM | disk | FTP | other *** search
/ Simtel MSDOS - Coast to Coast / simteldosarchivecoasttocoast2.iso / calculat / sm30a.zip / SYMBMATH.H34 < prev    next >
Text File  |  1993-11-07  |  2KB  |  51 lines

  1.                    4.2.2 Comparising and testing numbers
  2.     You can compare two numbers by relational operators
  3.                 a > b
  4.                 a < b
  5.                 a <= b
  6.                 a >= b
  7.                 a <> b
  8.                 a == b
  9.  
  10.     Example 4.2.5.
  11. IN:  2 > 1, 2 < 1
  12. OUT: 1, 0
  13.  
  14.         You also can compare two numbers, even complex numbers z1 and z2 by
  15.                 islarger(z1, z2)
  16.                 isless(z1, z2)
  17.                 issame(z1, z2)
  18.  
  19.         Example 4.2.6.
  20.         compare 1+i and 1-i.
  21. IN:  islarger(1+i, 1-i)         # is 1+i larger than 1-i ?
  22. OUT: 1                          # yes, 1+i > 1-i
  23.  
  24.         You can compare squre of a variable a^2 > 0 if you know the
  25. property of the variable.
  26.         Example 4.2.7.     
  27. IN:  assume(a > 0)
  28. IN:  a^2 > 0, 1/a > 0
  29. OUT: 1, 1
  30.  
  31.         You can test if x is even, odd, integer, real, number or list by
  32. the is* functions:
  33.                     iseven(x)
  34.                     isodd(x)
  35.                     isinteger(x)
  36.                     isreal(x)
  37.                     isnumber(x)
  38.                     islist(x)
  39.                     isfree(y,x)
  40.                     islarger(a,b)
  41.                     isless(a,b)
  42.                     issame(a,b)
  43.  
  44.         Example:
  45. IN:  iseven(2)          # is 2 even ?
  46. OUT: 1                  # yes
  47.  
  48.         Note that comparison by the is* functions return either 1 if it is
  49. true or 0 otherwise, but comparison by relational operators gives 1 if it
  50. is true, 0 if it is fault, or left unevaluated otherwise.
  51.