# quadratic form

Write a function in Sage that accepts as input a symmetrical bilinear (not trivial) form B [caracterized by the associated matrix respect to the canonical base in R^n] and gives in output a vector subspace W ⊆ R^n such that: - Dim W is maximal - the restriction B|wxw has maximum rank

This looks like homework.

If you want some help, you should ask more precise questions related to your research in solving those exercises, especially where you are locked.

i'm a sage beginner, i know what to do but i don't know how to implement it.. the idea is that i want to give in input a symmetrical nontrivial matrix A associated to the bilinear form B respect to the canonical base in R^n..then i want to obtain a subspace W⊆ R^n of maximal dimension such that the restriction B|wxw has max rank, in other words the matrix associated to this restriction has maximum rank and this condition occurs if kerW=[0].So i have to : 1. Give in input a matrix, 2. Declare the canonical basis of R^n and R 3. If B is the bilinear form and ei elements of the canonical base of R^n, i say that B(ei,ej)= A(i,j) with A(i,j) the i,j element of A 4. Obtain a subspace W ...(more)

Please give us a symmetric matrix

`A`

to work with. Relevant code to initialize it can be found after typing`?matrix`

. Sample code for a matrix of my choice (maximal rank):def function(Q):

When i give as input a quadratic form Q such as Q=QuadraticForm(SR,4,[0,0,0,1,0,-1,0,0,0,0]) W=function(Q) the program give me a lot of errors

The following works (over

`QQ`

instead of`SR`

):Results: