Plot of graph is not smooth in Manim (math.sqrt(1-x**2))

167 views Asked by At

When I plot the graph of math.sqrt(1-x**2), the graph has unnatural bumps in it. How do I fix this? I'm very new to Manim.

Here's my code:

from manim import *
import math

class Myscene(Scene):
  def construct(self):

    axes = Axes(x_range=[-2.2, 2.2],
                y_range=[-1.1, 1.1]
    )
    axes.add_coordinates()

    self.play(Write(axes))
    self.wait(1)

    graph = axes.plot(lambda x: math.sqrt(1-x**2),
                      x_range=[-1, 1],
                      color = RED,
                      )

    self.play(Write(graph), run_time = 5)
    self.wait(5)

Here's the graph I get:

Graph of math.sqrt(1-x**2)

1

There are 1 answers

0
Alex On

I had the same issue. For your x-range, try putting another number indicating the step size of the approximation:

x_range=[-1,1,0.01]