用Manim实现向量的减法的证明,并动画

 实现Manim动画

用Manim实现向量的减法的证明,并动画利用Manim实现向量计算的减法_哔哩哔哩_bilibili利用Manim实现数学动画, 视频播放量 0、弹幕量 0、点赞数 0、投硬币枚数 0、收藏人数 0、转发人数 0, 视频作者 Yasen_M, 作者简介 ,相关视频:icon-default.png?t=N7T8https://www.bilibili.com/video/BV1gWb5eRE2N/

1.相反向量

我们规定,与向量\vec{a} 长度相等,方向相反的向量,叫做 \vec{a}的相反向量,记作 -\vec{a}
解释
(1) 与数 𝑥 的相反数是 −𝑥 类似;
(2)-(\vec{a})=\vec{a}
(3) 零向量的相反向量仍是零向量.

2.向量的减法

向量 a 加上 b 的相反向量,叫做b 的差,即a-b=a+(-b).
求两个向量差的运算叫做向量的减法。向量的减法可以转化为向量的加法进行.

3.向量减法的几何意义

当 ab 同起点时,ab可以表示为从向量b的终点指向向量a的终点的向量.

这次实现了向量的复制和移动,旋转等特征。

from manim import *

class ParallelogramRule_0223(Scene):
    def construct(self):
        numberplane = NumberPlane()
        dot = Dot(ORIGIN)
        self.add(numberplane, dot)
        tB = Text("O").next_to(dot, LEFT+DOWN)
       
      
        vec_B = Arrow(start=dot, end=[-1, 3, 0], buff=0, color=BLUE)
        self.play(Create(vec_B))
        self.wait(1)
        tB = Text("B").next_to(vec_B.get_end(), LEFT)
        self.play(Create(tB))
        t0 = MathTex(r"\vec{b}")
        origin_text_B = t0.next_to([-1, 1, 0], LEFT)
        self.play(Create(origin_text_B))
        
        
        vec_A = Arrow(start=dot, end=[4, 0, 0], buff=0, color=RED)
        self.play(Create(vec_A))
        self.wait(1)
        tA = Text("A").next_to(vec_A.get_end(), UP)
        self.play(Create(tA))
        t1 = MathTex(r"\vec{a}")
        origin_text_A = t1.next_to([2, 0, 0], UP)
        self.play(Create(origin_text_A))
        
     
        rotated_arrow_B = vec_B.copy().rotate(PI, about_point=ORIGIN).set_color(GOLD)
        self.play(Create(rotated_arrow_B))
        #self.wait(1)
        t_B = Text("D").next_to(rotated_arrow_B.get_end(), LEFT)
        self.play(Create(t_B))
        t2 = MathTex(r"\vec{-b}")
        origin_text_bB = t2.next_to(rotated_arrow_B.get_end(), 3*UP + 2*LEFT)
        self.play(Create(origin_text_bB))
        self.wait(1)
        
     
        vec_A_copy = Arrow(start=vec_A.get_start(),
                           end=vec_A.get_end(), buff=0, color=RED)
    
        vec_A01_copy =vec_A_copy.copy() .shift(3*DOWN+RIGHT)
        self.play(Transform(vec_A_copy,vec_A01_copy))
        
        t2a = Text("C").next_to(vec_A_copy.get_end(), RIGHT)
        self.play(Create(t2a))
        t2a = MathTex(r"\vec{a'}")
        origin_text_2a = t2a.next_to(vec_A_copy.get_end(), 6*LEFT+DOWN)
        self.play(Create(origin_text_2a))
        self.wait(1)
        
        
        vec_minus_B_copy = Arrow(start=rotated_arrow_B.get_start(), end=rotated_arrow_B.get_end(),
                                 buff=0, color=BLUE)
     
        vec_minus_B01_copy =vec_minus_B_copy.copy() .shift(4*RIGHT)
        self.play(Transform(vec_minus_B_copy,vec_minus_B01_copy))
        
        
        t2b = MathTex(r"\vec{-b'}")
        origin_text_2b = t2b.next_to(vec_minus_B_copy.get_end(), 4*UP)
        self.play(Create(origin_text_2b))              
        self.wait(1)
        
      
        vec_OC=Arrow(start=dot,end=vec_minus_B_copy.get_end(),buff=0, color=YELLOW)
        self.play(Create(vec_OC))
        toc_ = MathTex(r"\vec{oc'}")
        origin_text_oc_ = toc_.next_to(vec_OC.get_end(),6*LEFT+7*UP)
        self.play(Create(origin_text_oc_))              
        self.wait(1)
        
       
        vec_OC1=Arrow(start=dot,end=vec_minus_B_copy.get_end(),buff=0, color=YELLOW)
        vec_AB_OC1 =vec_OC1.copy() .shift(3*UP+LEFT)
        self.play(Transform(vec_OC1,vec_AB_OC1))
        
        tba = MathTex(r"\vec{BA}=\vec{a}-\vec{b}")
        origin_text_2ba = tba.next_to([2,2,0])
        self.play(Create(origin_text_2ba))
        self.wait(1)
        
         
        
        #创建正方形
        # 创建长方形
        rectangle = Rectangle(fill_color=WHITE, fill_opacity=1,width=6, height=4).shift(3.7*LEFT+2*DOWN)
        #self.add(rectangle)
        self.play(Create(rectangle))
        self.wait(1)
        
        #结论
        

%manim -qm -v WARNING ParallelogramRule_0223

运行结果如下:

完整运行结果可以在哔哩哔哩上可以看到,视频效果更佳美好。

  • 6
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

Yasen.M

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值