BasicOperatorFunctions1 A¶
op.spad line 183 [edit on github]
A: SetCategory
This package exports functions to set some commonly used properties of operators, including properties which contain functions.
- constantOperator: A -> BasicOperator
constantOperator(a)
returns a nullary operator op such thatop()
always evaluate toa
.
- constantOpIfCan: BasicOperator -> Union(A, failed)
constantOpIfCan(op)
returnsa
ifop
is the constant nullary operator always returninga
, “failed” otherwise.
- derivative: (BasicOperator, A -> A) -> BasicOperator
derivative(op, foo)
attaches foo as the “%diff” property ofop
. Ifop
has an “%diff” propertyf
, then applying a derivationD
toop
(a) returnsf(a) * D(a)
. Argumentop
must be unary.
- derivative: (BasicOperator, List(List A -> A)) -> BasicOperator
derivative(op, [foo1, ..., foon])
attaches [foo1
, …, foon] as the “%diff” property ofop
. Ifop
has an “%diff” property[f1, ..., fn]
then applying a derivationD
toop(a1, ..., an)
returnsf1(a1, ..., an) * D(a1) + ... + fn(a1, ..., an) * D(an)
.
- derivative: BasicOperator -> Union(List(List A -> A), failed)
derivative(op)
returns the value of the “%diff” property ofop
if it has one, and “failed” otherwise.
- evaluate: (BasicOperator, A -> A) -> BasicOperator
evaluate(op, foo)
attaches foo as the “%eval” property ofop
. Ifop
has an “%eval” propertyf
, then applyingop
to a returns the result off(a)
. Argumentop
must be unary.
- evaluate: (BasicOperator, List A -> A) -> BasicOperator
evaluate(op, foo)
attaches foo as the “%eval” property ofop
. Ifop
has an “%eval” propertyf
, then applyingop
to(a1, ..., an)
returns the result off(a1, ..., an)
.
- evaluate: (BasicOperator, List A) -> Union(A, failed)
evaluate(op, [a1,...,an])
checks ifop
has an “%eval” propertyf
. If it has, thenf(a1, ..., an)
is returned, and “failed” otherwise.
- evaluate: BasicOperator -> Union(List A -> A, failed)
evaluate(op)
returns the value of the “%eval” property ofop
if it has one, and “failed” otherwise.