jiggzson / nerdamer

a symbolic math expression evaluator for javascript
http://www.nerdamer.com
MIT License
514 stars 82 forks source link

gcd: The TODOs #372

Open Happypig375 opened 6 years ago

Happypig375 commented 6 years ago

A couple of leftovers from #337. gcd(a^a,a^(a-1)) => a should=> a^(a-1)

My implementation for gcd of EX is mainly targetted for gcd(2^a,6^a) => 2^a

And Wolfram Alpha gives gcd(2^a,6^(a-2)) => 2^(a-2)/9

What!?

Yaffle commented 3 years ago
var x = nerdamer('gcd(x-sqrt(2), x-sqrt(2))');
console.log(x.toString()); // prints 'x'

Not sure if it should work at all with sqrt(2)... but the return value looks incorrect.

jiggzson commented 3 years ago

@Yaffle, thanks. I'll look into it.