Linear Algebra - Matrix Algebra Module

Linear Algebra - Matrix Algebra Module - Bill Knowlton and...

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: Bill Knowlton and Wan Kuang ECE and MSE Departments Boise State University Linear Algebra and Matrix Algebra Module Linear equations are very common in Engineering and science problems. This tutorial will teach you how to use Mathemat- ica to solve such equations. Given three linear equations, 4x + 3y + (-1) z = 9 5x + (-9) y+2 z = 3 x + y + z = 1 the unknowns x , y , and z can be solved directly with Solve . For example, Clear @ x, y, z D Solve @8 4 x + 3 y + H 1 L z == 9, 5 x + H 9 L y + 2 z == 3, x + y + z == 1 < , 8 x, y, z <D 99 x 114 cccccccccc 67 , y 25 ccccccc 67 , z 72 ccccccc 67 == However a more efficient approach is to take advantage of matrix mathematics. The unknowns x , y , and z in the previous equations can be written as, i k j j j j j j j 4 3 1 5 9 2 1 1 1 y { z z z z z z z i k j j j j j j j x y z y { z z z z z z z = i k j j j j j j j 9 3 1 y { z z z z z z z The three unknowns can be calculated directly with LinearSolve . LinearSolve works on both numerical and symbolic matrices, as well as SparseArray objects. For example, M1 = 88 4, 3, 1 < , 8 5, 9, 2 < , 8 1, 1, 1 << ; M2 = 88 9 < , 8 3 < , 8 1 << ; xyzAnswer = LinearSolve @ M1, M2 D ; Print @ " 8 x,y,z < = ", xyzAnswer D 8 x,y,z < = 99 114 cccccccccc 67 = , 9 25 ccccccc 67 = , 9 72 ccccccc 67 == in which, M1 is the coefficient matrix and M2 is a column vector representing the right-hand-side of the equations. Note that the matrix can also be solved by multiplying the inversion of M1 and M2, however such an approach is far slower and...
View Full Document

Page1 / 4

Linear Algebra - Matrix Algebra Module - Bill Knowlton and...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online