Ask Your Question

# Is there a way to find the symbolic matrix associated to an expended quadratic form?

Suppose I have a complex quadratic form

$Q(p_x,p_y)=p_y^2 y^2 \alpha^2 - 2 p_x p_y x y \alpha\beta + p_x^2 x^2 \beta^2 - p_y^2 y^2 \alpha -p_x^2 x^2 \beta$

Of course all parameters has been declared as variables, that is

var('p_x p_y x y \alpha \beta')

(I use unicode $\alpha$ and $\beta$)

Is there a way to find the matrix $\boldsymbol{A}$ such that

$Q(\boldsymbol{p})= \boldsymbol{p}^\top \boldsymbol{A}\boldsymbol{p}$ ?

edit retag close merge delete

## 1 Answer

Sort by » oldest newest most voted

The question is answered in https://ask.sagemath.org/question/680...

x,y,α,β=var('x,y,α,β')
P.<U,V> = PolynomialRing(SR, 'U,V')
hes0=(V^2*y^2*α^2 - 2*U*V*x*y*α*β + U^2*x^2*β^2 - V^2*y^2*α - U^2*x^2*β)
Q = QuadraticForm.from_polynomial(hes0)
mG=Q.Gram_matrix()
p_x,p_y=var('p_x,p_y')
v=vector([p_x,p_y])
expand(v*(mG*v))

p_y^2*y^2*α^2 - 2*p_x*p_y*x*y*α*β + p_x^2*x^2*β^2 - p_y^2*y^2*α - p_x^2*x^2*β

more

## Comments

Sorry achresz but I receive $Q$ as an expression and I was not able to substitute $V$ to $p_x$ et $U$ to $p_y$. And I do not know why

( 2023-05-06 19:26:38 +0200 )edit

## Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

## Stats

Asked: 2023-05-06 16:35:05 +0200

Seen: 139 times

Last updated: May 06 '23