What am I doing wrong here? Maple: LinearSolve, conditionnumber, emf, etc.

106 Views Asked by At
rule := proc (i, j) options operator, arrow; evalf(1/(i+2*j-1)) end proc
A := Matrix(5, rule);
x := Vector(5, 1);
b := A . x;
sol := LinearSolve(A,b);
be := Norm(A, sol-b, infinity);
fe := Norm(x-sol, infinity);

ConditionNumber(A);

emf := fe*Norm(b . infinity)/(Norm(x . infinity)*be);

This is just not working out for me. I do not know what I am doing wrong.

1

There are 1 best solutions below

0
On

The question has been answered in the comments the post (why they were not posted as answers is not for me to know), but to summarize:

You need to be more careful about , and . in your calls to Norm.

Your corrected code should read:

with(LinearAlgebra):
rule := (i, j)->evalf(1/(i+2*j-1));
A := Matrix(5, rule);
x := Vector(5, 1);
b := A . x;
sol := LinearSolve(A, b);

be := Norm((A.sol)-b, infinity);
fe := Norm(x-sol, infinity);
ConditionNumber(A);
emf := fe*Norm(b, infinity)/(Norm(x, infinity)*be);