(Disambiguation: for division of matrices, which is thought of as lifting one homomorphism over another, see instead Matrix // Matrix. For lifting a map between modules to a map between their free resolutions, see extend.)
The ring R should be one of the base rings associated with the ring of f. An error is raised if f cannot be lifted to R.
The first example is lifting from the fraction field of R to R.
i1 : lift(4/2,ZZ) o1 = 2 |
i2 : R = ZZ[x]; |
i3 : f = ((x+1)^3*(x+4))/((x+4)*(x+1)) 2 o3 = x + 2x + 1 o3 : frac R |
i4 : lift(f,R) 2 o4 = x + 2x + 1 o4 : R |
Another use of lift is to take polynomials in a quotient ring and lift them to the polynomial ring.
i5 : A = QQ[a..d]; |
i6 : B = A/(a^2-b,c^2-d-a-3); |
i7 : f = c^5 2 o7 = 2a*c*d + c*d + 6a*c + b*c + 6c*d + 9c o7 : B |
i8 : lift(f,A) 2 o8 = 2a*c*d + c*d + 6a*c + b*c + 6c*d + 9c o8 : A |
i9 : jf = jacobian ideal f o9 = {1} | 2cd+6c | {1} | c | {1} | 2ad+d2+6a+b+6d+9 | {1} | 2ac+2cd+6c | 4 1 o9 : Matrix B <--- B |
i10 : lift(jf,A) o10 = {1} | 2cd+6c | {1} | c | {1} | 2ad+d2+6a+b+6d+9 | {1} | 2ac+2cd+6c | 4 1 o10 : Matrix A <--- A |
Elements may be lifted to any base ring, if such a lift exists.
i11 : use B; |
i12 : g = (a^2+2*a-3)-(a+1)^2 o12 = -4 o12 : B |
i13 : lift(g,A) o13 = -4 o13 : A |
i14 : lift(g,QQ) o14 = -4 o14 : QQ |
i15 : lift(lift(g,QQ),ZZ) o15 = -4 |
The functions lift and substitute are useful to move numbers from one kind of coefficient ring to another.
i16 : lift(3.0,ZZ) o16 = 3 |
i17 : lift(3.0,QQ) o17 = 3 o17 : QQ |
A continued fraction method is used to lift a real number to a rational number, whereas promote uses the internal binary representation.
i18 : lift(123/2341.,QQ) 123 o18 = ---- 2341 o18 : QQ |
i19 : promote(123/2341.,QQ) 7572049608428139 o19 = ------------------ 144115188075855872 o19 : QQ |
i20 : factor oo 3*811*39877*78045679 o20 = -------------------- 57 2 o20 : Expression of class Divide |
For numbers and ring elements, an alternate syntax with ^ is available, analogous to the use of _ for promote.
i21 : .0001^QQ 1 o21 = ----- 10000 o21 : QQ |
i22 : .0001_QQ 7378697629483821 o22 = -------------------- 73786976294838206464 o22 : QQ |
The object lift is a method function with options.