davidedc / Algebrite

Computer Algebra System in Javascript (Typescript)
http://algebrite.org
MIT License
955 stars 59 forks source link

Returning numerical values #146

Open AustereTriceratops opened 3 years ago

AustereTriceratops commented 3 years ago

Hi, I'm trying to use this library to find roots of arbitrary polynomials.

One issue I noticed is that running Algebrite.nroots("x^2 - 1") returns a pretty complicated-looking datatype instead of an array of the roots. So far the only way I've found to get the roots is to use .toString() to get a string representation of the array.

I guess this is useful for displaying the answer, but the program I'm building needs their numerical representation (either as floats, or as an instance of a Complex class). Is there a way to do this? I'd rather not have to write a function to parse the string and build the right array from it.