This file is indexed.

/usr/share/singular/LIB/numerAlg.lib is in singular-data 4.0.3+ds-1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
//////////////////////////////////////////////////////////////////////////////
version="version numerAlg.lib 4.0.0.0 Jun_2013 "; // $Id: 4716f01278c13d50c18b86bdb64f744c32d62980 $
category="Algebraic Geometry";
info="
LIBRARY:  NumerAlg.lib    Numerical Algebraic Algorithm
OVERVIEW:
        The library contains procedures to
        test the inclusion, the equality of two ideals defined by polynomial systems,
        compute the degree of a pure i-dimensional component of an algebraic variety
         defined by a polynomial system,
        compute the local dimension of an algebraic variety defined by a polynomial
         system at a point computed as an approximate value. The use of the library
         requires to install Bertini (http://www.nd.edu/~sommese/bertini).

AUTHOR: Shawki AlRashed, rashed@mathematik.uni-kl.de; sh.shawki@yahoo.de
PROCEDURES:

 Incl(ideal I, ideal J);   test if I containes J

 Equal(ideal I, ideal J);  test if I equals to J

 Degree(ideal I, int i);   computes the degree of a pure i-dimensional

 NumLocalDim(ideal I, p);  numerical local dimension at a point computed as
                                  an approximate value
";

LIB "numerDecom.lib";

///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
proc Degree(ideal I,int i)
"USAGE:  Degree(ideal I,int i); I ideal,  i positive integer
RETURN:  the degree of the pure i-dimensional component of the algebraic
          variety defined by I
EXAMPLE: example Degree; shows an example
"
{
 def S=basering;
 def W=WitSet(I);
 setring W;
 int j;
 if(size(W(i)[1])>1)
 {
  j=size(W(i));
 }
 else
 {
  j=-1; // no component of dimension i
 }
 "The Degree of Component";
 j;
 setring S;
 return (W);
}
example
{ "EXAMPLE:"; echo = 2;
   ring r=0,(x,y,z),dp;
   poly f1=(x2+y2+z2-6)*(x-y)*(x-1);
   poly f2=(x2+y2+z2-6)*(x-z)*(y-2);
   poly f3=(x2+y2+z2-6)*(x-y)*(x-z)*(z-3);
   ideal I=f1,f2,f3;
   def W=Degree(I,1);
        ==>
           The Degree of Component
           3
   def W=Degree(I,2);
        ==>
           The Degree of Component
           2
}
///////////////////////////////////////////////////////////////////////////////

proc Incl(ideal I, ideal J)
"USAGE:  Incl(ideal I, ideal J); I, J ideals
RETURN:  t=1 if the algebraic variety defined by I contains the algebraic
           variety defined by J, otherwise t=0
EXAMPLE: example Incl; shows an example
"
{
 def S=basering;
 int n=nvars(basering);
 int i,j,ii,k,z,zi,dd;
 if(dim(std(I))==0)
 {
  def W=solve(I,"nodisplay");
  setring W;
  ideal J=imap(S,J);
  ideal I=imap(S,I);
  list w;
  poly tj;
  number al,ar,ai,ri,jj;
  zi=size(SOL);
  for(j=1;j<=zi;j++)
  {
   w=SOL[j];
   for(k=1;k<=size(J);k++)
   {
    tj=J[k];
    for(ii=1;ii<=n;ii++)
    {
     tj=subst(tj,var(ii),w[ii]);
    }
    al=leadcoef(tj);
    ar=repart(al);
    ai=impart(al);
    ri=ar^2+ai^2;
    if(ri>0.000000000000001)
    {
     jj=0;
     k=size(I)+1;
     j=zi+1;
    }
    else
    {
     jj=1;
     ri=0;
    }
   }
  }
 }
 else
 {
  def W=WitSupSet(I);
  setring W;
  ideal J=imap(S,J);
  ideal I=imap(S,I);
  list w;
  number al,ar,ai,ri,jj;
  poly tj;
  dd=size(L);
  for(i=0;i<=dd;i++)
  {
   z=size(W(i)[1]);
   zi=size(W(i));
   if(z>1)
   {
    for(j=1;j<=zi;j++)
    {
     w=W(i)[j];
     for(k=1;k<=size(J);k++)
     {
      tj=J[k];
      for(ii=1;ii<=n;ii++)
      {
       tj=subst(tj,var(ii),w[ii]);
      }
      al=leadcoef(tj);
      ar=repart(al);
      ai=impart(al);
      ri=ar^2+ai^2;
      if(ri>0.000000000000001)
      {
       jj=-1;
       k=size(J)+1;
       j=zi+1;
       z=0;
       i=dd+1;
      }
      else
      {
       jj=1;
       ri=0;
      }
     }
    }
   }
  }
 }
 if(ri>0.000000000000001)
 {
  jj=0;
 }
 else
 {
  jj=1;
 }
"================================================";
 "Inclusion:";
 jj;
"================================================";
 export(jj);
 export(J);
 export(I);
   system("sh","rm singular_solutions");
   system("sh","rm nonsingular_solutions");
   system("sh","rm real_solutions");
   system("sh","rm raw_solutions");
   system("sh","rm raw_data");
   system("sh","rm output");
   system("sh","rm midpath_data");
   system("sh","rm main_data");
   system("sh","rm input");
   system("sh","rm failed_paths");
 setring S;
 return (W);
}
example
{ "EXAMPLE:"; echo = 2;
   ring r=0,(x,y,z),dp;
   poly f1=(x2+y2+z2-6)*(x-y)*(x-1);
   poly f2=(x2+y2+z2-6)*(x-z)*(y-2);
   poly f3=(x2+y2+z2-6)*(x-y)*(x-z)*(z-3);
   ideal I=f1,f2,f3;
   poly g1=(x2+y2+z2-6)*(x-1);
   poly g2=(x2+y2+z2-6)*(y-2);
   poly g3=(x2+y2+z2-6)*(z-3);
   ideal J=g1,g2,g3;
   def W=Incl(I,J);
      ==>
         Inclusion:
         0
 def W=Incl(J,I);
      ==>
         Inclusion:
         1
}
///////////////////////////////////////////////////////////////////////////////
proc Equal(ideal I, ideal J)
"USAGE:  Equal(ideal I, ideal J); I, J ideals
RETURN:  t=1 if the algebraic variety defined by I equals to the algebraic
           variety defined by J, otherwise t=0
EXAMPLE: example Equal; shows an example
"
{
 def S=basering;
 int n=nvars(basering);
 def W1=Incl(J,I);
 setring W1;
 number j1=jj;
 execute("ring q=(real,0),("+varstr(S)+"),dp;");
 ideal I=imap(W1,I);
 ideal J=imap(W1,J);
 execute("ring qq=0,("+varstr(S)+"),dp;");
 ideal I=imap(S,I);
 ideal J=imap(S,J);
 def W2=Incl(I,J);
 setring W2;
 number j2=jj;
 number j;
 number j1=imap(W1,j1);
 if(j2==1)
 {
  if(j1==1)
  {
   j=1/1;
  }
  else
  {
   j=0/1;
  }
 }
 else
 {
  j=0/1;
 }
"================================================";
 "Equality:";
 j;
"================================================";
 setring S;
 return (W2);
}
example
{ "EXAMPLE:"; echo = 2;
   ring r=0,(x,y,z),dp;
   poly f1=(x2+y2+z2-6)*(x-y)*(x-1);
   poly f2=(x2+y2+z2-6)*(x-z)*(y-2);
   poly f3=(x2+y2+z2-6)*(x-y)*(x-z)*(z-3);
   ideal I=f1,f2,f3;
   poly g1=(x2+y2+z2-6)*(x-1);
   poly g2=(x2+y2+z2-6)*(y-2);
   poly g3=(x2+y2+z2-6)*(z-3);
   ideal J=g1,g2,g3;
   def W=Equal(I,J);
        ==>
           Equality:
           0


  def W=Equal(J,J);
        ==>
           Equality:
           1
}
///////////////////////////////////////////////////////////////////////////////
proc NumLocalDim(ideal J, list w, int e)
"USAGE:  NumLocalDim(ideal J, list w, int e); J ideal,
           w list of an approximate value of a point v in the algebraic variety defined by J,
               e integer
RETURN: the local dimension of the algebraic variety defined by J at v
EXAMPLE: example NumLocalDim; shows an example
"
{
 def S=basering;
 int n=nvars(basering);
 int sI=size(J);
 int i,j,jj,t,tt,sz1,sz2,ii,ph,ci,k;
 poly p,pp;
 list rw,iw;
 for(i=1;i<=sI;i++)
 {
  p=J[i];
  for(j=1;j<=n;j++)
  {
   w[j]=w[j]+I*0;
   rw[j]=repart(w[j]);
   iw[j]=impart(w[j]);
   p=subst(p,var(j),w[j]);
  }
  pp=pp+p;
 }
 number u=leadcoef(pp);
 if((u^2)==0)
 {
  execute("ring A=(real,e-1),("+varstr(S)+",I),ds;");
  ideal II=imap(S,J);
  list rw=imap(S,rw);
  list iw=imap(S,iw);
  poly p(1..n);
  for(j=1;j<=n;j++)
  {
   p(j)=var(j)+rw[j]+I*iw[j];
  }
  map f=A,p(1..n);
  ideal T=f(II);
  tt=dim(std(T));
  t=tt-1;
 }
 else
 {
  int d=dim(std(J));
  execute("ring R=(complex,e-1,I),("+varstr(S)+"),ds;");
  list w=imap(S,w);
  ideal II=imap(S,J);
  ideal JJ;
  poly p, p(1..n);
  for(i=1;i<=sI;i++)
  {
   p=II[i];
   for(j=1;j<=n;j++)
   {
    p=subst(p,var(j),w[j]);
   }
   JJ[i]=II[i]-p;
  }
  for(j=1;j<=n;j++)
  {
   p(j)=var(j)+w[j];
  }
  map f=R,p(1..n);
  ideal T=f(JJ);
  tt=dim(std(T));
  if(tt==d)
  {
   execute("ring A=(complex,e,I),("+varstr(S)+"),dp;");
   t=tt;
  }
  else
  {
   execute("ring RR=(real,e-2),("+varstr(S)+",I),dp;");
   ideal II=imap(S,J);
   list rw=imap(S,rw);
   list iw=imap(S,iw);
   ideal L,LL,H,HH;
   poly l(1..d),ll(1..d);
   int c;
   for(i=1;i<=d;i++)
   {
    for(j=1;j<=n;j++)
    {
     c=random(1,100);
     l(i)=l(i)+c*(var(j));
     ll(i)=ll(i)+c*(var(j)-rw[j]-I*iw[j]);
    }
    l(i)=l(i)+random(101,200);
    L[i]=l(i);
    LL[i]=ll(i);
   }
   poly pi=I^2+1;
   H=L,II,pi;
   ideal JJ;
   poly p, p(1..n);
   for(i=1;i<=sI;i++)
   {
    p=II[i];
    for(j=1;j<=n;j++)
    {
     p=subst(p,var(j),rw[j]+I*iw[j]);
    }
    JJ[i]=II[i]-p;
   }
   HH=LL,JJ,pi;
   if(dim(std(H))==0)
   {
    def M=solve(H,100,"nodisplay");
    setring M;
    sz1=size(SOL);
    execute("ring RRRQ=(real,e-1),("+varstr(S)+",I),dp;");
    ideal HH=imap(RR,HH);
    if(dim(std(HH))==0)
    {
     def MM=solve(HH,100,"nodisplay");
     setring MM;
     sz2=size(SOL);
    }
   }
   else
   {
    sz1=1;
   }
   if(sz1==sz2)
   {
    execute("ring A=(complex,e,I),("+varstr(S)+"),dp;");
    t=d;
   }
   else
   {
    execute("ring RQ=(real,e-1),("+varstr(S)+"),dp;");
    ideal II=imap(S,J);
    def RW=WitSet(II);
    setring RW;
    list v;
    list w=imap(S,w);
    number nr,ni;
    if(tt<0)
    {
     tt=0;
    }
    for(ii=tt;ii<=d;ii++)
    {
     list W(ii)=imap(RW,W(ii));
     if(size(W(ii)[1])>1)
     {
      if(ii==0)
      {
       for(i=1;i<=size(W(0));i++)
       {
        v=W(ii)[i];
        nr=0;
        ni=0;
        for(j=1;j<=n;j++)
        {
         nr=nr+(repart(v[j])-repart(w[j]))^2;
         ni=ni+(impart(v[j])-impart(w[j]))^2;
        }
        if((ni+nr)<1/10^(2*e-3))
        {
         execute("ring A=(complex,e,I),("+varstr(S)+"),dp;");
         list W(ii)=imap(RW,W(ii));
         t=0;
         i=size(W(ii))+1;
         ii=d+1;
        }
       }
      }
      else
      {
       def SS=Singular2bertini(W(ii));
       execute("ring D=(complex,e,I),("+varstr(S)+",s,gamma),dp;");
       string nonsin;
       ideal H,L;
       ideal J=imap(RW,N(0));
       ideal LL=imap(RW,L);
       list w=imap(S,w);
       poly p;
       for(j=1;j<=ii;j++)
       {
        p=0;
        for(jj=1;jj<=n;jj++)
        {
         p=p+random(1,100)*(var(jj)-w[jj]);
        }
        L[j]=p;
       }
       for(jj=1;jj<=size(J);jj++)
       {
        H[jj]=s*gamma*J[jj]+(1-s)*J[jj];
       }
       for(jj=1;jj<=ii;jj++)
       {
        H[size(J)+jj]=s*gamma*LL[jj]+(1-s)*L[jj];
       }
       string sv=varstr(S);
       def Q(ii)=UseBertini(H,sv);
       system("sh","rm start");
       nonsin=read("nonsingular_solutions");
       if(size(nonsin)>=52)
       {
        def T(ii)=bertini2Singular("nonsingular_solutions",nvars(basering)-2);
        setring T(ii);
        list C=re;
        ci=size(C);
        number tr;
        list w=imap(S,w);
        for(jj=1;jj<=ci;jj++)
        {
         tr=0;
         for(k=1;k<=n;k++)
         {
          tr=tr+(repart(w[k])-repart(C[jj][k]))^2+(impart(w[k])-impart(C[jj][k]))^2;
         }
         if(tr<=1/10^(2*e-3))
         {
          execute("ring A=(complex,e,I),("+varstr(S)+"),dp;");
          t=ii;
          ii=d+1;
          jj=ci+1;
         }
        }
       }
      }
     }
    }
    system("sh","rm singular_solutions");
    system("sh","rm nonsingular_solutions");
    system("sh","rm real_solutions");
    system("sh","rm raw_solutions");
    system("sh","rm raw_data");
    system("sh","rm output");
    system("sh","rm midpath_data");
    system("sh","rm main_data");
    system("sh","rm input");
    system("sh","rm failed_paths");
   }
  }
 }
 "=============================================";
 "The Local Dimension:";
 t;
 setring S;
 return(A);
}
example
{ "EXAMPLE:"; echo = 2;
   int e=14;
   ring r=(complex,e,I),(x,y,z),dp;
   poly f1=(x2+y2+z2-6)*(x-y)*(x-1);
   poly f2=(x2+y2+z2-6)*(x-z)*(y-2);
   poly f3=(x2+y2+z2-6)*(x-y)*(x-z)*(z-3);
   ideal J=f1,f2,f3;
   list p0=0.99999999999999+I*0.00000000000001,2,3+I*0.00000000000001;
   list p2=1,0.99999999999998,2;
   list p1=5+I,4.999999999999998+I,5+I;
   def D=NumLocalDim(J,p0,e);
             ==>
               The Local Dimension:
                0
   def D=NumLocalDim(J,p1,e);
             ==>
               The Local Dimension:
                1
   def D=NumLocalDim(J,p2,e);
             ==>
               The Local Dimension:
                2
}

///////////////////////////////////////////////////////////////////////////////