Open christianp opened 4 years ago
Assuming the number isn't rational, you can write it in any of the forms a/sqrt(b)
, sqrt(a)/b
, or sqrt(a/b)
. So do we need three display flags?
The most common convention at school level is to rationalise the denominator, but at uni, most mathematicians prefer 1/sqrt(2)
to sqrt(2)/2
.
It would be nice to automatically spot surds like
1/sqrt(2)
,sqrt(3)/2
andsqrt(3/2)
, particularly for trigonometry. A display flagshowSurds
would render appropriate numbers as surds.To avoid being over-eager, maybe only numbers less than 10 or 100 in both the integer or square root part should count as surds.
Here's a function that spots surds, returning
undefined
otherwise: