Hello HN,<p>I was learning JavaScript by completing challenges on CoderByte[0], where one of the hard challenges was to find the point where two lines intersect. The lines were defined by two sets of points, and you had to return your answers as rationals, not floats. The challenge isn't timed, so I got a little carried away: ended up making a Fraction class, Equation class, etc. This first iteration could only solve linear equations, but I decided to expand it out into a library that could solve higher order polynomials and manipulate expressions.<p>On a related note, solving cubics is actually kind of hard. This guy Cardano[1] figured it out[2] in the 1500s, but his solution was incomplete because he wasn't aware of imaginary numbers at the time. I then found you could solve cubics with some trig[3] and decided to go that route. Anyway, hope you enjoy, and of course I am interested in your feedback.<p>[0] <a href="http://coderbyte.com/" rel="nofollow">http://coderbyte.com/</a><p>[1] <a href="https://en.wikipedia.org/wiki/Gerolamo_Cardano" rel="nofollow">https://en.wikipedia.org/wiki/Gerolamo_Cardano</a><p>[2] <a href="https://en.wikipedia.org/wiki/Cubic_function#Cardano.27s_method" rel="nofollow">https://en.wikipedia.org/wiki/Cubic_function#Cardano.27s_met...</a><p>[3] <a href="http://www.nickalls.org/dick/papers/maths/cubic1993.pdf" rel="nofollow">http://www.nickalls.org/dick/papers/maths/cubic1993.pdf</a>