josdejong/mathjs

simplify `sqrt(x)*sqrt(x)`

Open

#3231 aperta il 10 lug 2024

Vedi su GitHub
 (4 commenti) (0 reazioni) (0 assegnatari)JavaScript (1298 fork)batch import
featurehelp wanted

Metriche repository

Star
 (13.832 star)
Metriche merge PR
 (Nessuna PR mergiata in 30 g)

Descrizione

I asked it to simplify sqrt(x)*sqrt(x) and it couldn't do it. Nor could it do really anything with sqrt. As soon as I added the following single rule, it works perfectly and does all the things you would hope it should know how to do!

const simpRules = [...(math.simplify.rules)];
simpRules.push('sqrt(n1) -> n1^0.5');
math.simplify(exp,simpRules);

I suggest adding 'sqrt(n1) -> n1^0.5' to simplify.js

Guida contributor