5 Examples 5.1 An Easy Polynomial Example The ground ring used in this example is F_3[x,y]. We want to see, how the different rings in this package can be used to localize at different points and how the results differ.  Example  gap> LoadPackage("RingsForHomalg");; gap> F3xy := HomalgRingOfIntegersInSingular(3) * "x,y";; gap> x1 := HomalgRingElement( "x+2", F3xy );; gap> y0 := HomalgRingElement( "y", F3xy );; gap> LoadPackage("LocalizeRingForHomalg");; gap> R00 := LocalizeAtZero( F3xy );; gap> R10 := LocalizeAt( F3xy, [ x1, y0 ] );; gap> RMora := LocalizePolynomialRingAtZeroWithMora( F3xy );; gap> M := HomalgMatrix( "[\ >  y^3+2*y^2+x+x^2+2*x*y+y^4+x*y^2, \ >  x*y^3+2*x^2*y+y^3+y^2+x+2*y+x^2, \ >  x^2*y^2+2*x^3+x^2*y+y^3+2*x^2+2*x*y+y^2+2*y\ >  ]", 1, 3, F3xy );; gap> LoadPackage( "Modules" );; gap> I := RightPresentation( M );; gap> M00 := HomalgLocalMatrix( M, R00 );; gap> M10 := HomalgLocalMatrix( M, R10 );; gap> MMora := HomalgLocalMatrix( M, RMora );; gap> I00 := RightPresentation( M00 );; gap> I10 := RightPresentation( M10 );; gap> IMora := RightPresentation( MMora );;  This ring is able to compute a standard basis of the module.  Example  gap> Display( IMora ); GF(3)[x,y]_< x, y >/< (x+x^2-x*y-y^2+x*y^2+y^3+y^4)/1, (x-y+x^2+y^2-x^2*y+y^3+\ x*y^3)/1, (-y-x^2-x*y+y^2-x^3+x^2*y+y^3+x^2*y^2)/1 > gap> ByASmallerPresentation( IMora );  gap> Display( IMora ); GF(3)[x,y]_< x, y >/< x/1, y/1 >  This ring recognizes, that the module is not zero, but is not able to find better generators.  Example  gap> Display( I00 ); GF(3)[x,y]_< x, y >/< (y^4+x*y^2+y^3+x^2-x*y-y^2+x)/1, (x*y^3-x^2*y+y^3+x^2+y^\ 2+x-y)/1, (x^2*y^2-x^3+x^2*y+y^3-x^2-x*y+y^2-y)/1 > gap> ByASmallerPresentation( I00 );  gap> Display( I00 ); GF(3)[x,y]_< x, y >/< (y^4+x*y^2+y^3+x^2-x*y-y^2+x)/1, (x*y^3-x^2*y+y^3+x^2+y^\ 2+x-y)/1, (x^2*y^2-x^3+x^2*y+y^3-x^2-x*y+y^2-y)/1 >  We are able to change the ring, to compute a nicer basis.  Example  gap> I00ToMora := RMora * I00;  gap> Display( I00ToMora ); GF(3)[x,y]_< x, y >/< (x+x^2-x*y-y^2+x*y^2+y^3+y^4)/1, (x-y+x^2+y^2-x^2*y+y^3+\ x*y^3)/1, (-y-x^2-x*y+y^2-x^3+x^2*y+y^3+x^2*y^2)/1 > gap> ByASmallerPresentation( I00ToMora );  gap> Display( I00ToMora ); GF(3)[x,y]_< x, y >/< x/1, y/1 >  We are able to find out, that this module is actually zero.  Example  gap> Display( I10 ); GF(3)[x,y]_< x-1, y >/< (y^4+x*y^2+y^3+x^2-x*y-y^2+x)/1, (x*y^3-x^2*y+y^3+x^2+\ y^2+x-y)/1, (x^2*y^2-x^3+x^2*y+y^3-x^2-x*y+y^2-y)/1 > gap> ByASmallerPresentation( I10 );  gap> Display( I10 ); 0  5.2 Hom(Hom(-,Z128),Z16) The following example is taken from Section 2 of [BR06]. The computation takes place over the local ring R=ℤ_⟨ 2⟩ (i.e. ℤ localized at the maximal ideal generated by 2). Here we compute the (infinite) long exact homology sequence of the covariant functor Hom(Hom(-,R/2^7R),R/2^4R) (and its left derived functors) applied to the short exact sequence 0 -> M_=R/2^2R --alpha_1--> M=R/2^5R --alpha_2--> _M=R/2^3R -> 0.  Example  gap> LoadPackage( "LocalizeRingForHomalg" );; gap> GlobalR := HomalgRingOfIntegersInExternalGAP( ); Z gap> Display( GlobalR );  gap> LoadPackage( "RingsForHomalg" );; gap> R := LocalizeAt( GlobalR , [ 2 ] ); Z_< 2 > gap> Display( R );  gap> M := LeftPresentation( HomalgMatrix( [ 2^5 ], R ) );  gap> _M := LeftPresentation( HomalgMatrix( [ 2^3 ], R ) );  gap> alpha2 := HomalgMap( HomalgMatrix( [ 1 ], R ), M, _M );  gap> M_ := Kernel( alpha2 );  gap> alpha1 := KernelEmb( alpha2 );  gap> seq := HomalgComplex( alpha2 );  gap> Add( seq, alpha1 ); gap> IsShortExactSequence( seq ); true gap> K := LeftPresentation( HomalgMatrix( [ 2^7 ], R ) );  gap> L := RightPresentation( HomalgMatrix( [ 2^4 ], R ) );  gap> triangle := LHomHom( 4, seq, K, L, "t" );  gap> lehs := LongSequence( triangle );  gap> ByASmallerPresentation( lehs );  gap> IsExactSequence( lehs ); true  5.3 ResidueClass We want to show, how localization can work together with residue class rings.  Example  gap> LoadPackage( "RingsForHomalg" );; gap> Qxy := HomalgFieldOfRationalsInDefaultCAS( ) * "x,y"; Q[x,y] gap> wmat := HomalgMatrix( >  "[ y^3-y^2 , x^3-x^2 , y^3+y^2 , x^3+x^2 ]", >  2, 2, Qxy );  gap> ec := HomalgRingElement( "-x^3-x^2+2*y^2", Qxy ); -x^3-x^2+2*y^2  Compute globally:  Example  gap> LoadPackage( "Modules" );; gap> W := LeftPresentation( wmat );  gap> Res := Resolution( 2 , W );  gap> Display( Res ); ------------------------- at homology degree: 2 0 ------------------------- (an empty 0 x 2 matrix)  the map is currently represented by the above 0 x 2 matrix ------------v------------ at homology degree: 1 Q[x,y]^(1 x 2) ------------------------- y^2, x^2, x*y^2-y^3,0  the map is currently represented by the above 2 x 2 matrix ------------v------------ at homology degree: 0 Q[x,y]^(1 x 2) -------------------------  Try a localization of a residue class ring:  Example  gap> R1 := Qxy / ec; Q[x,y]/( -x^3-x^2+2*y^2 ) gap> Display( R1 );  gap> wmat1 := R1 * wmat;  gap> LoadPackage( "LocalizeRingForHomalg" );; gap> R10 := LocalizeAt( R1 , >  [ HomalgRingElement( "x", R1 ), >  HomalgRingElement( "y", R1 ) ] >  ); Q[x,y]/( x^3+x^2-2*y^2 )_< |[ x ]|, |[ y ]| > gap> Display( R10 );  gap> wmat10 := HomalgLocalMatrix( wmat, R10 );  gap> W10 := LeftPresentation( wmat10 );  gap> Res10 := Resolution( 2 , W10 );  gap> Display( Res10 ); ------------------------- at homology degree: 2 0 ------------------------- (an empty 0 x 2 matrix)  the map is currently represented by the above 0 x 2 matrix ------------v------------ at homology degree: 1 Q[x,y]/( x^3+x^2-2*y^2 )_< |[ x ]|, |[ y ]| >^(1 x 2) ------------------------- 0, x*y^2-y^3, y^2,y^4-2*y^3+2*y^2  modulo [ x^3+x^2-2*y^2 ] / |[ 1 ]|  the map is currently represented by the above 2 x 2 matrix ------------v------------ at homology degree: 0 Q[x,y]/( x^3+x^2-2*y^2 )_< |[ x ]|, |[ y ]| >^(1 x 2) -------------------------  Try a residue class ring of a localization:  Example  gap> R0 := LocalizeAtZero( Qxy ); Q[x,y]_< x, y > gap> Display( R0 );  gap> wmat0 := R0 * wmat;  gap> R01 := R0 / ( ec / R0 ); Q[x,y]_< x, y >/( (-x^3-x^2+2*y^2)/1 ) gap> Display( R01 );  gap> wmat01 := R01 * wmat0;  gap> W01 := LeftPresentation( wmat01 );  gap> Res01 := Resolution( 2 , W01 );  gap> Display( Res01 ); ------------------------- at homology degree: 2 0 ------------------------- (an empty 0 x 2 matrix)  the map is currently represented by the above 0 x 2 matrix ------------v------------ at homology degree: 1 Q[x,y]_< x, y >/( (x^3+x^2-2*y^2)/1 )^(1 x 2) ------------------------- y^2, x^2, y^3+y^2,2*y^2 / 1  modulo [ (x^3+x^2-2*y^2)/1 ]  the map is currently represented by the above 2 x 2 matrix ------------v------------ at homology degree: 0 Q[x,y]_< x, y >/( (x^3+x^2-2*y^2)/1 )^(1 x 2) -------------------------  5.4 Testing the Intersection Formula We want to check Serre's intersection formula i(I_1, I_2; 0)=∑_i(-1)^i length(Tor^R_0_i(R_0/I_1,R_0/I_2)) on an easy affine example.  Example    gap> LoadPackage( "RingsForHomalg" );; gap> R := HomalgFieldOfRationalsInSingular() * "w,x,y,z";; gap> LoadPackage( "LocalizeRingForHomalg" );; gap> R0 := LocalizePolynomialRingAtZeroWithMora( R );; gap> M1 := HomalgMatrix( "[\ >  (w-x^2)*y, \ >  (w-x^2)*z, \ >  (x-w^2)*y, \ >  (x-w^2)*z \ >  ]", 4, 1, R );; gap> M2 := HomalgMatrix( "[\ >  (w-x^2)-y, \ >  (x-w^2)-z \ >  ]", 2, 1, R );; gap> LoadPackage( "Modules" );; gap> RmodI1 := LeftPresentation( M1 );; gap> RmodI2 := LeftPresentation( M2 );; gap> T:=Tor( RmodI1, RmodI2 );  gap> List( ObjectsOfComplex( T ), AffineDegree ); [ 12, 4, 0, 0 ]  We read, that the intersection multiplicity is 12-4=8 globally.  Example  gap> M10 := R0 * M1;  gap> M20 := R0 * M2;  gap> R0modI10 := LeftPresentation( M10 );; gap> R0modI20 := LeftPresentation( M20 );; gap> T0 := Tor( R0modI10, R0modI20 );  gap> List( ObjectsOfComplex( T0 ), AffineDegree ); [ 3, 1, 0, 0 ]  The intersection multiplicity at zero is 3-1=2.