Re: Linear algebra

*To*: mathgroup at smc.vnet.net*Subject*: [mg15990] Re: [mg15876] Linear algebra*From*: "Richard Finley" <rfinley at medicine.umsmed.edu>*Date*: Fri, 19 Feb 1999 03:27:07 -0500*Sender*: owner-wri-mathgroup at wolfram.com

Roland....here is a way to do it using Mma: Define the unit direction vectors for the diagonal of a cube in a matrix d d = {{1/Sqrt[3],1/Sqrt[3],1/Sqrt[3]},{-1/Sqrt[3],1/Sqrt[3],1/Sqrt[3]},{1/ Sqrt[3],-1/Sqrt[3], 1/Sqrt[3]},{1/Sqrt[3],1/Sqrt[3],-1/Sqrt[3]}} Find the unit direction vector of your line ...eg. if r = {r1,r2,r3} is the non-unit direction vector then n = r/Sqrt[r.r] will be the unit direction vector. Then your diagonal angles are given by v = ArcCos[d.n//Simplify] And finally the answer by Sum[Cos[v[[i]]]^2,{i,1,4}]//Simplify Which will give you the simple fractional answer (that does not depend on n!!). One doesn't actually need to go through all those computations but I did it that way to put it more closely into the form you requested. Hope that helps......regards, RF >>> Roland Bengtsson <d98rolb at stud.hh.se> 02/17/99 10:33PM >>> Let V1, V2, V3 and V4 be the angles that a given line create with the diagonals in space in a cube. How can I calc the sum of: (cos V1)^2 + (cos V2)^2 + (cos V3)^2 + (cos V4)^2 in Mathematica 3.0 or by hand? All help appreciated!