Skip to content

Instantly share code, notes, and snippets.

@DiamondLovesYou
Last active September 15, 2016 11:19
Show Gist options
  • Save DiamondLovesYou/37f9c5847b828147b0d16fb4148ae679 to your computer and use it in GitHub Desktop.
Save DiamondLovesYou/37f9c5847b828147b0d16fb4148ae679 to your computer and use it in GitHub Desktop.

Exercise2_15.m

v = 50;
A = [
    11 -5 0 0 0 -1;
    -20 41 -15 0 -6 0;
    0 -3 7 -4 0 0;
    0 0 -1 2 -5 0;
    0 -3 0 -10 28 -15;
    -2 0 0 0 -15 47;
    ];

[A, success, pivots, cond] = Factor(A);

b = [
    5 * v;
    0;
    0;
    0;
    0;
    0;
    ];

assert(success == 0, 'can not factor');
disp(cond);

x = Solve(A, pivots, b);

disp(x);

stdout

The first number is the condition number, the rest are vi in order.

Exercise2_15
     7.019005935418257e+01

     2.705745341614907e+01
     9.704968944099383e+00
    -6.987577639751547e+00
    -1.950698757763974e+01
    -6.405279503105588e+00
    -8.928571428571426e-01

diary off
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment