--> Errata
Vol20 should be 12, not 4.
Vol20 = ((15 + 5*sqrt(5))/12)*E^3;
%Solution1,
%Solution2, %Solution3 xc should be
done outside the if statement. The complete
script Eg1_2 given on page 20 is correct.
cos(pi/3)=1/2; sin(pi/3)=sqrt(3)/2; sin(2*pi/3)=sqrt(3)/2;
Eg3_1 e0 for intermediate "best" error, the
variable p0 for intermediate "best" p, and the statements
associated with these variables are not necessary. Just updating
err_pq, pBest, and qBest directly
everytime after finding a smaller error is all that is necessary.
The resulting simpler code
is posted on the Software page as SimplerEg3_1.m.
Eg4_1 exp should be -x/2, not
x/2. The code for the calculation of the function value is correct though.
The file Eg4_1.m posted on the Software page has been corrected.
x(2) = x(3) + x(4). The correct fragment should be i = 1; x(i+1) = x(i+2) + x(i+3);x(i) = x(i+2) + x(i+3)
x(4), not the value 35.
fill function, there should be a
comma to separate the arguments y+1 and the color vector, like
this: fill(x,y+1,[0.4 0.6 1.0])
all, not any.
That is, the value of all(x < y) is 1 if and only if x(k) < y(k)
for every subscript k.
Eg8_1 gives the correct result, as shown on Figure 8\_1 on the next page.
Eg8_1.
if statement should be
x(k+1) < x(k)
and not x(k+1) < x(x).
ShowRect plot function should have length 5,
not 4, since it is necessary to "wrap around" to the first vertex in order to draw a
closed rectangle. The original code draws a sideways 'U' only, missing one edge of the
rectangle. Here is the correct call to the plot function:
plot([R.left R.right R.right R.left R.left],...
[R.bot R.bot R.top R.top R.bot], 'k','Linewidth',2)
s = C{k};
The loop should be for k=1:length(C)
s = C{k};
P(k) = str2num(s(67:75));
Lat(k) = str2num(s(137:146));
Long(k) = str2num(s(147:157));
end
Eg8_1 gives the correct result, as shown on Figure 8\_1 on the next page.
Eg4_1 exp should be -x/2, not
x/2. The code for the calculation of the function value is correct though.
The file Eg4_1.m posted on the Software page has been corrected.
ShowRect plot function should have length 5,
not 4, since it is necessary to "wrap around" to the first vertex in order to draw a
closed rectangle. The original code draws a sideways 'U' only, missing one edge of the
rectangle. Here is the correct call to the plot function:
plot([R.left R.right R.right R.left R.left],...
[R.bot R.bot R.top R.top R.bot], 'k','Linewidth',2)
Eg8_1.
Eg3_1 e0 for intermediate "best" error, the
variable p0 for intermediate "best" p, and the statements
associated with these variables are not necessary. Just updating
err_pq, pBest, and qBest directly
everytime after finding a smaller error is all that is necessary.
The resulting simpler code
is posted on the Software page as SimplerEg3_1.m.
fill function, there should be a
comma to separate the arguments y+1 and the color vector, like
this: fill(x,y+1,[0.4 0.6 1.0])
x(2) = x(3) + x(4). The correct fragment should be i = 1; x(i+1) = x(i+2) + x(i+3);x(i) = x(i+2) + x(i+3)
x(4), not the value 35.
%Solution1,
%Solution2, %Solution3 xc should be
done outside the if statement. The complete
script Eg1_2 given on page 20 is correct.
all, not any.
That is, the value of all(x < y) is 1 if and only if x(k) < y(k)
for every subscript k.
if statement should be
x(k+1) < x(k)
and not x(k+1) < x(x).
Vol20 should be 12, not 4.
Vol20 = ((15 + 5*sqrt(5))/12)*E^3;
cos(pi/3)=1/2; sin(pi/3)=sqrt(3)/2; sin(2*pi/3)=sqrt(3)/2;
s = C{k};
The loop should be for k=1:length(C)
s = C{k};
P(k) = str2num(s(67:75));
Lat(k) = str2num(s(137:146));
Long(k) = str2num(s(147:157));
end