Changeset c948324 in git


Ignore:
Timestamp:
Dec 15, 2000, 1:08:46 PM (23 years ago)
Author:
Hans Schönemann <hannes@…>
Branches:
(u'spielwiese', '4a9821a93ffdc22a6696668bd4f6b8c9de3e6c5f')
Children:
edef3080503be9dafb0b4d33562cb634ef9d50a8
Parents:
116c0963c62cef54596fdf23c8b1827f59377a05
Message:
*hannes: moved solver.lib to ntsolve.lib


git-svn-id: file:///usr/local/Singular/svn/trunk@4916 2c84dea3-7e68-4137-9b89-c4e89433aadc
Location:
Singular/LIB
Files:
1 deleted
1 edited

Legend:

Unmodified
Added
Removed
  • Singular/LIB/ntsolve.lib

    r116c09 rc948324  
    11///////////////////////////////////////////////////////////////////////////////
    2 version="$Id: ntsolve.lib,v 1.6 2000-07-06 13:32:25 pohl Exp $";
     2version="$Id: ntsolve.lib,v 1.7 2000-12-15 12:08:46 Singular Exp $";
    33info="
    44LIBRARY: ntsolve.lib ONE REAL SOLUTION OF POLYNOMIAL SYSTEMS (NEWTON ITERATION)
    5 AUTHOR:  Wilfred Pohl,   email: pohl@mathematik.uni-kl.de
     5AUTHORS:  Wilfred Pohl,   email: pohl@mathematik.uni-kl.de
     6          Dietmar Hillebrand
    67
    78PROCEDURES:
    8 nt_solve(i,..);        find one real root of 0-dimensional ideal
     9nt_solve(G,..);        find one real root of 0-dimensional ideal G
     10triMNewton(G,..);      find one real root for 0-dim. triangular system G
    911";
    1012///////////////////////////////////////////////////////////////////////////////
     
    233235///////////////////////////////////////////////////////////////////////////////
    234236
    235 // End: ***
     237///////////////////////////////////////////////////////////////////////////////
     238// solver.lib                                                                //
     239// algorithms for solving algebraic system of dimension zero                 //
     240// written by Dietmar Hillebrand and ...                                     //
     241//                                                                           //
     242///////////////////////////////////////////////////////////////////////////////
     243
     244
     245
     246///////////////////////////////////////////////////////////////////////////////
     247//
     248//   Multivariate Newton for triangular systems
     249//
     250//
     251///////////////////////////////////////////////////////////////////////////////
     252
     253proc triMNewton (ideal G, list a, number err, int itb)
     254"USAGE:  triMNewtion(G,a,err,itb);
     255             ideal G=g1,..,gn, a triangular system
     256                 in n vars, i.e gi=gi(var(n-i+1),..,var(n));
     257             list of numbers a, an approximation of a common zero of G,
     258                 (a[i] to be substituted in var(i));
     259             number err, an error bound;
     260             int itb, the maximal number of iterations performed.
     261RETURN:  an improved approximation for a common zero of G;
     262EXAMPLE: example triMNewton; shows an example
     263"
     264{
     265    if (itb == 0)
     266    {
     267        dbprint("iteration bound performed!");
     268        return(a);
     269    }
     270
     271    int i,j,k;
     272    ideal p=G;
     273    matrix J=jacob(G);
     274    list h;
     275    poly hh;
     276    int fertig=1;
     277    int n=nvars(basering);
     278
     279    for (i = 1; i <= n; i++)
     280    {
     281        for (j = n; j >= n-i+1; j--)
     282        {
     283            p[i] = subst(p[i],var(j),a[j]);
     284            for (k = n; k >= n-i+1; k--)
     285            {
     286                J[i,k] = subst(J[i,k],var(j),a[j]);
     287            }
     288        }
     289        if (J[i,n-i+1] == 0)
     290        {
     291            print("Error: ideal not radical!");
     292            return();
     293        }
     294
     295        // solve linear equations
     296        hh = -p[i];
     297        for (j = n; j >= n-i+2; j--)
     298        {
     299            hh = hh - J[i,j]*h[j];
     300        }
     301        h[n-i+1] = number(hh/J[i,n-i+1]);
     302    }
     303
     304    for (i = 1; i <= n; i++)
     305    {
     306        if ( abs(h[i]) > err)
     307        {
     308            fertig = 0;
     309            break;
     310        }
     311    }
     312    if ( not fertig )
     313    {
     314        for (i = 1; i <= n; i++)
     315        {
     316            a[i] = a[i] + h[i];
     317        }
     318        return(triMNewton(G,a,err,itb-1));
     319    }
     320    else
     321    {
     322        return(a);
     323    }
     324}
     325example
     326{ "EXAMPLE:"; echo = 2;
     327   ring r=real,(z,y,x),(lp);
     328   ideal i=x^2-1,y^2+x4-3,z2-y4+x-1;
     329   list a=2,3,4;
     330   number e=1.0e-10;
     331
     332   list l = triMNewton(i,a,e,20);
     333   l;
     334}
     335
     336
     337////////////////////////////////////////////////////////////////////////////////
     338
     339static proc abs( number r)
     340{
     341   if (r >= 0)
     342   {
     343       return(r);
     344   }
     345   else
     346   {
     347       return(-r);
     348   }
     349}
     350
Note: See TracChangeset for help on using the changeset viewer.