monotone_bounded_theorem.py
1from manim import *2import numpy as np3 4class MonotoneBoundedTheorem(Scene):5 def construct(self):6 # 配置参数7 x_range = [-1, 8, 1]8 y_range = [-0.5, 3.5, 0.5]9 10 # 创建坐标系11 axes = Axes(12 x_range=x_range,13 y_range=y_range,14 x_length=10,15 y_length=6,16 axis_config={17 "include_tip": True,18 "include_numbers": False19 }20 )21 22 # 创建标题23 title = Text("确界原理证明单调有界原理", font="SimSun").scale(0.8).to_edge(UP)24 25 # 设置场景26 self.play(27 Write(title, run_time=2),28 Create(axes, run_time=2)29 )30 31 # 创建单调递增数列 an = 2 - 1/n32 n_values = np.linspace(1, 8, 40) # 在1到8之间创建40个点33 points = [(n, 2 - 1/n) for n in n_values]34 dots = VGroup(*[35 Dot(axes.c2p(x, y), color=BLUE, radius=0.04)36 for x, y in points37 ])38 39 # 显示数列说明40 sequence_text = VGroup(41 Text("单调递增数列", font="SimSun", color=BLUE),42 MathTex(r"\{a_n\}", color=BLUE)43 ).arrange(RIGHT,buff=0.1).scale(0.6)44 sequence_text.next_to(title, DOWN)45 46 # 显示数列47 self.play(Write(sequence_text), run_time=1.5)48 49 # 逐个显示点50 for dot in dots:51 self.play(Create(dot), run_time=0.2)52 53 # 显示性质2:有界性54 property2 = VGroup(55 Text("数列有上界必有上确界", font="SimSun"),56 MathTex(r"\exists L, \forall n, a_n \leq L")57 ).arrange(DOWN, aligned_edge=LEFT).scale(0.6).to_edge(LEFT, buff=0.5).shift(UP)58 59 self.play(Write(property2), run_time=2.5)60 61 # 显示上界L62 L = 2 # 上确界63 L_line = DashedLine(64 axes.c2p(0, L),65 axes.c2p(8, L),66 color=RED,67 dash_length=0.268 )69 L_text = Text("L(上确界)", font="SimSun", color=RED).scale(0.6)70 L_text.next_to(L_line.get_end(), LEFT)71 72 self.play(73 Create(L_line),74 Write(L_text),75 run_time=2.576 )77 78 # 显示证明过程79 proof = VGroup(80 Text("对任意ε>0,", font="SimSun"),81 Text("L-ε不是上界", font="SimSun", color=GREEN),82 Text("存在N,使得", font="SimSun"),83 MathTex(r"a_N > L-\varepsilon", color=YELLOW)84 ).arrange(DOWN, aligned_edge=LEFT).scale(0.6).to_edge(RIGHT, buff=0.5).shift(DOWN)85 86 self.play(Write(proof), run_time=3)87 88 # 演示ε-N语言89 epsilon = 0.290 epsilon_line = DashedLine(91 axes.c2p(0, L-epsilon),92 axes.c2p(8, L-epsilon),93 color=GREEN,94 dash_length=0.295 )96 epsilon_text = Text("L-ε", font="SimSun", color=GREEN).scale(0.6)97 epsilon_text.next_to(epsilon_line.get_end(), LEFT)98 99 self.play(100 Create(epsilon_line),101 Write(epsilon_text),102 run_time=2.5103 )104 105 # 标注N点106 N_index = next(i for i, p in enumerate(points) if p[1] > L-epsilon)107 N_point = points[N_index]108 N_dot = Dot(axes.c2p(N_point[0], N_point[1]), color=YELLOW, radius=0.1)109 N_text = Text("N", font="SimSun", color=YELLOW).scale(0.6)110 N_text.next_to(N_dot, DR)111 112 self.play(113 Create(N_dot),114 Write(N_text),115 run_time=2.5116 )117 118 # 显示性质1:单调性(移到N点显示之后)119 property1 = VGroup(120 Text("数列单调递增", font="SimSun"),121 MathTex(r"\forall n>N, a_n \geq a_N > L-\varepsilon", color=BLUE)122 ).arrange(DOWN, aligned_edge=LEFT).scale(0.6).to_edge(LEFT, buff=0.5)123 124 property1.next_to(property2, DOWN, buff=0.5, aligned_edge=LEFT)125 126 self.play(Write(property1), run_time=2.5)127 128 # 标注N之后的点129 points_after_N = [(x, y) for x, y in points if x > N_point[0]]130 highlight_dots = VGroup(*[131 Dot(axes.c2p(x, y), color=YELLOW, radius=0.08, fill_opacity=0.8)132 for x, y in points_after_N133 ])134 135 # 显示动画136 self.play(137 *[dot.animate.set_color(YELLOW) for dot in highlight_dots],138 run_time=3139 )140 141 # 突出显示两条边界线142 self.play(143 epsilon_line.animate.set_color(YELLOW).set_stroke(width=3),144 L_line.animate.set_color(YELLOW).set_stroke(width=3),145 run_time=2.5146 )147 148 # 显示不等式链149 inequality_chain = VGroup(150 MathTex("L-\\varepsilon", color=GREEN),151 MathTex("<"),152 MathTex("a_n", color=BLUE),153 MathTex("\\leq"),154 MathTex("L", color=RED)155 ).arrange(RIGHT, buff=0.2).scale(0.8)156 157 inequality_chain.next_to(axes, DOWN, buff=0.15)158 159 self.play(Write(inequality_chain), run_time=3.5)160 161 # 显示结论162 conclusion = Text(163 "数列必定收敛于其上确界L",164 font="SimSun"165 ).scale(0.6).next_to(inequality_chain, DOWN, buff=0.15)166 167 self.play(Write(conclusion), run_time=3.5)168 169 self.wait(6)170 171def main():172 import os173 os.system("manim -pql monotone_bounded_theorem.py MonotoneBoundedTheorem")174 175if __name__ == "__main__":176 main() 讲解
这个视频围绕「确界原理证明单调有界原理」展开。画面把问题、图像和公式放在同一条理解路径中,让抽象关系先被看见。
开头先建立问题背景和主要对象,让观察从标题、坐标或第一组关系进入。
画面中出现的文字「确界原理证明单调有界原理」给出视觉入口。随后画面通过对象创建、移动、淡入淡出和高亮,把抽象命题拆成可以跟随的步骤。
随后出现更具体的图像或公式提示,动画会把局部对象和整体结论联系起来。这里可以重点观察变量、曲线、区域或向量如何随镜头推进而变化。
核心公式可以写成:
这类公式可以和画面中的符号一一对应。
观察路径
观察路径可以分三步:先锁定「确界原理证明单调有界原理」中的核心对象,尤其留意确界原理、单调有界原理、数列收敛之间的联系;再跟随画面中变量、图像或向量的变化;最后回到公式或结论,判断局部变化如何支撑整体关系。
本页可以从确界原理、单调有界原理、数列收敛这些概念进入,继续沿相邻问题观察同一类数学结构。