




Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!





(^) restart: (^) with(linalg);
Warning, the protected names norm and trace have been redefined and unprotected
[BlockDiagonal , GramSchmidt, JordanBlock , LUdecomp, QRdecomp, Wronskian, addcol ,
addrow , adj , adjoint, angle, augment, backsub, band , basis, bezout, blockmatrix , charmat, charpoly, cholesky, col , coldim, colspace, colspan, companion, concat, cond , copyinto, crossprod , curl , definite, delcols, delrows, det, diag, diverge, dotprod , eigenvals, eigenvalues, eigenvectors, eigenvects, entermatrix , equal ,
exponential , extend , ffgausselim, fibonacci, forwardsub, frobenius, gausselim, gaussjord , geneqns, genmatrix , grad , hadamard , hermite, hessian, hilbert, htranspose, ihermite, indexfunc, innerprod , intbasis, inverse, ismith, issimilar , iszero, jacobian, jordan, kernel , laplacian, leastsqrs, linsolve, matadd , matrix , minor , minpoly, mulcol , mulrow , multiply, norm, normalize, nullspace, orthog, permanent, pivot, potential , randmatrix , randvector , rank , ratform, row , rowdim, rowspace, rowspan, rref , scalarmul, singularvals, smith, stackmatrix , submatrix ,
subvector , sumbasis, swapcol , swaprow , sylvester , toeplitz , trace, transpose, vandermonde, vecpotent, vectdim, vector , wronskian]
Scalar projection of v onto w is given by v √T^ w wT^ w Vector projection of v onto w is given by w v
T (^) w wT^ w
(^) v := array(1..3,1..1,[[2],[1],[3]]); (^) w := array(1..3,1..1,[[6],[3],[9]]);
v :=
w :=
(^) num := multiply( transpose(v), w)[1,1]: (^) den := sqrt(multiply( transpose(w), w )[1,1]): (^) alpha := num/den; α :=
(^) p := scalarmul(w,multiply( transpose(v), w)[1,1]/ (^) multiply( transpose(w), w)[1,1]);
p :=
(^) v := array(1..2,1..1,[[2],[-3]]); w := array(1..2,1..1,[[3],[2]]);
v :=
w :=
(^) num := multiply( transpose(v), w)[1,1]: (^) den := sqrt(multiply( transpose(w), w )[1,1]): (^) alpha := num/den; α := 0 (^) p := scalarmul(w,multiply( transpose(v), w)[1,1]/ (^) multiply( transpose(w), w)[1,1]);
p :=
(^) v := array(1..2,1..1,[[4],[1]]); (^) w := array(1..2,1..1,[[3],[2]]);
v :=
w :=
(^) num := multiply( transpose(v), w)[1,1]: (^) den := sqrt(multiply( transpose(w), w )[1,1]): (^) alpha := num/den;
α :=
(^) p := scalarmul(w,multiply( transpose(v), w)[1,1]/ (^) multiply( transpose(w), w)[1,1]);
p :=
(^) v := array(1..3,1..1,[[-2],[3],[1]]); (^) w := array(1..3,1..1,[[1],[2],[4]]);
v :=
x :=
y :=
(^) num := multiply( transpose(x), y)[1,1]: (^) den := sqrt(multiply( transpose(y), y )[1,1]): (^) alpha := num/den; α := 4
(^) p := scalarmul(y,multiply( transpose(x), y)[1,1]/ (^) multiply( transpose(y), y)[1,1]);
p :=
(^) xmp := matadd(x,-p);
xmp :=
(^) multiply(transpose(p), xmp)[1,1]; 0
(^) x := array(1..3,1..1,[[2],[4],[3]]); (^) y := array(1..3,1..1,[[1],[1],[1]]);
x :=
y :=
(^) num := multiply( transpose(x), y)[1,1]: (^) den := sqrt(multiply( transpose(y), y )[1,1]): (^) alpha := num/den; α := 3
(^) p := scalarmul(y,multiply( transpose(x), y)[1,1]/ (^) multiply( transpose(y), y)[1,1]);
p :=
(^) xmp := matadd(x,-p);
xmp :=
(^) multiply(transpose(p), xmp)[1,1]; 0
(^) x := array(1..3,1..1,[[2],[-5],[4]]); (^) y := array(1..3,1..1,[[1],[2],[-1]]);
x :=
y :=
(^) num := multiply( transpose(x), y)[1,1]: (^) den := sqrt(multiply( transpose(y), y )[1,1]): (^) alpha := num/den; α := − 2
(^) p := scalarmul(y,multiply( transpose(x), y)[1,1]/ (^) multiply( transpose(y), y)[1,1]);
p :=
(^) xmp := matadd(x,-p);
xmp :=
(^) multiply(transpose(p), xmp)[1,1]; 0
3 Problem 4
Since — xT^ y—<=——x—— ——y—— = 6, we can conclude that 0 <= — xT^ y— <= 6
4 Problem 5
The line y=2x points in the direction (1,2)
(^) w := array(1..2,1..1,[[1],[2]]);
w :=
(^) v := array(1..2,1..1,[[5],[2]]);
v :=
(^) num := multiply( transpose(v), w)[1,1]: (^) den := sqrt(multiply( transpose(w), w )[1,1]): (^) alpha := num/den;
w :=
(^) v := array(1..2,1..1,[[1],[2]]);
v :=
(^) num := multiply( transpose(v), w)[1,1]: (^) den := sqrt(multiply( transpose(w), w )[1,1]): (^) alpha := num/den;
α :=
(^) p := scalarmul(w,multiply( transpose(v), w)[1,1]/ (^) multiply( transpose(w), w)[1,1]);
p :=
(^) Q := evalf(transpose(p)); Q :=
(^) differ := matadd(v,-p);
differ :=
(^) sqrt(multiply( transpose(differ), differ)[1,1]);
2 5
(^) evalf(%);
. 4000000000
7 Problem 8
(^) P := array(1..3,1..1,[[x],[y],[z]]);
x y z
(^) P0 := array(1..3,1..1,[[0],[0],[0]]);
(^) N := array(1..3,1..1,[[2],[4],[3]]);
(^) multiply( transpose(N),matadd(P,-P0))[1,1]=0; 2 x + 4 y + 3 z = 0
(^) P := array(1..3,1..1,[[x],[y],[z]]);
x y z
(^) P0 := array(1..3,1..1,[[4],[2],[-5]]);
(^) N := array(1..3,1..1,[[-3],[6],[2]]);
(^) multiply( transpose(N),matadd(P,-P0))[1,1]=0; − 3 x + 10 + 6 y + 2 z = 0
(^) P := array(1..3,1..1,[[x],[y],[z]]);
x y z
(^) P0 := array(1..3,1..1,[[3],[2],[4]]);
(^) N := array(1..3,1..1,[[0],[0],[1]]);
(^) multiply( transpose(N),matadd(P,-P0))[1,1]=0; z − 4 = 0