Opened 16 years ago

Closed 15 years ago

Last modified 15 years ago

#61 closed proposed feature (fixed)

jacobian for matrices/modules

Reported by: Oleksandr Owned by: Oleksandr
Priority: minor Milestone: Release 3-1-0
Component: singular-kernel Version:
Keywords: jacobian, jacob Cc: hannes

Description

Problem: jacob in Singular doesn't work for modules/matrices. See Singular help:

Syntax: 
jacob ( poly_expression ) 
jacob ( ideal_expression ) 
Type: 
ideal, if the input is a polynomial 
matrix, if the input is an ideal 
Purpose: 
computes the Jacobi ideal, resp. Jacobi matrix, 
generated by all partial derivatives of the input. 
Example:  	  
  ring R;
  poly f=x2+y3+z5;
  jacob(f);
==> _[1]=2x
==> _[2]=3y2
==> _[3]=5z4
  ideal i=jacob(f);
  print(jacob(i));
==> 2,0, 0,  
==> 0,6y,0,  
==> 0,0, 20z3

jacobian in M2 works as follows:

R = ZZ[a,b,c, d,e,f, g,h][x,y]

o1 = R

o1 : PolynomialRing





M = matrix{{a*x+b*y, c*x+d*y}, {e*x+f*y, g*x+h*y}}

o2 = | xa+yb xc+yd |
     | xe+yf xg+yh |

             2       2
o2 : Matrix R  <--- R

diff(x, M)

o3 = | a c |
     | e g |

             2       2
o3 : Matrix R  <--- R
diff(y, M)

o4 = | b d |
     | f h |

             2       2
o4 : Matrix R  <--- R
jacobian M -- concates vertically the above diffs:

o5 = {1} | a c |
     {1} | e g |
     {1} | b d |
     {1} | f h |

             4       2
o5 : Matrix R  <--- R





M = matrix{{a*x+b*y, c*x+d*y}}

o6 = | xa+yb xc+yd |

             1       2
o6 : Matrix R  <--- R

diff(x, M)

o7 = | a c |

             1       2
o7 : Matrix R  <--- R
diff(y, M)

o8 = | b d |

             1       2
o8 : Matrix R  <--- R
jacobian M -- concates vertically the above diffs:

o9 = {1} | a c |
     {1} | b d |

             2       2
o9 : Matrix R  <--- R





M = matrix{{a*x+b*y},{c*x+d*y}}

o10 = | xa+yb |
      | xc+yd |

              2       1
o10 : Matrix R  <--- R

diff(x, M)

o11 = | a |
      | c |

              2       1
o11 : Matrix R  <--- R
diff(y, M)

o12 = | b |
      | d |

              2       1
o12 : Matrix R  <--- R
jacobian M -- concates vertically the above diffs:

o13 = {1} | a |
      {1} | c |
      {1} | b |
      {1} | d |

              4       1
o13 : Matrix R  <--- R

and has the following help there:

jacobian(Matrix) -- the matrix of partial derivatives of polynomials in a matrix
Synopsis
Usage: jacobian f

Function: jacobian
Inputs:
f, a matrix, with one row
Outputs:
a matrix, the Jacobian matrix of partial derivatives of the polynomial entries of f
Description
If f is a 1 by m matrix over a polynomial ring R with n indeterminates, then the resulting matrix of partial derivatives has dimensions n by m, and the (i,j) entry is the partial derivative of the j-th entry of f by the i-th indeterminate of the ring.

If the ring of f is a quotient polynomial ring S/J, then only the derivatives of the given entries of f are computed and NOT the derivatives of elements of J.i1 : R = QQ[x,y,z];
i2 : f = matrix{{y^2-x*(x-1)*(x-13)}}

o2 = | -x3+14x2+y2-13x |

             1       1
o2 : Matrix R  <--- R
i3 : jacobian f

o3 = {1} | -3x2+28x-13 |
     {1} | 2y          |
     {1} | 0           |

             3       1
o3 : Matrix R  <--- R

If the ring of f is a polynomial ring over a polynomial ring, then indeterminates in the coefficient ring are treated as constants.i4 : R = ZZ[a,b,c][x,y,z]

o4 = R

o4 : PolynomialRing
i5 : jacobian matrix{{a*x+b*y^2+c*z^3, a*x*y+b*x*z}}

o5 = {1} | a    ya+zb |
     {1} | 2yb  xa    |
     {1} | 3z2c xb    |

             3       2
o5 : Matrix R  <--- R

Attachments (5)

jacobiM.m2 (1.7 KB) - added by Oleksandr 16 years ago.
test for M2
jacobiM.m2.out (1.3 KB) - added by Oleksandr 16 years ago.
output of M2
jacobian.help.M2 (1.3 KB) - added by Oleksandr 16 years ago.
description of jacobian in M2
jacobiM.m2.sing (1.4 KB) - added by Oleksandr 16 years ago.
My jacob/jacobM Tests in Singular
jacobiM.m2.sing.out (3.4 KB) - added by Oleksandr 16 years ago.
... and Singular output

Download all attachments as: .zip

Change History (12)

Changed 16 years ago by Oleksandr

Attachment: jacobiM.m2 added

test for M2

Changed 16 years ago by Oleksandr

Attachment: jacobiM.m2.out added

output of M2

Changed 16 years ago by Oleksandr

Attachment: jacobian.help.M2 added

description of jacobian in M2

comment:1 Changed 16 years ago by Oleksandr

It seems that "jacobM" from sheafCoh.lib follow M2 convention, which seems to be INCONSISTENT with our jacob. See Singular examples further on:

Changed 16 years ago by Oleksandr

Attachment: jacobiM.m2.sing added

My jacob/jacobM Tests in Singular

Changed 16 years ago by Oleksandr

Attachment: jacobiM.m2.sing.out added

... and Singular output

comment:2 Changed 16 years ago by hannes

diff(module.var) has wrong rank ->fixed.

comment:3 Changed 16 years ago by Oleksandr

Current Singular conventions for jacob are as follows:

For a polynomial p: jacob(p)= ideal( diff(p,var(1)) | ... | diff(p,var(n)) )

For an ideal I (considered as a row): jacob(I)= matrix( transpose(diff(I,var(1))) | ... | transpose(diff(I,var(n))) )

Therefore i propose the following format for jacob(module/matrix):

jacob(M) := ( transpose(diff(M,var(1))) | ... | transpose(diff(M,var(n))) )

E.g. for a matrix/module M:

| xa+yb xc+yd |
| xe+yf xg+yh |

jacob(M) should be the following matrix/module:

| a e b f |
| c g d h |,

whereas jacobian output in M2 is transposed (which is also the case for ideals):

o5 = {1} | a c |
     {1} | e g |
     {1} | b d |
     {1} | f h |

comment:4 Changed 15 years ago by Oleksandr

Owner: changed from hannes to Oleksandr

I have implemented the above method and it works fine in all my tests! Therefore, i will add something to its documentation and close this ticket...

ps: jacob doesn't care about module-graduation (no "isHomog" attribute!)

comment:5 Changed 15 years ago by Oleksandr

i have updated jacob description in reference.doc and added a message to NEWS.texi.

comment:6 Changed 15 years ago by Oleksandr

Resolution: fixed
Status: newclosed

please, check description...

comment:7 Changed 15 years ago by seelisch

Milestone: Release 3-1-0
Note: See TracTickets for help on using tickets.