%圆方程设为x^2+(y-10)^2=100
R=10;
S=pi*R^2
s=0.5*S;
r=10;
e=1;
n=0;
while e>1.0e-2&n<=1000
r=r+0.01;
n=n+1;
x=-0.5*R:0.001:0.5*R;
y1=sqrt(r.^2-x.^2);
y2=R-sqrt(R.^2-x.^2);
A=trapz(x,y1)-trapz(x,y2)
e=s-A;
fprintf('r=%.3f,e=%.4f\n',r,e)
%圆方程设为x^2+(y-10)^2=100
R=10;
S=pi*R^2
s=0.5*S;
r=10;
e=1;
n=0;
while e>1.0e-2&n<=1000
r=r+0.01;
n=n+1;
x=-0.5*R:0.001:0.5*R;
y1=sqrt(r.^2-x.^2);
y2=R-sqrt(R.^2-x.^2);
A=trapz(x,y1)-trapz(x,y2)
e=s-A;
fprintf('r=%.3f,e=%.4f\n',r,e)