计算方法程序
源代码在线查看: long.cpp
#include
#include
void main()
{
long double x,a,b,e,h,A,M,s,p;
int l,n,i,G,j;
long double t[7];
long double a1=7782.5,c1=972.5,b1=sqrt(a1*a1-c1*c1);
a=0.0;
b=3.14159263/2.0;
e=0.00000001;
h=b-a;
t[0]=h*(sqrt((a1*sin(a))*(a1*sin(a))+(b1*cos(a))*(b1*cos(a)))+sqrt((a1*sin(b))*(a1*sin(b))+(b1*cos(b))*(b1*cos(b))))/2.0;
l=0;
n=1;
do{
A=t[0];
M=0.0;
for(i=0;i x=a+(i+0.5)*h;
p=sqrt((a1*sin(x))*(a1*sin(x))+(b1*cos(x))*(b1*cos(x)));
M=M+p;
}
M=M*h;
t[l+1]=(t[l]+M)/2.0;
G=4;
for(j=l;j>=0;j--){
t[j]=(t[j+1]-1.0/G*t[j])/(1.0-1.0/G);
G=4*G;
}
l=l+1;
n=2*n;
h=h/2.0;
s=(t[0]-A)/t[0];
if(s s=-s;
}while(s>e);
cout }