op.spad line 183 [edit on github]
This package exports functions to set some commonly used properties of operators, including properties which contain functions.
constantOpIfCan(op)
returns a
if op
is the constant nullary operator always returning a
, "failed" otherwise.
constantOperator(a)
returns a nullary operator op such that op()
always evaluate to a
.
derivative(op, [foo1, ..., foon])
attaches [foo1
, ..., foon] as the "%diff" property of op
. If op
has an "%diff" property [f1, ..., fn]
then applying a derivation D
to op(a1, ..., an)
returns f1(a1, ..., an) * D(a1) + ... + fn(a1, ..., an) * D(an)
.
derivative(op, foo)
attaches foo as the "%diff" property of op
. If op
has an "%diff" property f
, then applying a derivation D
to op
(a) returns f(a) * D(a)
. Argument op
must be unary.
derivative(op)
returns the value of the "%diff" property of op
if it has one, and "failed" otherwise.
evaluate(op, foo)
attaches foo as the "%eval" property of op
. If op
has an "%eval" property f
, then applying op
to a returns the result of f(a)
. Argument op
must be unary.
evaluate(op, foo)
attaches foo as the "%eval" property of op
. If op
has an "%eval" property f
, then applying op
to (a1, ..., an)
returns the result of f(a1, ..., an)
.
evaluate(op, [a1,...,an])
checks if op
has an "%eval" property f
. If it has, then f(a1, ..., an)
is returned, and "failed" otherwise.
evaluate(op)
returns the value of the "%eval" property of op
if it has one, and "failed" otherwise.