Changeset 6b589f in git for Singular/LIB/alexpoly.lib


Ignore:
Timestamp:
Apr 19, 2007, 5:10:38 PM (17 years ago)
Author:
Hans Schönemann <hannes@…>
Branches:
(u'spielwiese', 'fe61d9c35bf7c61f2b6cbf1b56e25e2f08d536cc')
Children:
eff00fb66b5cef03a89608c1e8adcc5cf36ade3c
Parents:
bb9a5a2a1df0eacab065576595d4d0635e0ecae1
Message:
*hannes: proximitymatrix from V-2-0-patches


git-svn-id: file:///usr/local/Singular/svn/trunk@9982 2c84dea3-7e68-4137-9b89-c4e89433aadc
File:
1 edited

Legend:

Unmodified
Added
Removed
  • Singular/LIB/alexpoly.lib

    rbb9a5a r6b589f  
    1 version="$Id: alexpoly.lib,v 1.14 2006-08-02 10:14:06 Singular Exp $";
     1version="$Id: alexpoly.lib,v 1.15 2007-04-19 15:10:38 Singular Exp $";
    22category="Singularities";
    33info="
     
    1717 alexanderpolynomial(f);    Alexander polynomial of f
    1818 semigroup(f);              calculates generators for the semigroup of f
     19 proximitymatrix(f);        calculates the proximity matrix of f
    1920 multseq2charexp(v);        converts multiplicity sequence to characteristic exponents
    2021 charexp2multseq(v);        converts characteristic exponents to multiplicity sequence
     
    22222223}
    22232224
     2225proc proximitymatrix (def INPUT)
     2226"USAGE:  proximitymatrix(INPUT); INPUT poly or list or intmat
     2227ASSUME:  INPUT is either a REDUCED bivariate polynomial defining a plane curve singularity,
     2228         or the output of @code{hnexpansion(f[,\"ess\"])}, or the list @code{hne} in
     2229         the ring created by @code{hnexpansion(f[,\"ess\"])}, or the output of
     2230         @code{develop(f)} resp. of @code{extdevelop(f,n)}, or a list containing
     2231         the contact matrix and a list of integer vectors with the characteristic exponents
     2232         of the branches of a plane curve singularity, or an integer vector containing the
     2233         characteristic exponents of an irreducible plane curve singularity, or the resolution
     2234         graph of a plane curve singularity (i.e. the output of resolutiongraph or
     2235         the first entry in the output of totalmultiplicities).
     2236RETURN:  list, of three integer matrices. The first one is the proximity matrix of
     2237         the plane curve defined by the INPUT, i.e. the entry i,j is 1 if the
     2238         infinitely near point corresponding to row i is proximate to the infinitely
     2239         near point corresponding to row j. The second integer matrix is the incidence matrix of the
     2240         resolution graph of the plane curve. The entry on the diagonal in row i is -s-1
     2241         if s is the number of points proximate to the infinitely near point corresponding
     2242         to the ith row in the matrix. The third integer matrix is the incidence matrix of
     2243         the Enriques diagram of the plane curve singularity, i.e. each row corresponds to
     2244         an infinitely near point in the minimal standard resolution, including the
     2245         strict transforms of the branches, the diagonal element gives
     2246         the level of the point, and the entry i,j is -1 if row i is proximate to row j.
     2247NOTE:    In case the Hamburger-Noether expansion of the curve f is needed
     2248         for other purposes as well it is better to calculate this first
     2249         with the aid of @code{hnexpansion} and use it as input instead of
     2250         the polynomial itself.
     2251         @*
     2252         If you are not sure whether the INPUT polynomial is reduced or not, use
     2253         @code{squarefree(INPUT)} as input instead.
     2254         @*
     2255         If the input is a smooth curve, then the output will consist of
     2256         three one-by-one zero matrices.
     2257         @*
     2258         For the definitions of the computed objects see e.g. the book
     2259         Eduardo Casas-Alvero, Singularities of Plane Curves.       
     2260SEE ALSO: develop, hnexpansion, totalmultiplicities, alexanderpolynomial
     2261EXAMPLE: example proximitymatrix;  shows an example
     2262"
     2263{
     2264  ///////// Decide on the type of input. //////////
     2265  if (typeof(INPUT)=="intmat")
     2266  {
     2267    intmat resgr=INPUT;
     2268  }
     2269  else
     2270  {
     2271    intmat resgr=totalmultiplicities(INPUT)[1];
     2272  }
     2273  ////////  Deal with the case of a smooth curve ////////////////
     2274  if (size(resgr)==1)
     2275  {
     2276    return(list(intmat(intvec(1),1,1),intmat(intvec(-1),1,1),intmat(intvec(0),1,1)));
     2277  }
     2278  ////////  Calculate the proximity resolution graph ////////////
     2279  int i,j;
     2280  int n=nrows(resgr);
     2281  intvec diag; // Diagonal of the Enriques diagram.
     2282  int si; // number of points proximate to the point corresponding to the ith row
     2283  // Adjust the weights of the nodes corresponding to strict transforms so
     2284  // as if there had been one additional blow up.
     2285  for (i=1;i<=n;i++)
     2286  {
     2287    // Check if the row corresponds to an exceptional divisor ...
     2288    if (resgr[i,i]<0)
     2289    {
     2290      j=1;
     2291      while ((resgr[i,j]==0) or (i==j))
     2292      {
     2293        j++;
     2294      }
     2295      resgr[i,i]=resgr[j,j]+1;
     2296    }
     2297  } 
     2298  // Set the weights in the resolution graph to the blowing up level in the resolution.
     2299  for (i=1;i<=n;i++)
     2300  {
     2301    resgr[i,i]=resgr[i,i]-1;
     2302    diag[i]=resgr[i,i]; // The level of the corresponding infinitely near point.
     2303  } 
     2304  // Replace the weights in the resolution graph by
     2305  // -s-1, where s is the number of points which are proximate to the point.
     2306  for (i=1;i<=n;i++)
     2307  {
     2308    si=-1; 
     2309    // Find the points of higher weight which are connected to the ith row.
     2310    for (j=i+1;j<=n;j++)
     2311    {
     2312      // If the point in row j is connected to the ith row, then all the points of
     2313      // weight resgr[i,i]+1 to weight resgr[j,j] in the corresponding subgraph
     2314      // are proximate to the point of the ith row. This number is just resgr[j,j]-resgr[i,i].
     2315      if ((resgr[i,j]!=0) and (resgr[j,j]>0))
     2316      {
     2317        si=si-(resgr[j,j]-resgr[i,i]);
     2318      }
     2319    }
     2320    resgr[i,i]=si;
     2321  }
     2322  ///////////////  Calculate the proximity matrix  ///////////////////
     2323  intmat proximity=proxgauss(resgr);
     2324  intmat enriques=proximity;
     2325  for (i=1;i<=nrows(enriques);i++)
     2326  {
     2327    enriques[i,i]=diag[i];
     2328  }
     2329  return(list(proximity,resgr,enriques));
     2330}
     2331example
     2332{
     2333  "EXAMPLE:";
     2334  echo=2;
     2335  ring r=0,(x,y),ls;
     2336  poly f1=(y2-x3)^2-4x5y-x7;
     2337  poly f2=y2-x3;
     2338  poly f3=y3-x2;
     2339  list proximity=proximitymatrix(f1*f2*f3);
     2340  /// The proximity matrix P ///
     2341  print(proximity[1]);
     2342  /// The proximity resolution graph N ///
     2343  print(proximity[2]);
     2344  /// They satisfy N=-transpose(P)*P ///
     2345  print(-transpose(proximity[1])*proximity[1]);
     2346  /// The incidence matrix of the Enriques diagram ///
     2347  print(proximity[3]);
     2348  /// If M is the matrix of multiplicities and TM the matrix of total
     2349  /// multiplicities of the singularity, then  M=P*TM.
     2350  /// We therefore calculate the (total) multiplicities. Note that
     2351  /// they have to be slightly extended.
     2352  list MULT=extend_multiplicities(totalmultiplicities(f1*f2*f3));
     2353  intmat TM=MULT[1];  // Total multiplicites.
     2354  intmat M=MULT[2];   // Multiplicities.
     2355  /// Check: M-P*TM=0.
     2356  M-proximity[1]*TM;
     2357  /// Check: inverse(P)*M-TM=0.
     2358  intmat_inverse(proximity[1])*M-TM;
     2359}
     2360
     2361static proc addmultiplrows (intmat M, int i, int j, int ki, int kj)
     2362"USAGE:   addmultiplrows(M,i,j,ki,kj);  intmat M, int i,j,ki,kj
     2363RETURN:   intmat, replaces the j-th row in M by ki-times the i-th row plus
     2364                  kj times the j-th
     2365NOTE:     This procedure is only for internal use; it is called in intmat_inverse
     2366          and proxgauss.
     2367"
     2368{
     2369  for (int k=1;k<=ncols(M);k++)
     2370  {
     2371    M[j,k]=kj*M[j,k]+ki*M[i,k];
     2372  }
     2373  return(M);
     2374}
     2375
     2376
     2377static proc proxgauss (intmat M)
     2378"USAGE:   proxgauss(M);  intmat M
     2379ASSUME:   M is the output of proximity_resgr
     2380RETURN:   intmat, replaces the j-th row in M by ki-times the i-th row plus
     2381                  kj times the j-th
     2382NOTE:     This procedure is only for internal use; it is called in intmat_inverse.
     2383"
     2384{
     2385  int i;
     2386  int n=nrows(M);
     2387  if (n==1)
     2388  {
     2389    M[1,1]=1;
     2390    return(M);
     2391  }
     2392  else
     2393  {
     2394    if (M[n,n]<0)
     2395    {   
     2396      M=addmultiplrows(M,n,n,-1,0);
     2397    }
     2398    for (i=n-1;i>=1;i--)
     2399    {
     2400      if (M[i,n]!=0)
     2401      {
     2402        M=addmultiplrows(M,n,i,-M[i,n],M[n,n]);
     2403      }
     2404    }
     2405    intmat N[n-1][n-1]=M[1..n-1,1..n-1];
     2406    N=proxgauss(N);
     2407    M[1..n-1,1..n-1]=N[1..n-1,1..n-1];
     2408    return(M);
     2409  }
     2410}
     2411
     2412proc extend_multiplicities (list rg)
     2413"USAGE:      extend_multiplicities(rg); list rg
     2414ASSUME:      rg is the output of the procedure totalmultiplicities
     2415RETURN:      list, the first entry is an integer matrix containing the total
     2416             multiplicities and the second entry is an integer matrix containing
     2417             the multiplicies of the resolution given by rg, where the zeros
     2418             corresponding to the strict transforms of the branches of the curve
     2419             have been replaced by the (total) multiplicities of the infinitely near
     2420             point corresponding to one further blow up for each branch.
     2421KEYWORDS:    total multiplicities; multiplicity sequence; resolution graph
     2422EXAMPLE:     example extend_multiplicities;   shows an example
     2423"
     2424{
     2425  intmat resgr,tm,mt=rg[1],rg[2],rg[3];
     2426  int i,j;
     2427  for (i=1;i<=nrows(resgr);i++)
     2428  {
     2429    if (resgr[i,i]<0)
     2430    {
     2431      j=1;
     2432      while ((resgr[i,j]==0) or (i==j))
     2433      {
     2434        j++;
     2435      }
     2436      tm[i,1..ncols(tm)]=tm[j,1..ncols(tm)];
     2437      tm[i,-resgr[i,i]]=tm[i,-resgr[i,i]]+1;
     2438      mt[i,-resgr[i,i]]=1;
     2439    }
     2440  }
     2441  return(list(tm,mt));
     2442}
     2443example
     2444{
     2445  "EXAMPLE:";
     2446  echo=2;
     2447  ring r=0,(x,y),ls;
     2448  poly f1=(y2-x3)^2-4x5y-x7;
     2449  poly f2=y2-x3;
     2450  poly f3=y3-x2;
     2451  // Calculate the resolution graph and the (total) multiplicities of f1*f2*f3.
     2452  list RESGR=totalmultiplicities(f1*f2*f3);
     2453  // Extend the (total) multiplicities.
     2454  list MULT=extend_multiplicities(RESGR);
     2455  // Compare the total multiplicities.
     2456  RESGR[2];
     2457  MULT[1];
     2458  // Compare the multiplicities.
     2459  RESGR[3];
     2460  MULT[2];
     2461}
     2462
     2463proc intmat_inverse (intmat M)
     2464"USAGE:      intmat_inverse(M); intmat M
     2465ASSUME:      M is a lower triangular integer matrix with diagonal entries 1 or -1
     2466RETURN:      intmat, the inverse of M
     2467KEYWORDS:    integer matrix, inverse
     2468EXAMPLE:     example intmat_inverse;   shows an example
     2469"
     2470{
     2471  int i,j,k;
     2472  int n=nrows(M);
     2473  intmat U[n][n];
     2474  for (i=1;i<=n;i++)
     2475  {
     2476    U[i,i]=1;
     2477  }
     2478  for (i=1;i<=n;i++)
     2479  {
     2480    if (M[i,i]==-1)
     2481    {     
     2482      M=addmultiplrows(M,i,i,-1,0);
     2483      U=addmultiplrows(U,i,i,-1,0);
     2484    }
     2485    for (j=i+1;j<=n;j++)
     2486    {     
     2487      U=addmultiplrows(U,i,j,-M[j,i],M[i,i]);
     2488      M=addmultiplrows(M,i,j,-M[j,i],M[i,i]);
     2489    } 
     2490  }
     2491  return(U);
     2492}
     2493example
     2494{
     2495  "EXAMPLE:";echo=2;
     2496  intmat M[5][5]=1,0,0,0,0,1,1,0,0,0,2,1,1,0,0,3,1,1,1,0,4,1,1,1,1 ;
     2497  intmat U=intmat_inverse(M);
     2498  print(U);
     2499  print(U*M);
     2500}
Note: See TracChangeset for help on using the changeset viewer.