This namespace implements a number of differential operators like D
, and
the machinery to apply D
to various structures.
This namespace implements a number of differential operators like [[D]], and the machinery to apply [[D]] to various structures.
(D f)
Derivative operator. Takes some function f
and returns a function whose value
at some point can multiply an increment in the arguments to produce the best
linear estimate of the increment in the function value.
For univariate functions, D
computes a derivative. For vector-valued
functions, D
computes
the Jacobian
of f
.
The related emmy.env/Grad
returns a function that produces a structure of
the opposite orientation as D
. Both of these functions use reverse-mode
automatic differentiation.
Derivative operator. Takes some function `f` and returns a function whose value at some point can multiply an increment in the arguments to produce the best linear estimate of the increment in the function value. For univariate functions, [[D]] computes a derivative. For vector-valued functions, [[D]] computes the [Jacobian](https://en.wikipedia.org/wiki/Jacobian_matrix_and_determinant) of `f`. The related [[emmy.env/Grad]] returns a function that produces a structure of the opposite orientation as [[D]]. Both of these functions use reverse-mode automatic differentiation.
(D-forward f)
Forward-mode derivative operator. Takes some function f
and returns a
function whose value at some point can multiply an increment in the arguments
to produce the best linear estimate of the increment in the function value.
For univariate functions, D-forward
computes a derivative. For vector-valued
functions, D-forward
computes
the Jacobian
of f
.
Forward-mode derivative operator. Takes some function `f` and returns a function whose value at some point can multiply an increment in the arguments to produce the best linear estimate of the increment in the function value. For univariate functions, [[D-forward]] computes a derivative. For vector-valued functions, [[D-forward]] computes the [Jacobian](https://en.wikipedia.org/wiki/Jacobian_matrix_and_determinant) of `f`.
(D-reverse f)
Reverse-mode derivative operator. Takes some function f
and returns a
function whose value at some point can multiply an increment in the arguments
to produce the best linear estimate of the increment in the function value.
For univariate functions, D-reverse
computes a derivative. For vector-valued
functions, D-reverse
computes
the Jacobian
of f
.
Reverse-mode derivative operator. Takes some function `f` and returns a function whose value at some point can multiply an increment in the arguments to produce the best linear estimate of the increment in the function value. For univariate functions, [[D-reverse]] computes a derivative. For vector-valued functions, [[D-reverse]] computes the [Jacobian](https://en.wikipedia.org/wiki/Jacobian_matrix_and_determinant) of `f`.
(gradient f)
(gradient f selectors)
Accepts:
f
of potentially many argumentsf
And returns a new function that computes either the
full Jacobian
or the entry at selectors
using reverse-mode automatic
differentiation.
Any multivariable function will have its argument vector coerced into an up
structure. Any [[emmy.matrix/Matrix]] in a multiple-arg function call will be
converted into a down
of up
s (a row of columns).
Arguments to single-variable functions are not transformed.
Accepts: - some function `f` of potentially many arguments - optionally, a sequence of selectors meant to index into the structural argument, or argument vector, of `f` And returns a new function that computes either the full [Jacobian](https://en.wikipedia.org/wiki/Jacobian_matrix_and_determinant) or the entry at `selectors` using [reverse-mode automatic differentiation](https://en.wikipedia.org/wiki/Automatic_differentiation#Reverse_accumulation). Any multivariable function will have its argument vector coerced into an `up` structure. Any [[emmy.matrix/Matrix]] in a multiple-arg function call will be converted into a `down` of `up`s (a row of columns). Arguments to single-variable functions are not transformed.
(partial & selectors)
Returns an operator that, when applied to a function f
, produces a function
that uses forward-mode automatic differentiation to compute the partial
derivative of f
at the (zero-based) slot index provided via selectors
.
Returns an operator that, when applied to a function `f`, produces a function that uses forward-mode automatic differentiation to compute the partial derivative of `f` at the (zero-based) slot index provided via `selectors`.
(partial-forward & selectors)
Returns an operator that, when applied to a function f
, produces a function
that uses forward-mode automatic differentiation to compute the partial
derivative of f
at the (zero-based) slot index provided via selectors
.
Returns an operator that, when applied to a function `f`, produces a function that uses forward-mode automatic differentiation to compute the partial derivative of `f` at the (zero-based) slot index provided via `selectors`.
(partial-reverse & selectors)
Returns an operator that, when applied to a function f
, produces a function
that uses reverse-mode automatic differentiation to compute the partial
derivative of f
at the (zero-based) slot index provided via selectors
.
Returns an operator that, when applied to a function `f`, produces a function that uses reverse-mode automatic differentiation to compute the partial derivative of `f` at the (zero-based) slot index provided via `selectors`.
(symbolic-taylor-series f)
(symbolic-taylor-series f & xs)
Similar to taylor-series
, except f
is evaluated with symbolic arguments,
and these arguments are only replaced with the values xs
after Taylor series
expansion.
Please see the docs for taylor-series
!
Similar to [[taylor-series]], except `f` is evaluated with symbolic arguments, and these arguments are only replaced with the values `xs` after Taylor series expansion. Please see the docs for [[taylor-series]]!
(taylor-series f)
(taylor-series f & xs)
Given a differentiable function f
and any number of arguments xs
, returns
a [[emmy.series/PowerSeries]] representing the Taylor
series of the function f
expanded at xs
.
Calling taylor-series
with no arguments will return the Maclaurin
series
of f
, i.e., the Taylor series expansion at (= x 0)
.
Calling the returned power series with incremental argument dx
will produce
a [[emmy.series/Series]] representing the terms of the Taylor series of
f
expanded at x
and evaluated at x+dx
.
NOTE: Just like the D
operator, functions f
of multiple-arguments are
treated as a function of a single structural argument. If you pass multiple
arguments xs
, you'll have to manually wrap your multiple-argument dx
in
a emmy.structure/up
or a vector before passing it to the returned
power series.
NOTE: The typical definition of a Taylor series of f
expanded around some
point x
is
$$T(p) = f(x) + \frac{f'(x)}{1!}(p-x) + \frac{f''(x)}{2!} (p-x)^2 + \ldots,$$
where p
is the evaluation point. When (= p x)
, all derivatives of the
Taylor series expansion of f
will exactly match the derivatives of f
itself.
The Taylor series returned here (call it $T'$) is actually a function of dx
,
where
$$T'(dx) = T(x+dx) = f(x) + \frac{f'(x)}{1!}(dx) + \frac{f''(x)}{2!} (dx)^2 + \ldots.$$
Given a differentiable function `f` and any number of arguments `xs`, returns a [[emmy.series/PowerSeries]] representing the [Taylor series](https://en.wikipedia.org/wiki/Taylor_series) of the function `f` expanded at `xs`. Calling [[taylor-series]] with no arguments will return the [Maclaurin series](https://en.wikipedia.org/wiki/Taylor_series#List_of_Maclaurin_series_of_some_common_functions) of `f`, i.e., the Taylor series expansion at `(= x 0)`. Calling the returned power series with incremental argument `dx` will produce a [[emmy.series/Series]] representing the terms of the Taylor series of `f` expanded at `x` and evaluated at `x+dx`. NOTE: Just like the [[D]] operator, functions `f` of multiple-arguments are treated as a function of a single structural argument. If you pass multiple arguments `xs`, you'll have to manually wrap your multiple-argument `dx` in a [[emmy.structure/up]] or a vector before passing it to the returned power series. NOTE: The typical definition of a Taylor series of `f` expanded around some point `x` is $$T(p) = f(x) + \frac{f'(x)}{1!}(p-x) + \frac{f''(x)}{2!} (p-x)^2 + \ldots,$$ where `p` is the evaluation point. When `(= p x)`, all derivatives of the Taylor series expansion of `f` will exactly match the derivatives of `f` itself. The Taylor series returned here (call it $T'$) is actually a function of `dx`, where $$T'(dx) = T(x+dx) = f(x) + \frac{f'(x)}{1!}(dx) + \frac{f''(x)}{2!} (dx)^2 + \ldots.$$
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close