Manim MathTex is not giving right output for differential equation

265 Views Asked by At

So i want to output of the differential equation as shown but i am not getting the correct equation as output i have tried the latex code as well but still not working

from manim import *


class CreateCircle(Scene):
    def construct(self):
        eq_one = MathTex("a^{2}+b^{2}=1")
       
        eq_two= MathTex("\\frac{\text{d}^{2}x}{\text{d}y}","+","\\frac{\text{d}^{2}y}{\text{d}x}=","1")
        eq_two.next_to(eq_one,DOWN)
        self.wait()
        self.play(Write(eq_one))

        self.wait(3)
        self.play(Write(eq_two))
        self.wait(2)

The desired output is: Desired Image

1

There are 1 best solutions below

0
On

Welcome to SO! You forgot to escape the \ character.

Output

from manim import *
class Test(Scene):
  def construct(self):
    eq_one = MathTex("a^{2}+b^{2}=1")
    
    eq_two= MathTex("\\frac{\\text{d}^{2}x}{\\text{d}y}","+","\\frac{\\text{d}^{2}y}{\\text{d}x}=","1")
    eq_two.next_to(eq_one,DOWN)
    self.wait()
    self.play(Write(eq_one))

    self.wait(3)
    self.play(Write(eq_two))
    self.wait(2)