15.6.1.1 Singular Objects

class Singular
Singular( [maxread=user], [script_subdirectory=10000])

Instances of class Singular have the following methods (in addition to inherited methods and special methods):

clear,$  $ get,$  $ ideal,$  $ lib,$  $ LIB,$  $ list,$  $ matrix,$  $ new,$  $ ring,$  $ set,$  $ string

Further documentation:

clear( var)

Clear the variable named var.

get( var)

Get string representation of variable named var.

ideal( gens)

Return the ideal generated by gens.

INPUT:
    gens -- list of Singular objects (or objects that can be
            made into Singular objects via evaluation)
OUTPUT:
    the Singular ideal generated by the given list of gens

lib( lib)

Load the Singular library named lib.

LIB( lib)

Load the Singular library named lib.

matrix( nrows, ncols, entries)

sage: singular.lib("matrix.lib")
sage: R = singular.ring(0, '(x,y,z)', 'dp')
sage: A = singular.matrix(3,2,'1,2,3,4,5,6')
sage: A
1,2,
3,4,
5,6 
sage: A.gauss_col()
2,-1,
1,0, 
0,1

new( x, [type=def])

Create an expect object X with given type determined by the string x. This returns var, where var is built using the Singular statement type var = ... x ...

The object X returned can be used like any SAGE object, and wraps an object in self. The standard arithmetic operators work. Morever if foo is a function then X.foo(y,z,...) calls foo(X, y, z, ...) and returns the corresponding object.

ring( base, vars, [order=lp])

Create a Singular ring.

INPUT:
    base -- determines the base ring; e.g., an integer to
            to give the characteristic, etc. (see examples below)
    vars -- a string that defines the variable names
    order -- string -- the monomial order (default: 'lp')

OUTPUT:
    a Singular ring

We first declare $ \mathbf{Q}[x,y,z]$ with degree reverse lexicographic ordering.

sage: R = singular.ring(0, '(x,y,z)', 'dp')
sage: R
//   characteristic : 0
//   number of vars : 3
//        block   1 : ordering dp
//                  : names    x y z 
//        block   2 : ordering C

sage: R1 = singular.ring(32003, '(x,y,z)', 'dp')
sage: R2 = singular.ring(32003, '(a,b,c,d)', 'lp')

This is a ring in variables named x(1) through x(10) over the finite field of order $ 7$ :

sage: R3 = singular.ring(7, '(x(1..10))', 'ds')

This is a polynomial ring over the transcendtal extension $ \mathbf{Q}(a)$ of $ \mathbf{Q}$ :

sage: R4 = singular.ring('(0,a)', '(mu,nu)', 'lp')

This is a ring over the field of single-precision floats:

sage: R5 = singular.ring('real', '(a,b)', 'lp')

This is over 50-digit floats:

sage: R6 = singular.ring('(real,50)', '(a,b)', 'lp')
sage: R7 = singular.ring('(complex,50,i)', '(a,b)', 'lp')

To use a ring that you've defined, use the setring() method on the ring. This sets the ring to be the ``current ring''. For example,

sage: R = singular.ring(7, '(a,b)', 'ds')
sage: S = singular.ring('real', '(a,b)', 'lp')
sage: singular.new('10*a')
1.000e+01a
sage: R.setring()
sage: singular.new('10*a')
3a

set( type, name, value)

Set the variable with given name to the given value.

Instances of class Singular also have the following special methods:

__call__,$  $ _create

Further documentation:

__call__( x)

Send the code x to the Singular interpreter and return the output as a string.

See About this document... for information on suggesting changes.