ASKSAGE: Sage Q&A Forum - Individual question feedhttp://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Tue, 25 Apr 2017 13:42:35 -0500Jacobian matrix rankhttp://ask.sagemath.org/question/37351/jacobian-matrix-rank/Consider the following code :
R.<x,y,z> = QQ[];
p=(x-y)*(y-z)*(x-z);
J = matrix(R,[[x-y],[y]]);
J.rank();
The answer displayed is 1. This is the rank over the polynomia ring I suppose. I would like to compute rank over the field of rationals. That is if there are rational numbers a,b and c such that
a diff(p,x) + b diff(p,y) + c diff(p,z) =0 but a,b,c non zero then rank should be 3.
What is the way to do it ?Thu, 20 Apr 2017 12:08:36 -0500http://ask.sagemath.org/question/37351/jacobian-matrix-rank/Comment by dan_fulea for <p>Consider the following code :</p>
<p>R.<x,y,z> = QQ[];</p>
<p>p=(x-y)<em>(y-z)</em>(x-z);</p>
<p>J = matrix(R,[[x-y],[y]]);</p>
<p>J.rank();</p>
<p>The answer displayed is 1. This is the rank over the polynomia ring I suppose. I would like to compute rank over the field of rationals. That is if there are rational numbers a,b and c such that
a diff(p,x) + b diff(p,y) + c diff(p,z) =0 but a,b,c non zero then rank should be 3. </p>
<p>What is the way to do it ?</p>
http://ask.sagemath.org/question/37351/jacobian-matrix-rank/?comment=37353#post-id-37353The matrix is defined over a "bigger" ring, $R$. So it is computed over the ring of definition....
sage: R.<x,y,z> = QQ[]
sage: # p = (x-y)*(y-z)*(x-z) # (?!)
sage: J = matrix( R, 2,1, [ x-y, y ] )
sage: J.rank()
1
sage: J.parent()
Full MatrixSpace of 2 by 1 dense matrices over Multivariate Polynomial Ring in x, y, z over Rational Field
Using `J.rank?` or `J.rank??` gives more info. In our case, the work is delegated to `J.pivots()`. (The length of this list of pivots is the rank.)Thu, 20 Apr 2017 14:54:48 -0500http://ask.sagemath.org/question/37351/jacobian-matrix-rank/?comment=37353#post-id-37353Answer by tmonteil for <p>Consider the following code :</p>
<p>R.<x,y,z> = QQ[];</p>
<p>p=(x-y)<em>(y-z)</em>(x-z);</p>
<p>J = matrix(R,[[x-y],[y]]);</p>
<p>J.rank();</p>
<p>The answer displayed is 1. This is the rank over the polynomia ring I suppose. I would like to compute rank over the field of rationals. That is if there are rational numbers a,b and c such that
a diff(p,x) + b diff(p,y) + c diff(p,z) =0 but a,b,c non zero then rank should be 3. </p>
<p>What is the way to do it ?</p>
http://ask.sagemath.org/question/37351/jacobian-matrix-rank/?answer=37352#post-id-37352Yes it is the rank over the polynomial ring. Houw could it be the rank over the rationals ? Note that ``x`` and ``y`` do not belong to the rational field, but the rank depends on the rational values you associate to them (the zero vector has rank 0, the other have rank one):
sage: J.substitute({x:0,y:0}).rank()
0
sage: J.substitute({x:0,y:1}).rank()
1Thu, 20 Apr 2017 14:38:43 -0500http://ask.sagemath.org/question/37351/jacobian-matrix-rank/?answer=37352#post-id-37352Comment by dan_fulea for <p>Yes it is the rank over the polynomial ring. Houw could it be the rank over the rationals ? Note that <code>x</code> and <code>y</code> do not belong to the rational field, but the rank depends on the rational values you associate to them (the zero vector has rank 0, the other have rank one): </p>
<pre><code>sage: J.substitute({x:0,y:0}).rank()
0
sage: J.substitute({x:0,y:1}).rank()
1
</code></pre>
http://ask.sagemath.org/question/37351/jacobian-matrix-rank/?comment=37428#post-id-37428This makes no sense. The Jacobian matrix can be computed easily (in sage):
sage: var( 'x,y,z' );
sage: J = jacobian( p, [x,y,z] )
sage: J
[ (x - y)*(y - z) + (x - z)*(y - z) (x - y)*(x - z) - (x - z)*(y - z) -(x - y)*(x - z) - (x - y)*(y - z)]
and this is a 3x1 matrix. Its rank is at most one! The rank is one, if $x,y,z$ are seen as (transcendental) independent variables. If we want to see for which **numbers** $x,y,z$ the rank is *not one* (which is generically the case), but **zero** (not three, this makes no sense), and this is a different question starting from a different question, then the following finds the point $(x,y,z)$:
sage: solve( [ component==0 for component in J[0] ], [x,y,z] )
[[x == r1, y == r1, z == r1]]
$p'(x,y,z)$ is zero iff $x=y=z$.Tue, 25 Apr 2017 13:42:35 -0500http://ask.sagemath.org/question/37351/jacobian-matrix-rank/?comment=37428#post-id-37428Comment by srini for <p>Yes it is the rank over the polynomial ring. Houw could it be the rank over the rationals ? Note that <code>x</code> and <code>y</code> do not belong to the rational field, but the rank depends on the rational values you associate to them (the zero vector has rank 0, the other have rank one): </p>
<pre><code>sage: J.substitute({x:0,y:0}).rank()
0
sage: J.substitute({x:0,y:1}).rank()
1
</code></pre>
http://ask.sagemath.org/question/37351/jacobian-matrix-rank/?comment=37356#post-id-37356I would like to compute rank over the field of rationals. That is if there are rational numbers a,b and c such that a diff(p,x) + b diff(p,y) + c diff(p,z) =0 but a,b,c non zero then rank should be 3. What is the way to code this ?Thu, 20 Apr 2017 22:36:18 -0500http://ask.sagemath.org/question/37351/jacobian-matrix-rank/?comment=37356#post-id-37356