Using Maple to find forward error and error magnification factor.

636 Views Asked by At

I am trying to use Maple to easily find a forward error and error magnification factor. Is there a specific command for this?? I know to find forward error the equation is ${{\lvert{\lvert{x-x_a}\rvert}\rvert}}$ I also know that to find the error magnification: {${{\lvert{\lvert{x-x_a}\rvert}\rvert}_\infty}$/${\lvert{{\lvert{x}\rvert}\rvert}_\infty}$} /{${{\lvert{{\lvert{b-Ax_a}}\rvert}\rvert}_\infty}$}/{${{\lvert{\lvert{b}\rvert}\rvert}_\infty}$} I used the command LinearSolve to compute an $x_c$, where can I go from there? Also I am dealing with an ill-conditioned matrix.

1

There are 1 best solutions below

3
On BEST ANSWER

The forward error in solution of $Ax = b$ is the difference between the computed $x$ (which I suppose is your $x_a$) and the true $x$. If your $A$ and $b$ have rational entries, Maple can compute the exact rational solution (LinearSolve again, but using rational numbers instead of floats), and you can directly compare the result to $x_a$. Of course this might not be practical unless the matrix and vector are fairly small and the rationals have fairly small denominators.

EDIT: If this is not practical, you can try using floats again, but with higher precision, say Digits = 30 or 50. It should give you a result that is much closer to the true value.

Another possibility, if you have the freedom to choose $b$, is to start with an $x$ of your choice, compute $b = Ax$, and then go on from there.

Here's an example with a notoriously ill-conditioned $15 \times 15$ matix:

> with(LinearAlgebra):
> A:= evalf(HilbertMatrix(15)):
> xtrue:= evalf(RandomVector(15)):
> b:= A . xtrue:
> xa:= LinearSolve(A, b):
> Norm(xtrue - xa, infinity);

$$ 0.00150063633521213546 $$

> Magnification:= (Norm(xtrue - xa,infinity) /    
Norm(xtrue,infinity))/(Norm(b - A.xa,infinity)/Norm(b,infinity));

$$Magnification := 8.202318911 \times 10^{10}$$