(工具:matlab)
代码:
clc,clear,close all
% (2)
p = 0.98;% 若降低p值,则第四题的证明更精确
k = (0:1000);
% (3)
G = p.^k;
% (4)
sum_G = sum(G);
syms u
sum_inf_G = symsum(p.^u,u,0,inf);% 第四题得证
sum_G;
sum_inf_G;
%(5)
max_k = max(k);
x = (0:1:max_k);
y = repmat(sum_inf_G,1,1001);
plot(x,y,'r');
hold on;
% (7)
y = cumsum(p.^k);
plot(x,y,'b');
hold on;
% (8)
title('This is title');
legend('Infinate Sum','Finite sum');
xlabel('This is x');
ylabel('This is y');
% (10)
p = 2;
n = [1:500];% (11)
pSeries = 1*(n.^p).^(-1);% (12)
syms q;
limit_sum = symsum(1*(q.^p).^(-1),q,1,inf);% (12)
y = repmat(limit_sum,1,1001);
plot(x,y,'g');
hold on;
% (13)
x = (1:1000);
y = (pi.^2)*6.^(-1);
plot(x,y,'.');% 由图证明收敛
运行结果:
(个人答案,如有错误或更正建议欢迎联系作者)