Advertisement
Guest User

M346 Section 6.4 Number 5

a guest
Apr 2nd, 2018
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Julia 0.65 KB | None | 0 0
  1. # Problem 6.4 Number 5
  2. # Problem givens:
  3. b1 = [1; 1; 1]
  4. b2 = [-2; 1; 1]
  5. b3 = [0; 1; -1]
  6. d1 = b1/norm(b1)
  7. d2 = b2/norm(b2)
  8. d3 = b3/norm(b3)
  9. L(x) = [x[1]; x[2]; -x[3]]
  10.  
  11. # Using formula from current section 6.4: $A_{ij} = \bk{d_i}{L(d_j)}$
  12. LD = [dot(d1, L(d1)) dot(d1, L(d2)) dot(d1, L(d3)); dot(d2, L(d1)) dot(d2, L(d2)) dot(d2, L(d3)); dot(d3, L(d1)) dot(d3, L(d2)) dot(d3, L(d3))]
  13.  
  14. # Verification using older technique
  15. # conversion matrix from basis D to standard basis E
  16. PED = hcat(d1, d2, d3)
  17. # Matrix in standard basis is quite intuitive, just reverse x_3 in three standard basis vectors.
  18. LE = [1 0 0; 0 1 0; 0 0 -1]
  19. LD2 = inv(PED) * LE * PED
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement