mexprp
mexprp copied to clipboard
Implement operations for rug::Complex
- [x] add
- [x] sub
- [x] mul
- [x] div
- [x] pow
- [x] sqrt
- [ ] nrt
- [x] abs
- [x] sin
- [x] cos
- [x] tan
- [x] asin
- [x] acos
- [x] atan
- [ ] atan2
- [x] floor
- [ ] ceil
- [ ] round
- [x] log
I don't think atan2
makes sense with Complex numbers.
ceil
and round
can be implemented in the same way as floor
.
nrt
is a little more complex - if this returns a Multiple
under the same rules as sqrt
it could be quite slow to compute all the roots for higher values of n, but I think using rug's root_of_unity
function you could find the primary root using pow(1/n) and then multiply it by the roots of unity to get each separate result... This would only work for integer values of n though.