mirror of
https://github.com/josdejong/mathjs.git
synced 2026-01-18 14:59:29 +00:00
29 lines
749 B
JavaScript
29 lines
749 B
JavaScript
'use strict';
|
|
|
|
function factory (type, config, load, typed) {
|
|
var derivative = load(require('./derivative'));
|
|
|
|
/**
|
|
* A transformation for the derivative function. This transformation will be
|
|
* invoked when the function is used via the expression parser of math.js.
|
|
*
|
|
* @param {Array.<Node>} args
|
|
* Expects the following arguments: [f, x]
|
|
* @param {Object} math
|
|
* @param {Object} [scope]
|
|
*/
|
|
var derivativeTransform = typed('derivative', {
|
|
'Array, Object, Object': function (args) {
|
|
return derivative.apply(null, args);
|
|
}
|
|
});
|
|
|
|
derivativeTransform.rawArgs = true;
|
|
|
|
return derivativeTransform;
|
|
}
|
|
|
|
exports.name = 'derivative';
|
|
exports.path = 'expression.transform';
|
|
exports.factory = factory;
|