Singular Manual: solve

| #### D.8.4.2 solve Procedure from library `solve.lib` (see solve_lib). Usage: solve(G [, m, n [, l]] [,"oldring"] [,"nodisplay"] ); G = ideal, m, n, l = integers (control parameters of the method), outR ring, m: precision of output in digits ( 4 <= m) and of the generated ring of complex numbers; n: control of multiplicity n = 0, return all different roots n != 0, find all roots (with multiplicity) l: precision of internal computation in decimal digits ( l >=8 ) only if the basering is not complex or complex with smaller precision, [default: (m,n,l) = (8,0,30), or if only (m,n) are set explicitly with n!=0, then (m,n,l) = (m,n,60) ] Assume: the ideal is 0-dimensional; basering has characteristic 0 and is either complex or without parameters; Return: (1) If called without the additional parameter `"oldring"`: ring `R` with the same number of variables but with complex coefficients (and precision m). `R` comes with a list `SOL` of numbers, in which complex roots of G are stored: * If n = 0, `SOL` is the list of all different solutions, each of them being represented by a list of numbers. * If n != 0, `SOL` is a list of two list: SOL[i][1] is the list of all different solutions with the multiplicity SOL[i][2]. SOL is ordered w.r.t. multiplicity (the smallest first). (2) If called with the additional parameter `"oldring"`, the procedure looks for an appropriate ring (at top level) in which the solutions can be stored (interactive). The user may then select an appropriate ring and choose a name for the output list in this ring. The list is exported directly to the selected ring and the return value is a string "result exported to" + name of the selected ring. Note: If the problem is not 0-dim. the procedure stops with ERROR. If the ideal G is not a lexicographic Groebner basis, the lexicographic Groebner basis is computed internally (Hilbert driven). The computed solutions are displayed, unless `solve` is called with the additional parameter `"nodisplay"`. Example:
    LIB "solve.lib";
    // Find all roots of a multivariate ideal using triangular sets:
    int d,t,s = 4,3,2 ;
    int i;
    ring A=0,x(1..d),dp;
    poly p=-1;
    for (i=d; i>0; i--) { p=p+x(i)^s; }
    ideal I = x(d)^t-x(d)^s+p;
    for (i=d-1; i>0; i--) { I=x(i)^t-x(i)^s+p,I; }
    I;
    ==> I[1]=x(1)^3+x(2)^2+x(3)^2+x(4)^2-1
    ==> I[2]=x(2)^3+x(1)^2+x(3)^2+x(4)^2-1
    ==> I[3]=x(3)^3+x(1)^2+x(2)^2+x(4)^2-1
    ==> I[4]=x(4)^3+x(1)^2+x(2)^2+x(3)^2-1
    // the multiplicity is
    vdim(std(I));
    ==> 81
    def AC=solve(I,6,0,"nodisplay");  // solutions should not be displayed
    ==>
    ==> // 'solve' created a ring, in which a list SOL of numbers (the complex so\
       lutions)
    ==> // is stored.
    ==> // To access the list of complex solutions, type (if the name R was assig\
       ned
    ==> // to the return value):
    ==>         setring R; SOL;
    // list of solutions is stored in AC as the list SOL (default name)
    setring AC;
    size(SOL);               // number of different solutions
    ==> 37
    SOL[5];                  // the 5th solution
    ==> [1]:
    ==> 0.587401
    ==> [2]:
    ==> -0.32748
    ==> [3]:
    ==> 0.587401
    ==> [4]:
    ==> 0.587401
    // you must start with char. 0
    setring A;
    def AC1=solve(I,6,1,"nodisplay");
    ==>
    ==> // 'solve' created a ring, in which a list SOL of numbers (the complex so\
       lutions)
    ==> // is stored.
    ==> // To access the list of complex solutions, type (if the name R was assig\
       ned
    ==> // to the return value):
    ==>         setring R; SOL;
    setring AC1;
    size(SOL);               // number of different multiplicities
    ==> 2
    SOL[1][1][1];            // a solution with
    ==> [1]:
    ==> (0.766044+i*0.477895)
    ==> [2]:
    ==> (0.766044+i*0.477895)
    ==> [3]:
    ==> (0.766044-i*0.477895)
    ==> [4]:
    ==> (0.766044-i*0.477895)
    SOL[1][2];               // multiplicity 1
    ==> 1
    SOL[2][1][1];            // a solution with
    ==> [1]:
    ==> 0
    ==> [2]:
    ==> 0
    ==> [3]:
    ==> 1
    ==> [4]:
    ==> 0
    SOL[2][2];               // multiplicity 12
    ==> 12
    // the number of different solutions is equal to
    size(SOL[1][1])+size(SOL[2][1]);
    ==> 37
    // the number of complex solutions (counted with multiplicities) is
    size(SOL[1][1])*SOL[1][2]+size(SOL[2][1])*SOL[2][2];
    ==> 81

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