mirror of
https://github.com/josdejong/mathjs.git
synced 2026-01-18 14:59:29 +00:00
Merge pull request #981 from jeffreyshen19/master
Added a test for ln(x) derivative
This commit is contained in:
commit
e4ea1eb2aa
@ -5,10 +5,10 @@ var OperatorNode = math.expression.node.OperatorNode;
|
||||
var derivative = math.derivative;
|
||||
|
||||
describe('derivative', function() {
|
||||
|
||||
|
||||
function derivativeWithoutSimplify (expr, value) {
|
||||
return math.derivative(expr, value, {simplify: false});
|
||||
}
|
||||
}
|
||||
|
||||
function compareString(left, right) {
|
||||
assert.equal(left.toString(), right.toString());
|
||||
@ -119,6 +119,8 @@ describe('derivative', function() {
|
||||
// d/dx(log(2x, 3x)) = ((2 * 1) / (2 * x) * log(3 * x) - log(2 * x) * (3 * 1) / (3 * x)) / log(3 * x) ^ 2 = (log(3x) - log(2x)) / (xlog(3x)^2)
|
||||
compareString(derivativeWithoutSimplify('log((2x), (3x))', 'x'), '((2 * 1) / (2 x) * log((3 x)) - log((2 x)) * (3 * 1) / (3 x)) / log((3 x)) ^ 2');
|
||||
|
||||
compareString(derivativeWithoutSimplify('log(x)', 'x'), '1 / x');
|
||||
|
||||
compareString(derivativeWithoutSimplify('sin(2x)', 'x'), '2 * 1 * cos(2 x)');
|
||||
compareString(derivativeWithoutSimplify('cos(2x)', 'x'), '2 * 1 * -sin(2 x)');
|
||||
compareString(derivativeWithoutSimplify('tan(2x)', 'x'), '2 * 1 * sec(2 x) ^ 2');
|
||||
@ -144,7 +146,7 @@ describe('derivative', function() {
|
||||
compareString(derivativeWithoutSimplify('acsch((2x))', 'x'), '-(2 * 1) / (abs((2 x)) * sqrt((2 x) ^ 2 + 1))');
|
||||
compareString(derivativeWithoutSimplify('acoth((2x))', 'x'), '-(2 * 1) / (1 - (2 x) ^ 2)');
|
||||
compareString(derivativeWithoutSimplify('abs(2x)', 'x'), '2 * 1 * abs(2 x) / (2 x)');
|
||||
|
||||
|
||||
compareString(derivativeWithoutSimplify('exp(2x)', 'x'), '2 * 1 * exp(2 x)');
|
||||
});
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user