HP Forums
Find a basis from cartesian equations - Printable Version

+- HP Forums (https://www.hpmuseum.org/forum)
+-- Forum: HP Calculators (and very old HP Computers) (/forum-3.html)
+--- Forum: HP Prime (/forum-5.html)
+--- Thread: Find a basis from cartesian equations (/thread-8949.html)



Find a basis from cartesian equations - Tonig00 - 08-31-2017 07:06 PM

Hello
I want to find an easier way to find vectors which are a basis of a vector space defined by cartesian equations. For eixample:
x1+2x2+x3+2x4+x5=0
-x1-2x2-x4+2x5=0
x1+2x2+3x3+4x4+7x5=0

So, first I reduce the system (applying Gauss reduction):
I use RREF(matrix of coefficients of the system)
rref([[1,2,1,2,1],[-1,-2,0,-1,2],[1,2,3,4,7]])
to obtain
[[1,2,0,1,-2],[0,0,1,1,3],[0,0,0,0,0]]

So we have two equations which means the subspace represented have 5-2 dimensions. So for a basis of this space we need three independent vectors.

Next I use solve() giving values to find three possible vectors:
solve([[x1+2*x2+x4-2*x5,x3+x4+3*x5,x2 = 1,x4 = 0,x5 = 0]],[x1,x2,x3,x4,x5])
which gives {[-2,1,0,0,0]}

So I will change values for x2=0, x4=1 and X5=0 which gives {[-1,0,-1,1,0]}

And third and last I change x2=0, X4=0 and X5=1 which gives {[2,0,-3,0,1]}

This is a very complicated way, to obtain the three vectors of the basis.
Is there a function to solve this directly?

Thanks for your help

Toni


RE: Find a basis from cartesian equations - AlexFekken - 09-01-2017 10:04 AM

I suppose you could combine the last 3 steps by setting x2=a, x4=b, x5=c, with a, b and c unassigned.


RE: Find a basis from cartesian equations - Helge Gabert - 09-01-2017 02:34 PM

Good point!

You could also use gbasis instead of RREF (that way, you wouldn't have to type the coefficients into a matrix).


RE: Find a basis from cartesian equations - Tonig00 - 09-01-2017 08:14 PM

Thanks very much for your helpful answers.
Both works:
First give {[-2*a-b+2*c,a,-b-3*c,b,c]}which giving values to a,b,c give same answer in one step (before three).

Second just jumps one step, so both together make it easier.

Anyway, if someone finds a direct way tell me
thanks again

Toni


RE: Find a basis from cartesian equations - Tonig00 - 09-04-2017 12:26 PM

Hello again

I have seen a different possibility. May not be very mathematically appropiate but the result seems OK:
The kernel of a linear map is a set of the vectors whose image is (0...0). So up to a point vectros who solve the equations.

If you aply Ker(matrix of coefficients of the former equations), this gives directly the the vectors of the basis in just one operation.

With so many functions it is not easy to find one that fits what you are looking for. HP manual is not very extensive.

Thanks again

Toni


RE: Find a basis from cartesian equations - parisse - 09-06-2017 06:01 AM

Inside Giac/Xcas, syst2mat does the conversion from linear equations to matrix form, unfortunately it is not available on the Prime.
m:=syst2mat([x1+2x2+x3+2x4+x5=0,-x1-2x2-x4+2x5=0,x1+2x2+3x3+4x4+7x5=0],[x1,x2,x3,x4,x5]);
ker(m[0..2,0..4]);