GAP (LinearAlgebraForCAP) - Chapter 2: Examples and Tests

Goto Chapter: Top 1 2 Ind
[Top of Book] [Contents] [Previous Chapter] [Next Chapter]

[MathJax on]

2 Examples and Tests
2.1 Basic Commands

### 2 Examples and Tests

#### 2.1 Basic Commands

    gap> Q := HomalgFieldOfRationals();;
    gap> a := VectorSpaceObject( 3, Q );
    <A vector space object over Q of dimension 3>
    gap> b := VectorSpaceObject( 4, Q );
    <A vector space object over Q of dimension 4>
    gap> homalg_matrix := HomalgMatrix( [ [ 1, 0, 0, 0 ],
    >                                   [ 0, 1, 0, -1 ],
    >                                   [ -1, 0, 2, 1 ] ], 3, 4, Q );
    <A 3 x 4 matrix over an internal ring>
    gap> alpha := VectorSpaceMorphism( a, homalg_matrix, b );
    <A morphism in Category of matrices over Q>
    gap> Display( alpha );
    [ [   1,   0,   0,   0 ],
      [   0,   1,   0,  -1 ],
      [  -1,   0,   2,   1 ] ]

    A morphism in Category of matrices over Q
    gap> homalg_matrix := HomalgMatrix( [ [ 1, 1, 0, 0 ],
    >                                   [ 0, 1, 0, -1 ],
    >                                   [ -1, 0, 2, 1 ] ], 3, 4, Q );
    <A 3 x 4 matrix over an internal ring>
    gap> beta := VectorSpaceMorphism( a, homalg_matrix, b );
    <A morphism in Category of matrices over Q>
    gap> CokernelObject( alpha );
    <A vector space object over Q of dimension 1>
    gap> c := CokernelProjection( alpha );;
    gap> Display( c );
    [ [     0 ],
      [     1 ],
      [  -1/2 ],
      [     1 ] ]

    A split epimorphism in Category of matrices over Q
    gap> gamma := UniversalMorphismIntoDirectSum( [ c, c ] );;
    gap> Display( gamma );
    [ [     0,     0 ],
      [     1,     1 ],
      [  -1/2,  -1/2 ],
      [     1,     1 ] ]

    A morphism in Category of matrices over Q
    gap> colift := CokernelColift( alpha, gamma );;
    gap> IsEqualForMorphisms( PreCompose( c, colift ), gamma );
    true
    gap> FiberProduct( alpha, beta );
    <A vector space object over Q of dimension 2>
    gap> F := FiberProduct( alpha, beta );
    <A vector space object over Q of dimension 2>
    gap> p1 := ProjectionInFactorOfFiberProduct( [ alpha, beta ], 1 );
    <A morphism in Category of matrices over Q>
    gap> Display( PreCompose( p1, alpha ) );
    [ [   0,   1,   0,  -1 ],
      [  -1,   0,   2,   1 ] ]

    A morphism in Category of matrices over Q
    gap> Pushout( alpha, beta );
    <A vector space object over Q of dimension 5>
    gap> i1 := InjectionOfCofactorOfPushout( [ alpha, beta ], 1 );
    <A morphism in Category of matrices over Q>
    gap> i2 := InjectionOfCofactorOfPushout( [ alpha, beta ], 2 );
    <A morphism in Category of matrices over Q>
    gap> u := UniversalMorphismFromDirectSum( [ b, b ], [ i1, i2 ] );
    <A morphism in Category of matrices over Q>
    gap> Display( u );
    [ [     0,     1,     1,     0,     0 ],
      [     1,     0,     1,     0,    -1 ],
      [  -1/2,     0,   1/2,     1,   1/2 ],
      [     1,     0,     0,     0,     0 ],
      [     0,     1,     0,     0,     0 ],
      [     0,     0,     1,     0,     0 ],
      [     0,     0,     0,     1,     0 ],
      [     0,     0,     0,     0,     1 ] ]

    A morphism in Category of matrices over Q
    gap> KernelObjectFunctorial( u, IdentityMorphism( Source( u ) ), u ) = IdentityMorphism( VectorSpaceObject( 3, Q ) );
    true
    gap> IsZero( CokernelObjectFunctorial( u, IdentityMorphism( Range( u ) ), u ) );
    true
    gap> DirectProductFunctorial( [ u, u ] ) = DirectSumFunctorial( [ u, u ] );
    true
    gap> CoproductFunctorial( [ u, u ] ) = DirectSumFunctorial( [ u, u ] );
    true
    gap> IsOne( FiberProductFunctorial( [ u, u ], [ IdentityMorphism( Source( u ) ), IdentityMorphism( Source( u ) ) ], [ u, u ] ) );
    true
    gap> IsOne( PushoutFunctorial( [ u, u ], [ IdentityMorphism( Range( u ) ), IdentityMorphism( Range( u ) ) ], [ u, u ] ) );
    true
    gap> IsCongruentForMorphisms( (1/2) * alpha, alpha * (1/2) );
    true
    gap> Dimension( HomomorphismStructureOnObjects( a, b ) ) = Dimension( a ) * Dimension( b );
    true
    gap> IsCongruentForMorphisms(
    >     PreCompose( [ u, DualOnMorphisms( i1 ), DualOnMorphisms( alpha ) ] ),
    >     InterpretMorphismFromDinstinguishedObjectToHomomorphismStructureAsMorphism( Source( u ), Source( alpha ),
    >          PreCompose(
    >              InterpretMorphismAsMorphismFromDinstinguishedObjectToHomomorphismStructure( DualOnMorphisms( i1 ) ),
    >              HomomorphismStructureOnMorphisms( u, DualOnMorphisms( alpha ) )
    >          )
    >     )
    > );
    true
    gap> vec := CapCategory( alpha );;
    gap> t := TensorUnit( vec );;
    gap> z := ZeroObject( vec );;
    gap> IsCongruentForMorphisms(
    >     ZeroObjectFunctorial( vec ),
    >     InterpretMorphismFromDinstinguishedObjectToHomomorphismStructureAsMorphism( z, z, ZeroMorphism( t, z ) )
    > );
    true
    gap> IsCongruentForMorphisms(
    >     ZeroObjectFunctorial( vec ),
    >     InterpretMorphismFromDinstinguishedObjectToHomomorphismStructureAsMorphism(
    >         z, z,
    >         InterpretMorphismAsMorphismFromDinstinguishedObjectToHomomorphismStructure( ZeroObjectFunctorial( vec ) )
    >     )
    > );
    true
    gap> right_side := PreCompose( [ i1, DualOnMorphisms( u ), u ] );;
    gap> x := SolveLinearSystemInAbCategory( [ [ i1 ] ], [ [ u ] ], [ right_side ] )[1];;
    gap> IsCongruentForMorphisms( PreCompose( [ i1, x, u ] ), right_side );
    true

[Top of Book] [Contents] [Previous Chapter] [Next Chapter]
Goto Chapter: Top 1 2 Ind

generated by GAPDoc2HTML