第五章的14题解答:
其中,=,,, 第三式乘以减去第三式,第一式乘以减去第二式,分别得:
从第二式,第三式中消去
,得
,
第一式,第二式中消去
上式可看成是一个关于
的线性方程组,解出
从而解得:
将的值代入
得. 最后可计算出两积分的近试值为0.321714和0.524689.
第五章实验第2题
Function[p1,p2,p3]=ex52
a=0;b=pi/4;m=2;
t(1)0.5*t(1)+0.5*(b-a)*f((a+b)/2);
s(i)=(4*t(2)-t(1))/3;
j=2;
%% t,s ,c,r store the romberg integrals,
%% in which s stores the simpson integrals
While abs(t(j)-t(j-1))>(0.5e-6),
H=(b-a)/m;
K=0 m-1);
J=j+1;
t(j)=0.5*t(j-1)+o.5*h*sum(f(a+(k+1/2)*h));
s(j-1)=(4*t(j)-t(j-1))/3;
c(j-2)=(16*s(j-2)-c(j-3))/63;
end
m=m+2;
end
p1=s(end);
p2=r(end);
%% compute the compound gauss integrals
W=[5 8 5]/9;
X=[-sqrt(15) 0 sqrt(15)]/5;
N=5;
P3=0;
For j=0;n-1,
G=(j+0.5)/n+0.5/n*x;%gauss modes
P3=p3+f(g)*w/(2*n);
And
P3=p3;
Function v=f(v);
V=sqrt(4=-sin(x)*^2);
运行后,可有如下结果:
>>[p1,p2,p3]=ex52
P1=1.[1**********]228
P2=1.[1**********]28
P3=1.[1**********]108
姓名:朱雷 学号:1131816 学院:电子与信息工程学院 专业:系统工程
手机:[1**********]
第五章的14题解答:
其中,=,,, 第三式乘以减去第三式,第一式乘以减去第二式,分别得:
从第二式,第三式中消去
,得
,
第一式,第二式中消去
上式可看成是一个关于
的线性方程组,解出
从而解得:
将的值代入
得. 最后可计算出两积分的近试值为0.321714和0.524689.
第五章实验第2题
Function[p1,p2,p3]=ex52
a=0;b=pi/4;m=2;
t(1)0.5*t(1)+0.5*(b-a)*f((a+b)/2);
s(i)=(4*t(2)-t(1))/3;
j=2;
%% t,s ,c,r store the romberg integrals,
%% in which s stores the simpson integrals
While abs(t(j)-t(j-1))>(0.5e-6),
H=(b-a)/m;
K=0 m-1);
J=j+1;
t(j)=0.5*t(j-1)+o.5*h*sum(f(a+(k+1/2)*h));
s(j-1)=(4*t(j)-t(j-1))/3;
c(j-2)=(16*s(j-2)-c(j-3))/63;
end
m=m+2;
end
p1=s(end);
p2=r(end);
%% compute the compound gauss integrals
W=[5 8 5]/9;
X=[-sqrt(15) 0 sqrt(15)]/5;
N=5;
P3=0;
For j=0;n-1,
G=(j+0.5)/n+0.5/n*x;%gauss modes
P3=p3+f(g)*w/(2*n);
And
P3=p3;
Function v=f(v);
V=sqrt(4=-sin(x)*^2);
运行后,可有如下结果:
>>[p1,p2,p3]=ex52
P1=1.[1**********]228
P2=1.[1**********]28
P3=1.[1**********]108
姓名:朱雷 学号:1131816 学院:电子与信息工程学院 专业:系统工程
手机:[1**********]