Skip to content

Defining Functions

gray edited this page Sep 7, 2024 · 1 revision

In this library, anonymous functions are your friend. In adhocCAS, they are defined in two ways:

Univariate functions

Univariate functions are a simple anonymous function. Let's use an example:

derivative(lambda x: x**2, 2)

Univariate functions take one number as an argument, and they return one number.

Multivariate functions

Multivariate functions take a list containing arguments.

partialDerivative(lambda x: x[0]**2 + x[1]**2,[7,2],2)

The anonymous function I defined has two input variables. You can think of x[0] as x, and x[1] as y.

Clone this wiki locally