Scale to simple integers

asked 2015-03-09 11:50:35 -0500

MvG gravatar image

There are many situations where multiplying an object by a scalar doesn't change its relevant properties. For example a polynomial, when all you care about are its roots. Or a matrix, when you onyl care about the kernel. Or a vector or matrix when you are dealing with homogeneous coordinates. Often it would be nice if we could choose a factor which leads to a particularly simple representation of all the objects involved. If all numbers involved are rational, we'd scale to make them integers. Then we could compute their gcd and divide by that, to obtain small integers. We might even fix the sign in some way, e.g. require the leading term of a polynomial to be positive.

Things become interesting if we nest things. If we have a matrix over the fraction field over some stack of nested polynomials, with rationals as the field underlying all of this, then we would have to traverse several layers of data structures to find all the numbers and turn them into integers. And along the way we'd multiply with the denominators from the polynomial fraction field as well.

Is there any functionaliy in Sage to provide any of this? Perhaps not all the way to what I described, but at least part of it?

I know there is a method monic both for vectors and for polynomials, to obtain a representation which is normalized in a certain sense. But that's not the sense I'm after since it usually leads to fractions. I also know that there are classes to represent projective spaces over arbitrary rings, and a method to clear denominators for points of such a space. But since I can't operate on such projective points using standard linear algebra matrices, and since converting between both worlds is tedious, I don't use these classes at all even though I use homogeneous coordinates all the time.

I'm tempted to write a trac ticket to request functionality along these lines (and perhaps write some of it myself later on), but I first wanted to know whether I had overlooked something like this.

edit retag flag offensive close merge delete


"If all numbers involved are rational" - I've often done something like this 'by hand' but this is a constraint that will limit the direct usefulness, so perhaps there isn't something like this now. Maybe make_all_coefficients_integers could be a new method.

kcrisman gravatar imagekcrisman ( 2015-03-09 18:07:50 -0500 )edit