Skip to content

Commit 3fc9815

Browse files
committed
simplify fix
1 parent a1f484e commit 3fc9815

File tree

2 files changed

+9
-20
lines changed

2 files changed

+9
-20
lines changed

Algebra.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -4826,13 +4826,13 @@ if((typeof module) !== 'undefined') {
48264826
r = _.add(r, s);
48274827
});
48284828
simplified = r;
4829-
//place back original multiplier and return
4830-
simplified = __.Simplify.unstrip(sym_array, simplified);
48314829
//mult on back the multiplier we saved here
48324830
simplified = _.multiply(simplified, new Symbol(m));
48334831
if (simplified.multiplier.equals(-1)) {
48344832
simplified.distributeMultiplier();
48354833
}
4834+
//place back original multiplier and return
4835+
simplified = __.Simplify.unstrip(sym_array, simplified);
48364836
return simplified;
48374837
}
48384838

spec/test.js

+7-18
Original file line numberDiff line numberDiff line change
@@ -35,27 +35,16 @@ console.global = {tsDebugChannels: {notimeout: true}};
3535
// x = nerdamer("3.535401^3.5").evaluate().text();
3636
// console.log(x);
3737

38+
let text;
3839
let x;
3940

40-
const solveConversion = (
41-
currentUnit,
42-
currentUnitValue,
43-
targetUnit,
44-
conversionString,
45-
) => {
46-
const conversion = nerdamer(conversionString)
47-
let convertedExpression = conversion
48-
.evaluate({ [currentUnit]: currentUnitValue })
49-
.solveFor(targetUnit)
50-
const convertedValue = convertedExpression[0].text()
51-
return Number(convertedValue)
52-
}
53-
54-
55-
5641
try {
57-
x = solveConversion('x', 10, 'y', 'x = 2 * y');
58-
console.log(x);
42+
// x = nerdamer("(-sqrt(y^2)+4)^2");
43+
x= nerdamer("(1-y)^2");
44+
const y=x.simplify();
45+
console.log(y.text());
46+
text = x.divide(y).simplify().text();
47+
console.log(text);
5948
} catch (error) {
6049
console.log("error "+error)
6150
}

0 commit comments

Comments
 (0)