that_one_nigga_you_k

ending

Jan 27th, 2025
50
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 22.05 KB | None | 0 0
  1. from manim import *
  2.  
  3. config.pixel_height = 1920
  4. config.pixel_width = 1080
  5. config.frame_height = 16
  6. config.frame_width = 9
  7. config.frame_rate = 60
  8.  
  9.  
  10. class saida(Scene):
  11.     def construct(self):
  12.         # Sistema original com x, y e z
  13.         sistema_original = MathTex(
  14.             r"\left\{ \begin{aligned} "
  15.             r"&x + y + z = 4 \\ "
  16.             r"&x^2 + y^2 + z^2 = 14 \\ "
  17.             r"&x^3 + y^3 + z^3 = 34 "
  18.             r"\end{aligned} \right."
  19.         )
  20.         sistema_original.to_edge(UP)
  21.  
  22.         # Sistema simplificado com x e y
  23.         sistema_simplificado = MathTex(
  24.             r"\left\{ \begin{aligned} "
  25.             r"&x + y = (\text{uma}\, \text{constante}) \\ "
  26.             r"&x^2 + y^2 = (\text{outra}\, \text{constante})"
  27.             r"\end{aligned} \right."
  28.         )
  29.  
  30.         ehisso = Text("¯\\_(ツ)_/¯", font="Arial", font_size=68)
  31.  
  32.         sistema_simplificado.next_to(sistema_original, DOWN, buff=2)
  33.         ehisso.next_to(sistema_simplificado, DOWN, buff=2)
  34.  
  35.         # Criando uma seta para baixo entre os sistemas
  36.         arrow = Arrow(start=sistema_original.get_bottom(),
  37.                       end=sistema_simplificado.get_top(),
  38.                       buff=0.5,
  39.                       color=YELLOW)
  40.  
  41.         # Exibir sistema original
  42.         self.play(Write(sistema_original))
  43.         self.wait(1)
  44.  
  45.         # Adicionando a seta animada
  46.         self.play(Write(arrow))
  47.         self.wait(1)
  48.  
  49.         # Exibir sistema simplificado
  50.         self.play(Write(sistema_simplificado))
  51.         self.wait(2)
  52.         self.play(Write(ehisso))
  53.         self.wait(2)
  54.  
  55.         leftover = VGroup()
  56.         for obj in self.mobjects:
  57.             if issubclass(obj.__class__, VMobject):
  58.                 leftover += obj
  59.         self.play(Unwrite(leftover))
  60.  
  61.         self.wait(0.5)
  62.  
  63. class fecho(Scene):
  64.     def construct(self):
  65.        
  66.         solucao1 = MathTex(r"-\frac{b}{a}", "=", r"4")
  67.         solucao2 = MathTex(r"\frac{c}{a}", "=", r"1")
  68.         solucao3 = MathTex(r"-\frac{d}{a}", "=", r"-6")
  69.  
  70.         solucao_group = VGroup(solucao1, solucao2, solucao3)
  71.         solucao_group.arrange(DOWN, aligned_edge=LEFT, buff=0.5)
  72.         solucao_group.to_corner(UL)
  73.  
  74.         self.play(Write(solucao_group))
  75.         self.wait(1)
  76.  
  77.         # Novas versões das equações
  78.         nova_solucao1 = MathTex(r"-\frac{b}{1}", "=", r"4")
  79.         nova_solucao2 = MathTex(r"\frac{c}{1}", "=", r"1")
  80.         nova_solucao3 = MathTex(r"-\frac{d}{1}", "=", r"-6")
  81.  
  82.         coefB = MathTex(r"\quad \Rightarrow \quad", "b", "=", "-4").next_to(solucao1, RIGHT, buff=0.5)
  83.         coefC = MathTex(r"\quad \Rightarrow \quad", "c", "=", "1").next_to(solucao2, RIGHT, buff=0.5)
  84.         coefD = MathTex(r"\quad \Rightarrow \quad", "d", "=", "6").next_to(solucao3, RIGHT, buff=0.5)
  85.  
  86.  
  87.         coeficientes = VGroup(coefB, coefC, coefD)
  88.         #coeficientes.arrange(DOWN, aligned_edge=LEFT, buff=0.5)
  89.         #coeficientes.next_to(solucao_group, RIGHT, buff=0.5)
  90.  
  91.         equacao3 = MathTex(r"ax^3 + bx^2 + cx + d = 0")
  92.         equacao3.next_to(solucao_group, DOWN, buff=1)
  93.         equacao3.to_edge(LEFT)
  94.  
  95.         nova_equacao3 = MathTex(r"x^3 - 4x^2 + x - 6 = 0")
  96.        
  97.         nova_equacao3.next_to(equacao3, DOWN, buff=0.5)
  98.         nova_equacao3.to_edge(LEFT)
  99.  
  100.         teorema = MathTex(
  101.             r"\text{Se } f(x) = a_n x^n + a_{n-1} x^{n-1} + \dots + a_1 x + a_0,",
  102.             r"\text{ com } a_n \neq 0, \text{ então as raízes racionais possíveis são: }",
  103.             r"\frac{p}{q},",
  104.             r"\text{onde } p \text{ é um divisor de } a_0 \text{ e } q \text{ é um divisor de } a_n."
  105.         ).arrange(DOWN, buff=0.5).scale(0.7)
  106.  
  107.         traducao = Tex(
  108.             "Tradução: Se a equação tem alguma raíz racional,\\\\" "ela será um dos divisores \\\\ "
  109.             "da divisão entre o termo independente e\\\\""o coeficiente do termo de maior grau"
  110.         ).scale(0.7)
  111.         coreq1 = FadeToColor(equacao3[0][0:1], RED, run_time=0.15)
  112.         coreq2 = FadeToColor(equacao3[0][4:5], BLUE, run_time=0.15)
  113.         coreq3 = FadeToColor(equacao3[0][8:9], GREEN, run_time=0.15)
  114.         coreq4 = FadeToColor(equacao3[0][11:12], PURPLE, run_time=0.15)
  115.  
  116.  
  117.         nova_solucao1.move_to(solucao1)
  118.         nova_solucao2.move_to(solucao2)
  119.         nova_solucao3.move_to(solucao3)
  120.  
  121.         # Transformando uma equação por vez
  122.         self.play(TransformMatchingTex(solucao1, nova_solucao1))
  123.         self.wait(0.1)
  124.        
  125.         self.play(TransformMatchingTex(solucao2, nova_solucao2))
  126.         self.wait(0.1)
  127.        
  128.         self.play(TransformMatchingTex(solucao3, nova_solucao3))
  129.         self.wait(0.1)
  130.  
  131.         cor1 = FadeToColor(nova_solucao1[0][3:4], RED , run_time = 0.15)
  132.         cor2 = FadeToColor(nova_solucao2[0][2:3], RED , run_time = 0.15)
  133.         cor3 = FadeToColor(nova_solucao3[0][3:4], RED , run_time = 0.15)
  134.  
  135.         self.play(cor1, cor2, cor3)
  136.         self.wait(1)
  137.  
  138.         self.play(Write(equacao3))
  139.         self.wait(0.1)
  140.         self.play(coreq1, coreq2, coreq3, coreq4)
  141.         self.wait(1)
  142.  
  143.         self.play(Write(coeficientes))
  144.         self.wait(1)
  145.  
  146.         cordoB = FadeToColor(coefB[1:4], BLUE, run_time=0.5)
  147.         cordoC = FadeToColor(coefC[1:4], GREEN , run_time=0.5)
  148.         cordoD = FadeToColor(coefD[1:4], PURPLE , run_time=0.5)
  149.  
  150.         self.play(cordoB, cordoC, cordoD)
  151.  
  152.         self.wait(1)
  153.         corcoef = FadeToColor(nova_equacao3[0][3:6], BLUE, run_time=0.5)
  154.         corcoef3 = FadeToColor(nova_equacao3[0][9:10], PURPLE, run_time=0.5)
  155.         corcoef2 = FadeToColor(nova_equacao3[0][7:8], GREEN, run_time=0.5)
  156.         self.play(Write(nova_equacao3))
  157.         self.wait(0.5)
  158.         self.play(corcoef, corcoef2, corcoef3)
  159.         self.wait(1)
  160.  
  161.         self.play(Unwrite(VGroup(solucao_group, coeficientes, equacao3, nova_solucao1, nova_solucao2, nova_solucao3)))
  162.         self.play(nova_equacao3.animate.to_edge(UP))
  163.         self.wait(1)
  164.  
  165.         # Definir a equação geral e as soluções
  166.         eq_x1 = MathTex(
  167.             r"x_1 = -\frac{b}{3a} + \sqrt[3]{-\frac{q}{2} + \sqrt{\frac{q^2}{4} + \frac{p^3}{27}}} + \sqrt[3]{-\frac{q}{2} - \sqrt{\frac{q^2}{4} + \frac{p^3}{27}}}"
  168.         )
  169.        
  170.         eq_x2 = MathTex(
  171.             r"x_2 = -\frac{b}{3a} + \left( \frac{-1}{2} + \frac{i\sqrt{3}}{2} \right) \sqrt[3]{-\frac{q}{2} + \sqrt{\frac{q^2}{4} + \frac{p^3}{27}}} + \left( \frac{-1}{2} - \frac{i\sqrt{3}}{2} \right) \sqrt[3]{-\frac{q}{2} - \sqrt{\frac{q^2}{4} + \frac{p^3}{27}}}"
  172.         )
  173.        
  174.         eq_x3 = MathTex(
  175.             r"x_3 = -\frac{b}{3a} + \left( \frac{-1}{2} - \frac{i\sqrt{3}}{2} \right) \sqrt[3]{-\frac{q}{2} + \sqrt{\frac{q^2}{4} + \frac{p^3}{27}}} + \left( \frac{-1}{2} + \frac{i\sqrt{3}}{2} \right) \sqrt[3]{-\frac{q}{2} - \sqrt{\frac{q^2}{4} + \frac{p^3}{27}}}"
  176.         )
  177.        
  178.         eq_p = MathTex(
  179.             r"p = \frac{c}{a} - \frac{b^2}{3a^2}"
  180.         )
  181.        
  182.         eq_q = MathTex(
  183.             r"q = \frac{d}{a} - \frac{bc}{3a^2} + \frac{2b^3}{27a^3}"
  184.         )
  185.        
  186.         # Organizar o layout das equações na tela
  187.         eq_x1.next_to(nova_equacao3, DOWN, buff=1)
  188.         eq_x2.next_to(eq_x1, DOWN, buff=0.5)
  189.         eq_x3.next_to(eq_x2, DOWN, buff=0.5)
  190.         eq_p.next_to(eq_x3, DOWN, buff=0.75)
  191.         eq_q.next_to(eq_p, DOWN, buff=1)
  192.        
  193.         # Ajustar o tamanho das equações para se ajustar à largura da tela
  194.         eq_x1.scale_to_fit_width(config.frame_width * 0.7)
  195.         eq_x2.scale_to_fit_width(config.frame_width * 0.9)
  196.         eq_x3.scale_to_fit_width(config.frame_width * 0.9)
  197.         eq_p.scale_to_fit_width(config.frame_width * 0.5)
  198.         eq_q.scale_to_fit_width(config.frame_width * 0.5)
  199.        
  200.  
  201.         tartano = VGroup(eq_x1, eq_x2, eq_x3, eq_p, eq_q)
  202.         tartano.set_x(0)
  203.        
  204.         # Criar as animações
  205.         self.play(Write(tartano), run_time=3.5)
  206.        
  207.         # Espera no final
  208.         self.wait(1)
  209.         self.play(Unwrite(tartano), run_time=2.5)      
  210.         self.wait(1)
  211.  
  212.        
  213.  
  214.         # Apresentar a fórmula do teorema
  215.         teorema.next_to(nova_equacao3, DOWN, buff=1)
  216.         teorema.set_x(0)
  217.         traducao.next_to(teorema, DOWN, buff=0.5)
  218.         self.play(Write(teorema[0]))
  219.         self.wait(1)
  220.         self.play(Write(teorema[1]))
  221.         self.wait(1)
  222.         self.play(Write(teorema[2]))
  223.         self.wait(1)
  224.         self.play(Write(teorema[3]))
  225.         self.wait(2)
  226.         self.play(Write(traducao), run_time=3)
  227.         self.wait(2)
  228.  
  229.         self.play(Unwrite(VGroup(teorema, traducao)))
  230.         self.wait(1)
  231.  
  232.          # Cria a equação
  233.        
  234.         possiveis = MathTex(r"\text{Possíveis raízes racionais: } \pm \left(\frac{1, 2, 3, 6}{1}\right)")
  235.         possiveis_esticado = MathTex(r"\pm 1, \pm 2, \pm 3, \pm 6")
  236.  
  237.         possiveis.next_to(nova_equacao3, DOWN, buff=1)
  238.         possiveis.set_x(0)
  239.  
  240.         possiveis_esticado.next_to(possiveis, DOWN, buff=0.5)
  241.         self.play(Write(possiveis))
  242.         self.wait(1)
  243.         self.play(Write(possiveis_esticado))
  244.         self.wait(1)
  245.  
  246.         nova_equacao4 = MathTex(r"x^3 - 4x^2 + x - 6 = 0")
  247.         nova_sol1 = MathTex(r"1^3 - 4 \cdot 1^2 + 1 - 6 = -8").next_to(possiveis_esticado, DOWN, buff = 2)
  248.         nova_solmenos1 = MathTex(r"-1^3 - 4 \cdot -1^2 + -1 - 6 = 0").next_to(nova_sol1, DOWN, buff = 1)
  249.         nova_sol2 = MathTex(r"2^3 - 4 \cdot 2^2 + 2 - 6 = 0")
  250.         nova_sol3 = MathTex(r"3^3 - 4 \cdot 3^2 + 3 - 6 = 0")
  251.         rais = Tex("-1 é uma raíz").next_to(nova_solmenos1, DOWN, buff = 1)
  252.  
  253.        
  254.  
  255.         self.play(Write(nova_sol1))
  256.         self.wait(1)
  257.         self.play(Write(nova_solmenos1))
  258.         self.wait(1)
  259.         self.play(nova_solmenos1.animate.set_color_by_gradient(RED, YELLOW, GREEN, BLUE, PURPLE), run_time=3)
  260.         self.wait(1)
  261.         self.play(Write(rais))
  262.  
  263.         self.wait(1)
  264.         self.play(Unwrite(VGroup(nova_sol1, nova_solmenos1, rais, possiveis, possiveis_esticado, nova_equacao3)))
  265.  
  266.         tabela = MathTable(
  267.             [["1", "-4", "1", "-6"],  # Coeficientes
  268.              ["1", "-1", "5", "-4"],   # Produtos intermediários
  269.              ["-1", "-5", "6", "0"]],  # Resultados finais
  270.             include_outer_lines=True
  271.         ).scale(0.8).to_edge(UP)
  272.  
  273.        
  274.  
  275.         divisor_label = MathTex(r"c = -1").to_edge(LEFT).shift(UP * 0.5)
  276.         legenda = Text("Divisão usando Briot-Ruffini").scale(0.6).next_to(tabela, DOWN)
  277.  
  278.         # Mostrar divisor
  279.         self.play(Write(divisor_label))
  280.         self.wait()
  281.  
  282.         # Mostrar tabela inicial
  283.         self.play(Create(tabela.get_horizontal_lines()), Create(tabela.get_vertical_lines()))
  284.         self.play(Write(tabela.get_entries()))
  285.         self.wait()
  286.  
  287.         # Animação passo a passo
  288.         # Destacar o coeficiente inicial
  289.         self.play(tabela.get_entries((1, 1)).animate.set_color(YELLOW))
  290.         self.wait()
  291.  
  292.         # Adicionar o primeiro produto (c * 1 = -1)
  293.         self.play(Indicate(tabela.get_entries((1, 1))), run_time=1)
  294.         self.play(tabela.get_entries((2, 2)).animate.set_color(RED))
  295.         self.wait()
  296.  
  297.         # Calcular a soma: -4 + (-1) = -5
  298.         self.play(Indicate(tabela.get_entries((2, 2))))
  299.         self.play(tabela.get_entries((3, 2)).animate.set_color(GREEN))
  300.         self.wait()
  301.  
  302.         # Repetir para os próximos passos
  303.         for i in range(2, 4):
  304.             # Calcular produto intermediário
  305.             self.play(Indicate(tabela.get_entries((3, i))))
  306.             self.play(tabela.get_entries((2, i + 1)).animate.set_color(RED))
  307.             self.wait()
  308.  
  309.             # Calcular o valor na linha de resultados
  310.             self.play(Indicate(tabela.get_entries((2, i + 1))))
  311.             self.play(tabela.get_entries((3, i + 1)).animate.set_color(GREEN))
  312.             self.wait()
  313.  
  314.         # Mostrar o resultado final
  315.         resultado = MathTex(r"Quociente: x^2 - 5x + 6, \text{ Resto: } 0").scale(0.8)
  316.         resultado.next_to(tabela, DOWN)
  317.         self.play(Write(resultado))
  318.         self.wait(2)
  319.         self.play(Unwrite(VGroup(tabela, divisor_label, legenda, resultado)))        
  320.  
  321.         # Espera
  322.         self.wait(1)
  323.  
  324. class indice(Scene):
  325.     def construct (self):
  326.         equation = MathTex(r"x^3 - 4x^2 + x - 6 = 0")
  327.  
  328.         self.add(equation)
  329.         self.add(index_labels(equation[0], color=RED))
  330.  
  331. class tresgrau(Scene):
  332.     def construct(self):
  333.         # Definir a equação geral e as soluções
  334.         eq_x1 = MathTex(
  335.             r"x_1 = -\frac{b}{3a} + \sqrt[3]{-\frac{q}{2} + \sqrt{\frac{q^2}{4} + \frac{p^3}{27}}} + \sqrt[3]{-\frac{q}{2} - \sqrt{\frac{q^2}{4} + \frac{p^3}{27}}}"
  336.         )
  337.        
  338.         eq_x2 = MathTex(
  339.             r"x_2 = -\frac{b}{3a} + \left( \frac{-1}{2} + \frac{i\sqrt{3}}{2} \right) \sqrt[3]{-\frac{q}{2} + \sqrt{\frac{q^2}{4} + \frac{p^3}{27}}} + \left( \frac{-1}{2} - \frac{i\sqrt{3}}{2} \right) \sqrt[3]{-\frac{q}{2} - \sqrt{\frac{q^2}{4} + \frac{p^3}{27}}}"
  340.         )
  341.        
  342.         eq_x3 = MathTex(
  343.             r"x_3 = -\frac{b}{3a} + \left( \frac{-1}{2} - \frac{i\sqrt{3}}{2} \right) \sqrt[3]{-\frac{q}{2} + \sqrt{\frac{q^2}{4} + \frac{p^3}{27}}} + \left( \frac{-1}{2} + \frac{i\sqrt{3}}{2} \right) \sqrt[3]{-\frac{q}{2} - \sqrt{\frac{q^2}{4} + \frac{p^3}{27}}}"
  344.         )
  345.        
  346.         eq_p = MathTex(
  347.             r"p = \frac{c}{a} - \frac{b^2}{3a^2}"
  348.         )
  349.        
  350.         eq_q = MathTex(
  351.             r"q = \frac{d}{a} - \frac{bc}{3a^2} + \frac{2b^3}{27a^3}"
  352.         )
  353.        
  354.         # Organizar o layout das equações na tela
  355.         eq_x1.to_edge(UP)
  356.         eq_x2.next_to(eq_x1, DOWN, buff=0.5)
  357.         eq_x3.next_to(eq_x2, DOWN, buff=0.5)
  358.         eq_p.next_to(eq_x3, DOWN, buff=0.75)
  359.         eq_q.next_to(eq_p, DOWN, buff=1)
  360.        
  361.         # Ajustar o tamanho das equações para se ajustar à largura da tela
  362.         eq_x1.scale_to_fit_width(config.frame_width * 0.7)
  363.         eq_x2.scale_to_fit_width(config.frame_width * 0.9)
  364.         eq_x3.scale_to_fit_width(config.frame_width * 0.9)
  365.         eq_p.scale_to_fit_width(config.frame_width * 0.5)
  366.         eq_q.scale_to_fit_width(config.frame_width * 0.5)
  367.        
  368.         # Criar as animações
  369.         self.play(Write(eq_x1))
  370.         self.wait(1)
  371.         self.play(Write(eq_x2))
  372.         self.wait(1)
  373.         self.play(Write(eq_x3))
  374.         self.wait(1)
  375.         self.play(Write(eq_p))
  376.         self.wait(1)
  377.         self.play(Write(eq_q))
  378.        
  379.         # Espera no final
  380.         self.wait(2)
  381.  
  382. class div(Scene):
  383.     def construct(self):
  384.         # Título da cena
  385.         titulo = Text("Divisão de Polinômios com Briot-Ruffini").to_edge(UP)
  386.  
  387.         # Polinômio inicial
  388.         polinomio = MathTex(r"x^3 - 4x^2 + x - 6").next_to(titulo, DOWN)
  389.  
  390.         # Configuração inicial da tabela
  391.         tabela = MathTable(
  392.             [["1", "-4", "1", "-6"],  # Coeficientes
  393.              ["1", "-1", "5", "-4"],   # Produtos intermediários
  394.              ["-1", "-5", "6", "0"]],  # Resultados finais
  395.             include_outer_lines=True
  396.         ).scale(0.8).next_to(polinomio, DOWN)
  397.  
  398.         # Adicionar labels de linha e coluna
  399.         divisor_label = MathTex(r"c = -1").to_edge(LEFT).shift(UP * 0.5)
  400.         legenda = Text("Divisão usando Briot-Ruffini").scale(0.6).next_to(tabela, DOWN)
  401.  
  402.         # Animações iniciais
  403.         self.play(Write(titulo))
  404.         self.play(Write(polinomio))
  405.         self.wait()
  406.  
  407.         # Mostrar divisor
  408.         self.play(Write(divisor_label))
  409.         self.wait()
  410.  
  411.         # Mostrar tabela inicial
  412.         self.play(Create(tabela.get_horizontal_lines()), Create(tabela.get_vertical_lines()))
  413.         self.play(Write(tabela.get_entries()))
  414.         self.wait()
  415.  
  416.         # Animação passo a passo
  417.         # Destacar o coeficiente inicial
  418.         self.play(tabela.get_entries((1, 1)).animate.set_color(YELLOW))
  419.         self.wait()
  420.  
  421.         # Adicionar o primeiro produto (c * 1 = -1)
  422.         self.play(Indicate(tabela.get_entries((1, 1))), run_time=1)
  423.         self.play(tabela.get_entries((2, 2)).animate.set_color(RED))
  424.         self.wait()
  425.  
  426.         # Calcular a soma: -4 + (-1) = -5
  427.         self.play(Indicate(tabela.get_entries((2, 2))))
  428.         self.play(tabela.get_entries((3, 2)).animate.set_color(GREEN))
  429.         self.wait()
  430.  
  431.         # Repetir para os próximos passos
  432.         for i in range(2, 4):
  433.             # Calcular produto intermediário
  434.             self.play(Indicate(tabela.get_entries((3, i))))
  435.             self.play(tabela.get_entries((2, i + 1)).animate.set_color(RED))
  436.             self.wait()
  437.  
  438.             # Calcular o valor na linha de resultados
  439.             self.play(Indicate(tabela.get_entries((2, i + 1))))
  440.             self.play(tabela.get_entries((3, i + 1)).animate.set_color(GREEN))
  441.             self.wait()
  442.  
  443.         # Mostrar o resultado final
  444.         resultado = MathTex(r"Quociente: x^2 - 5x + 6, \text{ Resto: } 0").scale(0.8)
  445.         resultado.next_to(tabela, DOWN)
  446.         self.play(Write(resultado))
  447.         self.wait(3)
  448.  
  449. class quad(Scene):
  450.     def construct(self):
  451.         # Cria a equação
  452.         nova_quad = MathTex(r"x^2 - 5x + 6 = 0").to_edge(UP)
  453.  
  454.         nova_equacao4 = MathTex(r"x^3 - 4x^2 + x + 6 = 0")
  455.         nova_sol2 = MathTex(r"2^3 - 4 \cdot 2^2 + 2 + 6 = 0")
  456.         nova_sol3 = MathTex(r"3^3 - 4 \cdot 3^2 + 3 + 6 = 0")
  457.  
  458.         # Escrevendo a fórmula de Bhaskara
  459.         bhaskara_formula = MathTex(
  460.             r"x = \frac{-b \pm \sqrt{b^2 - 4ac}}{2a}"
  461.         ).next_to(nova_quad, DOWN, buff = 1)
  462.  
  463.         bhaskara_com_coef = MathTex(r"x = \frac{-(-5) \pm \sqrt{(-5)^2 - 4(1)(6)}}{2(1)}").next_to(bhaskara_formula, DOWN, buff = 1)
  464.         bhaskara_meio = MathTex(r"x = \frac{5 \pm \sqrt{25 - 24}}{2}").next_to(bhaskara_com_coef, DOWN, buff = 1)
  465.         bhaskara_quase = MathTex(r"x = \frac{5 \pm \sqrt{1}}{2}").next_to(bhaskara_meio, DOWN, buff = 1)
  466.         raises = MathTex(r"x_1 = 2, \, x_2 = 3").next_to(bhaskara_quase, DOWN, buff = 1)
  467.         ultima = MathTex(r"x_1 = -1").next_to(raises, DOWN, buff = 0.5)
  468.         possiveis_esticado = MathTex(r"\pm 1, \pm 2, \pm 3, \pm 6")
  469.  
  470.         respostas = VGroup(raises, ultima)
  471.  
  472.         ouro = FadeToColor(respostas, GOLD, run_time=1)
  473.         prata = FadeToColor(respostas, GRAY_B, run_time=1)
  474.         bronze = FadeToColor(respostas, LIGHT_BROWN, run_time=1)
  475.  
  476.         seta = Arrow(start=bhaskara_formula.get_bottom(), end=bhaskara_com_coef.get_top(), buff=0.1)
  477.  
  478.         # Cria o plano cartesiano
  479.         npl = NumberPlane(
  480.             x_range=[-config.frame_width / 2, config.frame_width / 2],
  481.             y_range=[-config.frame_height / 2, config.frame_height / 2],
  482.             axis_config={"stroke_color": WHITE},
  483.             background_line_style={
  484.                 "stroke_opacity": 0,  # Torna as linhas de fundo invisíveis
  485.             }
  486.         )
  487.         npl.add_coordinates()
  488.  
  489.         funcquad = lambda x: x**2 - 5*x + 6
  490.         funcube = lambda x: x**3 - 4*x**2 + x + 6
  491.  
  492.         self.play(Write(nova_quad))
  493.         self.wait(1)
  494.         self.play(Write(bhaskara_formula))
  495.         self.wait(1)
  496.         self.play(Write(seta))  # Animação da seta
  497.         self.play(Write(bhaskara_com_coef))  # Fórmula de Bhaskara com coeficientes
  498.         self.wait(2)
  499.         self.play(Write(bhaskara_meio))
  500.         self.wait(1)
  501.         self.play(Write(bhaskara_quase))
  502.         self.wait(1)
  503.         self.play(Write(raises))
  504.         self.wait(1)
  505.         self.play(Write(ultima))
  506.         self.wait(1)
  507.  
  508.         for i in range(2):
  509.             self.play(ouro)
  510.             self.play(prata)
  511.             self.play(bronze)
  512.        
  513.         self.play(Unwrite(VGroup(nova_quad, bhaskara_formula, bhaskara_com_coef, bhaskara_meio, bhaskara_quase,  seta)),ouro)
  514.         self.play(Write(possiveis_esticado), prata)
  515.         self.wait(1)
  516.         self.play(Unwrite(possiveis_esticado), bronze)
  517.         self.wait(1)
  518.         self.play(Unwrite(respostas))
  519.  
  520.         self.play(Write(npl), run_time=1)
  521.  
  522.         graph_quad = npl.plot(funcquad, color=BLUE)
  523.         graph_cube = npl.plot(funcube, color=MAROON)
  524.  
  525.         self.play(Create(graph_quad), run_time = 1)  # Plota as funções
  526.         self.play(Create(graph_cube), run_time = 1)
  527.        
  528.  
  529.         sol1 = Dot(npl.c2p(-1, 0), color=YELLOW).scale(1.5)
  530.         sol2 = Dot(npl.c2p(2, 0), color=YELLOW).scale(1.5)
  531.         sol3 = Dot(npl.c2p(3, 0), color=YELLOW).scale(1.5)
  532.  
  533.         sols = VGroup(sol1, sol2, sol3)
  534.  
  535.         self.play(Create(sols), run_time = 1)
  536.         self.wait(1)
  537.         self.play(Indicate(sols), run_time = 1)
  538.  
  539.         self.wait(1)
  540.  
  541.         leftover = VGroup()
  542.         for obj in self.mobjects:
  543.             if issubclass(obj.__class__, VMobject):
  544.                 leftover += obj
  545.         self.play(Unwrite(leftover))
  546.         self.wait(0.5)
  547.  
  548.  
  549. class subs(Scene):
  550.     def construct(self):
  551.  
  552.         sistema = MathTex(r"\left\{ \begin{aligned} &x + y + z = 4 \\ &x^2 + y^2 + z^2 = 14 \\ &x^3 + y^3 + z^3 = 34 \end{aligned} \right.")
  553.         sis = MathTex(r"\left\{ \begin{aligned} &x + y + z = 4 \\ &x^2 + y^2 + z^2 = 14 \\ &x^3 + y^3 + z^3 = 34 \end{aligned} \right.")
  554.         sis3 = MathTex(r"\left\{ \begin{aligned} &x + y + z = 4 \\ &x^2 + y^2 + z^2 = 14 \\ &x^3 + y^3 + z^3 = 34 \end{aligned} \right.")
  555.         sis4 = MathTex(r"\left\{ \begin{aligned} &x + y + z = 4 \\ &x^2 + y^2 + z^2 = 14 \\ &x^3 + y^3 + z^3 = 34 \end{aligned} \right.")
  556.         primeiraEq = MathTex(r"x + y + z = 4")
  557.         resposta1 = MathTex(r"-1 + 2 + 3 = 4")
  558.         segundaEq = MathTex(r"x^2 + y^2 + z^2 = 14")
  559.         resposta2 = MathTex(r"(-1)^2 + 2^2 + 3^2 = 14")
  560.         terceiraEq = MathTex(r"x^3 + y^3 + z^3 = 34")
  561.         resposta3 = MathTex(r"(-1)^3 + 2^3 + 3^3 = 34")      
  562.         qed = MathTex(r"\mathbb{Q} \text{ED}", font_size = 250).next_to(resposta3, DOWN, buff=0.4)
  563.  
  564.         sistema.to_edge(UP)
  565.         resposta1.next_to(sistema, DOWN, buff=1)
  566.         resposta2.next_to(resposta1, DOWN, buff=0.5)
  567.         resposta3.next_to(resposta2, DOWN, buff=0.5)
  568.  
  569.         self.play(Write(sistema))
  570.         self.wait(1)
  571.         self.play(Write(resposta1), run_time=2)
  572.         self.play(Write(resposta2), run_time=2)
  573.         self.play(Write(resposta3), run_time=2)
  574.         self.wait(1)
  575.         self.play(Write(qed), run_time=5)
Add Comment
Please, Sign In to add comment