O'Reilly logo

GNU Octave by Jesper Schmidt Hansen

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Time for action – doing left and right division

  1. We need to instantiate the coefficient matrix A and vector y first:
    octave:93> A=[2 1 -3; 4 -2 -2; -1 0.5 -0.5]; y = [1; 3; 1.5];
    
  2. The solution to the linear equation system, Equation (2.6), is then found directly via the command:
    octave:94> A\y
    
    ans =
        -1.6250
        -2.5000
        -2.2500
    

    Easy!

What just happened?

It should be clear what happened. In Command 93, we instantiated the matrix A and the vector y that define the linear equation system in Equation (2.6). We then solve this system using the left division operator. Later in Chapter 6, we will investigate how the left division operator performs for very large systems.

Let us try the right division operator, even though we know that it will cause problems: ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required