版本:Mathematica 12.1
题目
通过绘图,观察重要极限 lim n → ∞ ( 1 + 1 n ) n = e \lim\limits_{n\rightarrow\infin}\left(1+\frac{1}{n}\right)^n=e n→∞lim(1+n1)n=e。
代码
an = {(1 + 1/1)^1, (1 + 1/2)^2, (1 + 1/3)^3};
Do[an = Append[an, (1 + 1/i)^i];
t = ListPlot[an, PlotRange -> {1.8, 2.8},
PlotStyle -> PointSize[0.015]]; Print[t], {i, 4, 20}
]
分析
- 第一行给三个初始值是因为之后第四行是从4到20循环,除去第二行循环中存在的
Append
,需要三个初始值。 - 第二行给
an
这个数组加上内容 - 第三行开始画图,
PlotRange
确定纵坐标范围。 PlotStyle
设置样式。- 最后再打印,从4到20。
界面
图片效果
这是JPG格式的图。
可以选择存储图像
可以保存成PDF和SVG,这些都是矢量图。
举一反三
Example 1
观察极限 lim n → ∞ n sin ( 1 n ) = 1 \lim\limits_{n\rightarrow\infin}n\sin\left(\frac{1}{n}\right)=1 n→∞limnsin(n1)=1。
an = {Sin[1], 2 Sin[1/2], 3 Sin[1/3]};
Do[an = Append[an, i*Sin[1/i]];
t = ListPlot[an, PlotRange -> {0, 2},
PlotStyle -> PointSize[0.015]]; Print[t], {i, 4, 20}
]
Example 2
设数列{ }n x 由下列递推关系式给出: x 1 = 1 2 x_1=\frac{1}{2} x1=21, x n + 1 2 = x n 2 + x n ( n = 1 , 2 , 3 , ⋯ ) x_{n+1}^2=x_n^2+x_n (n=1,2,3,\cdots) xn+12=xn2+xn(n=1,2,3,⋯)观察数列 1 x 1 + 1 + 1 x 2 + 1 + ⋯ + 1 x n + 1 \frac{1}{x_1+1}+\frac{1}{x_2+1}+\cdots+\frac{1}{x_n+1} x1+11+x2+11+⋯+xn+11的极限。
x = 1/2;
sum = 0;
an = {};
For[i = 0, i != 20, i++;
sum += 1/(x + 1);
an = Append[an, sum];
x *= (1 + x);]
t = ListPlot[an, PlotRange -> Automatic, PlotStyle -> PointSize[0.01]];
Print [t]
N[sum, 100]
*注:循环体外不带分号的句子是会有输出的,带分号则无。
ALL RIGHTS RESERVED © 2020 Teddy van Jerry
欢迎转载,转载请注明出处。