BasicOperatorFunctions1 A

op.spad line 183 [edit on github]

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 that op() always evaluate to a.

constantOpIfCan: BasicOperator -> Union(A, failed)

constantOpIfCan(op) returns a if op is the constant nullary operator always returning a, “failed” otherwise.

derivative: (BasicOperator, A -> A) -> BasicOperator

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: (BasicOperator, List(List A -> A)) -> BasicOperator

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: BasicOperator -> Union(List(List A -> A), failed)

derivative(op) returns the value of the “%diff” property of op if it has one, and “failed” otherwise.

evaluate: (BasicOperator, A -> A) -> BasicOperator

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: (BasicOperator, List A -> A) -> BasicOperator

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: (BasicOperator, List A) -> Union(A, failed)

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: BasicOperator -> Union(List A -> A, failed)

evaluate(op) returns the value of the “%eval” property of op if it has one, and “failed” otherwise.