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)returnsaifopis the constant nullary operator always returninga, “failed” otherwise.
- derivative: (BasicOperator, A -> A) -> BasicOperator
derivative(op, foo)attaches foo as the “%diff” property ofop. Ifophas an “%diff” propertyf, then applying a derivationDtoop(a) returnsf(a) * D(a). Argumentopmust be unary.
- derivative: (BasicOperator, List(List A -> A)) -> BasicOperator
derivative(op, [foo1, ..., foon])attaches [foo1, …, foon] as the “%diff” property ofop. Ifophas an “%diff” property[f1, ..., fn]then applying a derivationDtoop(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 ofopif it has one, and “failed” otherwise.
- evaluate: (BasicOperator, A -> A) -> BasicOperator
evaluate(op, foo)attaches foo as the “%eval” property ofop. Ifophas an “%eval” propertyf, then applyingopto a returns the result off(a). Argumentopmust be unary.
- evaluate: (BasicOperator, List A -> A) -> BasicOperator
evaluate(op, foo)attaches foo as the “%eval” property ofop. Ifophas an “%eval” propertyf, then applyingopto(a1, ..., an)returns the result off(a1, ..., an).
- evaluate: (BasicOperator, List A) -> Union(A, failed)
evaluate(op, [a1,...,an])checks ifophas 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 ofopif it has one, and “failed” otherwise.