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

Commit

Permalink
Fix #610
Browse files Browse the repository at this point in the history
  • Loading branch information
jiggzson committed May 24, 2021
1 parent 689215d commit 453c630
Show file tree
Hide file tree
Showing 5 changed files with 180 additions and 681 deletions.
7 changes: 4 additions & 3 deletions Calculus.js
Original file line number Diff line number Diff line change
Expand Up @@ -489,7 +489,7 @@ if((typeof module) !== 'undefined' && typeof nerdamer === 'undefined') {

return symbol;
}
;

function derive(symbol) {
var g = symbol.group, a, b, cp;

Expand Down Expand Up @@ -696,7 +696,8 @@ if((typeof module) !== 'undefined' && typeof nerdamer === 'undefined') {
symbol = _.multiply(polydiff(symbol.clone()), derive(b));
}
else if(g === CP || g === PL) {
var c = _.parse(symbol);
// Note: Do not use `parse` since this puts back the sqrt and causes a bug as in #610. Use clone.
var c = symbol.clone();
var result = new Symbol(0);
for(var x in symbol.symbols) {
result = _.add(result, __.diff(symbol.symbols[x].clone(), d));
Expand Down Expand Up @@ -2667,4 +2668,4 @@ if((typeof module) !== 'undefined' && typeof nerdamer === 'undefined') {
//link registered functions externally
nerdamer.api();

})();
})();
2 changes: 1 addition & 1 deletion all.min.js

Large diffs are not rendered by default.

12 changes: 11 additions & 1 deletion nerdamer.core.js
Original file line number Diff line number Diff line change
Expand Up @@ -7654,6 +7654,11 @@ var nerdamer = (function (imports) {
if(!isSymbol(symbol)) {
symbol = _.parse(symbol);
}

// Exit early for EX
if(symbol.group === EX) {
return _.symfunction(SQRT, [symbol]);
}

if(symbol.fname === '' && symbol.power.equals(1))
symbol = symbol.args[0];
Expand Down Expand Up @@ -12543,4 +12548,9 @@ var nerdamer = (function (imports) {

if((typeof module) !== 'undefined') {
module.exports = nerdamer;
};
};



var ans = nerdamer('sqrt(3^x)');
console.log(ans.toString())
Loading

0 comments on commit 453c630

Please sign in to comment.