1.7.5. Implementation.

We will use Maple and its ability to control the number of digits in the floating point calculations to illustrate the above ill-conditioned problems.

Consider the 2 by 2 matrix from the trajectory problem.

The Maple procedure Digits is used to control the number of digits.

		> Digits:=10;

> a:=matrix(2,2,[1,1,1,1.001]);

The Maple procedure cond is used to measure the ill-conditioning.

		> cond(a);

>4004.001000

The Maple procedure linsolve is used with various numbers of digits.

		> linsolve(a,[1,3]);

>[-1999. 2000.]

> Digits:=3;

NO SOLUTION....Divide by zero

> Digits:=4;

>[-1997. 1998.]

> Digits:=5;

>[-1999. 2000.]

Consider the 3 by 3 matrix from the function approximation problem. Assume the function to be approximated satisfies f(1) = 1, f(1.1) = 2 and f(1.11) = 3.

The Maple procedure Digits is used to control the number of digits.

		> Digits:=10;

a:=matrix(3,3,[1,1,1,1,1.1,1.21,1,1.11,1.2321]);

The Maple procedure cond is used to measure the ill-conditioning.

		> cond(a);

>14103.66200

The Maple procedure linsolve is used with various numbers of digits.

		> sol:=linsolve(a,[1,2,3]);		
		> sol := [890.9998480 -1708.181530 818.1816817]

> Digits:=3:

> sol3:=linsolve(a,[1,2,3]);

> sol3 := [259. -508. 249.]

> Digits:=5:

> sol5 :=linsolve(a,[1,2,3]);

> sol5 := [897.61 -1720.8 824.19]

> Digits:=8;

> sol8:=linsolve(a,[1,2,3]);

> sol8 := [891.04811 -1708.2737 818.22559]

Return to Section TOC
Return to the Previous Subsection
Go to Next Subsection