Maxima Function
constantp (expr)
Returns true
if expr is a constant expression,
otherwise returns false
.
An expression is considered a constant expression if its arguments are
numbers (including rational numbers, as displayed with /R/
),
symbolic constants such as %pi
, %e
, and %i
,
variables bound to a constant or declared constant by declare
,
or functions whose arguments are constant.
constantp
evaluates its arguments.
Examples:
(%i1) constantp (7 * sin(2)); (%o1) true (%i2) constantp (rat (17/29)); (%o2) true (%i3) constantp (%pi * sin(%e)); (%o3) true (%i4) constantp (exp (x)); (%o4) false (%i5) declare (x, constant); (%o5) done (%i6) constantp (exp (x)); (%o6) true (%i7) constantp (foo (x) + bar (%e) + baz (2)); (%o7) false (%i8)