Closed YannickNeyt closed 2 years ago
I think it would have to compute the prime factorisation of each number inside a square root, to see if a square can be extracted. I don't want it doing that for every number it encounters!
For example, should 9/sqrt(27)
be simplified to 3/sqrt(3)
?
Christian, If a student uses the Cardano formula for finding a root of a cubic, e.g. x^3+6x=20 to gives (sqrt(108)+10)^(1/3)-(sqrt(108)-10)^(1/3). Can you establish algebraic equivalence of this with 2, the unique real root?
;-)
No
I think it would have to compute the prime factorisation of each number inside a square root, to see if a square can be extracted. I don't want it doing that for every number it encounters!
For example, should
9/sqrt(27)
be simplified to3/sqrt(3)
?
Yeah, I thought that might be difficult. Maybe a "rootfree denominator" mode might be interesting? I wonder if other programs do such a thing and how they do it. Wolfram Alpha realises that 9/sqrt(27) is sqrt(3), but it probably does that by computing the real number first and then comparing it to known "special" numbers? Not sure.
It would be nice to have though, as the students are often required to simplify such expressions themselves; it's a little awkward to have to admit a computer can't do the same thing.
I think this is similar to #709, but that wants to spot ways of expressing single number tokens as fractions of surds
I've added two optional simplification rules, rationalDenominators
and reduceSurds
, which together with the other rules will simplify something like 9/sqrt(27)
to sqrt(3)
.
I ended up adding a function largest_square_factor
to pull out square factors of numbers, rather than trying to do lots of logic in the pattern-matching syntax.
This is in the development branch, so will be available on numbas.mathcentre.ac.uk when I merge with the main branch, which I hope to do around the start of September.
Just to quote Euler in his Elements of Algebra (1822)
S149. It is the same with regard to division; for $\sqrt{a}$ divided by $\sqrt{b}$ making $\sqrt\frac{a}{b}$, it is evident that $\sqrt{-4}$ divided by $\sqrt{-1}$ will make $\sqrt{+4}$ or 2; that $\sqrt{+3}$ divided by $\sqrt{-3}$ will give $\sqrt{-1}$; and that 1 divided by $\sqrt{-1}$ gives $\sqrt\frac{+1}{-1}$, or $\sqrt{-1}$; because $1$ is equal to $\sqrt{+1}$.
Was this a way of reminding me to look at negative numbers? If so, thanks
Is it possible to tell
\simplify
to simplify a root like this?