Skip to content
This repository was archived by the owner on Apr 18, 2023. It is now read-only.

Commit bd4e750

Browse files
committed
Starting #537
Additionally, a comment was left on nerdamer.com regarding matrix derivatives but the order of i & j was inverted. Fixed as well. limit(x/abs(x),x,0) still not fixed.
1 parent 5e49cdc commit bd4e750

File tree

4 files changed

+17
-11
lines changed

4 files changed

+17
-11
lines changed

Calculus.js

+14-8
Original file line numberDiff line numberDiff line change
@@ -374,7 +374,7 @@ if((typeof module) !== 'undefined' && typeof nerdamer === 'undefined') {
374374
}
375375
else if(core.Utils.isMatrix(symbol)) {
376376
var matrix = new core.Matrix();
377-
symbol.each(function(x, j, i) {
377+
symbol.each(function(x, i, j) {
378378
matrix.set(i, j, __.diff(x, wrt, nth));
379379
});
380380
return matrix;
@@ -2073,12 +2073,13 @@ if((typeof module) !== 'undefined' && typeof nerdamer === 'undefined') {
20732073
do {
20742074
var lim1 = evaluate(__.Limit.limit(f, x, lim));
20752075
var lim2 = evaluate(__.Limit.limit(g, x, lim));
2076+
20762077
//if it's in indeterminate form apply L'Hospital's rule
20772078
var indeterminate = isInfinity(lim1) && isInfinity(lim2) || equals(lim1, 0) && equals(lim2, 0);
20782079
//pull the derivatives
20792080
if(indeterminate) {
2080-
var ft = __.diff(f.clone(), x);
2081-
var gt = __.diff(g.clone(), x);
2081+
var ft = __.diff(fin.clone(), x);
2082+
var gt = __.diff(gin.clone(), x);
20822083
var t_symbol = _.expand(_.divide(ft, gt));
20832084
f = t_symbol.getNum();
20842085
g = t_symbol.getDenom();
@@ -2287,7 +2288,7 @@ if((typeof module) !== 'undefined' && typeof nerdamer === 'undefined') {
22872288
}
22882289
}
22892290
}
2290-
else if(symbol.group === CB) {
2291+
else if(symbol.group === CB) {
22912292
symbol = _.expand(symbol);
22922293
//if the group no longer is CB then feed it back to this function
22932294
if(symbol.group !== CB) {
@@ -2334,11 +2335,11 @@ if((typeof module) !== 'undefined' && typeof nerdamer === 'undefined') {
23342335
symbol = _.expand(symbol);
23352336
//Apply lim f+g = (lim f)+(lim g)
23362337
retval = new Symbol(0);
2338+
23372339
symbol.each(function(sym) {
23382340
//If the addition of the limits is undefined then the limit diverges so return -infinity to infinity
23392341
try {
23402342
_lim = __.Limit.limit(sym, x, lim);
2341-
23422343
}
23432344
catch(e) {
23442345
_lim = __.Limit.diverges();
@@ -2348,10 +2349,11 @@ if((typeof module) !== 'undefined' && typeof nerdamer === 'undefined') {
23482349
retval = _.add(retval, _lim);
23492350
}
23502351
catch(e) {
2352+
retval = __.Limit.limit(__.diff(symbol, x), x, lim);
23512353
//rewrite the function to have a common denominator.
23522354
//TODO: This is soooo slow at the moment.
2353-
symbol = core.Utils.toCommonDenominator(original);
2354-
retval = __.Limit.limit(symbol, x, lim);
2355+
// symbol = core.Utils.toCommonDenominator(original);
2356+
// retval = __.Limit.limit(symbol, x, lim);
23552357
}
23562358
});
23572359
}
@@ -2444,4 +2446,8 @@ if((typeof module) !== 'undefined' && typeof nerdamer === 'undefined') {
24442446
//link registered functions externally
24452447
nerdamer.api();
24462448

2447-
})();
2449+
})();
2450+
2451+
2452+
var ans = nerdamer('limit(x/abs(x),x,0)');
2453+
console.log(ans.toString())

all.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,4 @@ require('./Solve.js');
1313
require('./Extra.js');
1414

1515
//export nerdamer
16-
module.exports = nerdamer;
16+
module.exports = nerdamer;

nerdamer.core.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ var nerdamer = (function (imports) {
1616
"use strict";
1717

1818
//version ======================================================================
19-
var version = '1.1.3';
19+
var version = '1.1.4';
2020

2121
//inits ========================================================================
2222
var _ = new Parser(); //nerdamer's parser

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"description": "javascript light-weight symbolic math expression evaluator",
77
"name": "nerdamer",
88
"license": "MIT",
9-
"version": "1.1.3",
9+
"version": "1.1.4",
1010
"homepage": "http://nerdamer.com/",
1111
"directory": {
1212
"lib": "./"

0 commit comments

Comments
 (0)