Post Reply 
Gramschmidt and scalar product
05-08-2021, 08:59 AM
Post: #1
Gramschmidt and scalar product
Hello
The explanation of this function says:
" Given a basis of a vector subspace, and a function that defines a scalar product, returns an orthonormal basis for that function".

I do not know how to it, I will put an example:
Scalar product defined by: <(x1,x2),(y1,y2)> = x1y1-x1y2-x2y1+2x2y2
Given a basis such as: B={(1,2), (3,4)}

How can I use the function to get an orthonormal basis?
If I put
gramschmidt([[1 2][3 4]],(a,b,c,d)->(a*b-a*d-b*c+2*b*d))

Gives me an error "Bad Argument Value"

Is there a way to do this?

Thanks in advance

Toni

[/i]
Find all posts by this user
Quote this message in a reply
05-08-2021, 10:34 AM
Post: #2
RE: Gramschmidt and scalar product
A scalar product takes 2 arguments (the vectors), not four (the coordinates).
I recommend to define the scalar product separately. With indices starting at 0:
Code:

sp(v,w):=v[0]*w[0]-v[1]*w[0]-w[1]*v[0]+2*v[1]*w[1];
B:=gramschmidt([[1,2],[3, 4]],sp)
You can check with sp(B[0],B[0]); sp(B[0],B[1]); sp(B[1],B[1])
Find all posts by this user
Quote this message in a reply
05-08-2021, 12:31 PM
Post: #3
RE: Gramschmidt and scalar product
gramschmidt([1,1+x],(p,q)->2*p*q)

returns:

[1/sqrt(2),±∞*(-x-1+x+1)/sqrt(2)]

am i doing something wrong? Why is there a ±∞ in there?

-road
Find all posts by this user
Quote this message in a reply
05-08-2021, 01:40 PM
Post: #4
RE: Gramschmidt and scalar product
Thanks very much for your fast answer. Very useful. It works.

Regarding the p*q, I would say that the "x" is not defined so there you have ±inf. I suppose.
You may do the definition before as Parise did with "sp:= …"

Thanks again

Toni
Find all posts by this user
Quote this message in a reply
05-08-2021, 06:50 PM
Post: #5
RE: Gramschmidt and scalar product
(05-08-2021 12:31 PM)roadrunner Wrote:  gramschmidt([1,1+x],(p,q)->2*p*q)

returns:

[1/sqrt(2),±∞*(-x-1+x+1)/sqrt(2)]

am i doing something wrong? Why is there a ±∞ in there?

-road
1+x is lineary dependent of 1, because your scalar product is defined on R.

If you want to have something more interesting define a scalar product with an integral or by evaluating p and q at some points, like
gramschmidt([1,1+x],(p,q)->subst(p,x=0)*subst(q,x=0)+subst(p,x=1)*subst(q,x=1))
Find all posts by this user
Quote this message in a reply
05-09-2021, 11:17 AM
Post: #6
RE: Gramschmidt and scalar product
Thanks Tonig00 and parisse; i got it figured out now.

-road
Find all posts by this user
Quote this message in a reply
Post Reply 




User(s) browsing this thread: 1 Guest(s)