### A.1.9 Dynamic modules

The purpose of the following example is to illustrate the use of dynamic modules. Giving an example on how to write a dynamic module is beyond the scope of this manual. A technical reference is given at https://www.singular.uni-kl.de/Manual/modules.pdf.

In this example, we use a dynamic module, residing in the file `kstd.so`, which allows ignoring all but the first j entries of vectors when forming the pairs in the standard basis computation.

    ring r=0,(x,y),dp;
    module mo=[x^2-y^2,1,0,0],[xy+y^2,0,1,0],[y^2,0,0,1];
    print(mo);
    ==> x2-y2,xy+y2,y2,
    ==> 1,    0,    0,
    ==> 0,    1,    0,
    ==> 0,    0,    1

    // load dynamic module - at the same time creating package Kstd
    // procedures will be available in the packages Top and Kstd
    LIB("partialgb.so");
    listvar(package);
    ==> // Partialgb                      [0]  package Partialgb (C,partialgb.so)
    ==> // Standard                       [0]  package Standard (S,standard.lib)
    ==> // Top                            [0]  package Top (T)

    // set the number of components to be considered to 1
    module mostd=partialStd(mo,1);        // calling procedure in Top
                        // obviously computation ignored pairs with leading
                        // term in the second entry
    print(mostd);
    ==> 0,  0,  y2,xy,x2,
    ==> -y, y,  0, 0, 1,
    ==> x-y,-x, 0, 1, 0,
    ==> 0,  x+y,1, -1,1

    // now consider 2 components
    module mostd2=Partialgb::partialStd(mo,2); // calling procedure in Partialgb
                        // this time the previously unconsidered pair was
                        // treated too
    print(mostd2);
    ==> 0,  0,   y2,xy,x2,
    ==> 0,  y,   0, 0, 1,
    ==> -y, -x+y,0, 1, 0,
    ==> x+y,0,   1, -1,1

User manual for Singular version 4.4.1, 2025, generated by texi2html.