home *** CD-ROM | disk | FTP | other *** search
-
- (*********************************************************************
-
- Adapted from
- Roman E. Maeder: Programming in Mathematica,
- Second Edition, Addison-Wesley, 1991.
-
- *********************************************************************)
-
-
- AlgExpQ::usage = "AlgExpQ[expr] returns true if expr is an algebraic expression."
-
- Begin["`Private`"]
-
- SetAttributes[AlgExpQ, Listable]
-
- AlgExpQ[ _Integer ] = True
- AlgExpQ[ _Rational ] = True
- AlgExpQ[ c_Complex ] := AlgExpQ[Re[c]] && AlgExpQ[Im[c]]
- AlgExpQ[ _Symbol ] = True
-
- AlgExpQ[ a_ + b_ ] := AlgExpQ[a] && AlgExpQ[b]
- AlgExpQ[ a_ * b_ ] := AlgExpQ[a] && AlgExpQ[b]
- AlgExpQ[ a_ ^ b_Integer ] := AlgExpQ[a]
- AlgExpQ[ a_ ^ b_Rational ] := AlgExpQ[a]
-
- AlgExpQ[_] = False
-
- End[]
-
- Null
-