Gradient

Overview


Gradient


The grad
{% \begin{bmatrix} \frac{\partial{f}}{\partial{x_1}} \\ ... \\ \frac{\partial{f}}{\partial{x_n}} \\ \end{bmatrix} %}

Gradient API


The gradient api provides methods for calculating the gradient of a function.

The following demonstrates a simple example of using the gradient library.


let gd= await import('/lib/numeric/differentiation/v1.0.0/gradient.mjs');
let dv = await import('/lib/numeric/differentiation/v1.0.0/derivative.mjs');

let f = function(x,y){
	return x + 3*y + 5;
}

let test = gd.gradient(f, [0,0], dv.backwardDifference);
					
Try it!

Contents