Differentiation Algorithms

Overview


The derivative is instantaneous slope of a function at a given point, calculated using the methods of calculus.

Difference methods


Difference methods approximate the derivative by taking two nearby points on the curve and calculates the slope between those two points.

The forward and backward difference libraries can be found at the following URLs:


/lib/numeric/differentiation/v1.0.0/derivative.mjs
					


The following demonstrates a simple example of using the two libraries.


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

let f = function(x){
	return x-5;
}

let test = dv.forwardDifference(f, 0);
let test2 = dv.backwardDifference(f, 0);
					
Try it!

Three Point Formulas


The three points methods use three points instead of two to compute the derivative.
newton-raphson, see chapra - pg. 151



The following demonstrates a simple example of using the two libraries.


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

let f = function(x){
	return x-5;
}

let test = dv.threePointEnd(f, 0);
let test2 = dv.threePointMid(f, 0);
					
Try it!

Contents