simpleAutoDiff

Runs differentiation and establishes SimpleAutoDiffField context inside the block of code.

The partial derivatives are placed in argument d variable

Example:

val x by symbol // define variable(s) and their values
val y = DoubleField.withAutoDiff() { sqr(x) + 5 * x + 3 } // write formulate in deriv context
assertEquals(17.0, y.x) // the value of result (y)
assertEquals(9.0, x.d) // dy/dx

Return

the result of differentiation.

Parameters

body

the action in SimpleAutoDiffField context returning AutoDiffValue to differentiate with respect to.


fun <T : Any, F : Field<T>> F.simpleAutoDiff(vararg bindings: Pair<Symbol, T>, body: SimpleAutoDiffField<T, F>.() -> AutoDiffValue<T>): DerivationResult<T>(source)


Generate AutoDiffProcessor for SimpleAutoDiffExpression