Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

need precise obvious values solving V^t A V =p(x0,x1), A, V matrix

Hi

Is there a way to avoid having to specify the values of a00 a11 to SageMath

( which values are obvious to a human ) so that SageMath finds the solution ?

print('https://www.youtube.com/watch?v=JabOq1XZi9c&t=331s')
print(' now suppose we get the polynomial with mixed product :')
#R.<x1,x2> = PolynomialRing(QQ)
R.<x1,x2> =PolynomialRing(QQ, 2, order='lex')
p=2*(x1^2) - 4*x1*x2 + 5*(x2^2)
show('p(x1,x2) :',p)
print('first find the A matrix wich give this polynomial')
aVar=var('a00,a01,a10,a11')
A=matrix([ [a00,a01],[a10,a11] ])
VtAV=( Vx*A*(Vx.transpose()) ).det().expand()
show('VtAV : ',VtAV)

assume(a00,a11,'rational')
# to get symmetric matrix we need aij=aji

S=solve([VtAV==p,a01==a10],aVar)[0]
print(' no setting values for a00,a11 : ',S)

S=solve([VtAV==p,a00==2,a11==5,a01==a10],aVar)[0] 
print(' setting values  a00=2,a11=5 : ',S)

need precise obvious values solving V^t A V =p(x0,x1), A, V matrix

Hi

Is there a way to avoid having to specify the values of a00 a11 to SageMath

( which values are obvious to a human ) so that SageMath finds the solution ?

print('https://www.youtube.com/watch?v=JabOq1XZi9c&t=331s')
print(' now suppose we get the polynomial with mixed product :')
#R.<x1,x2> R.<x1,x2> = PolynomialRing(QQ)
R.<x1,x2> =PolynomialRing(QQ, 2, order='lex')
Vx=matrix([x1,x2])
p=2*(x1^2) - 4*x1*x2 + 5*(x2^2)
show('p(x1,x2) :',p)
print('first find the A matrix wich give this polynomial')
aVar=var('a00,a01,a10,a11')
A=matrix([ [a00,a01],[a10,a11] ])
VtAV=( Vx*A*(Vx.transpose()) ).det().expand()
show('VtAV : ',VtAV)

assume(a00,a11,'rational')
# to get symmetric matrix we need aij=aji

S=solve([VtAV==p,a01==a10],aVar)[0]
print(' no setting values for a00,a11 : ',S)

S=solve([VtAV==p,a00==2,a11==5,a01==a10],aVar)[0] 
print(' setting values  a00=2,a11=5 : ',S)

need precise obvious values solving V^t A V =p(x0,x1), A, V matrix

Hi

Is there a way to avoid having to specify the values of a00 a11 to SageMath

( which values are obvious to a human ) so that SageMath finds the solution ?

print('https://www.youtube.com/watch?v=JabOq1XZi9c&t=331s')
print('https://www.youtube.com/watch?v=JabOq1XZi9c&t=823s')
print(' now suppose we get the polynomial with mixed product :')
R.<x1,x2> = PolynomialRing(QQ)
Vx=matrix([x1,x2])
p=2*(x1^2) - 4*x1*x2 + 5*(x2^2)
show('p(x1,x2) :',p)
print('first find the A matrix wich give this polynomial')
aVar=var('a00,a01,a10,a11')
A=matrix([ [a00,a01],[a10,a11] ])
VtAV=( Vx*A*(Vx.transpose()) ).det().expand()
show('VtAV : ',VtAV)

assume(a00,a11,'rational')
# to get symmetric matrix we need aij=aji

S=solve([VtAV==p,a01==a10],aVar)[0]
print(' no setting values for a00,a11 : ',S)

S=solve([VtAV==p,a00==2,a11==5,a01==a10],aVar)[0] 
print(' setting values  a00=2,a11=5 : ',S)