ManimCommunity / ManimCommunity/manim

Error in Cosine Function Graph

Open
#1,555 6 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

issue:bug
Dominant language
Python
Stars
40.9k
Forks
3.1k
Avg merge
3d 12h
Merged PRs (30d)
25

Description

I am trying to create a cosine graph using Manim but it was different from the actual graph.
How should I edit my code to make it the actual graph. Thanks in advance.
Code:

from manim import *
from numpy import cos

class CreateGraph(GraphScene):
    def __init__(self, **kwargs):
        GraphScene.__init__(
            self,
            x_min=-5,
            x_max=5,
            y_min=-5,
            y_max=5,
            graph_origin=ORIGIN,
            axes_color=GREEN)


    def construct(self):
        # Create Graph
        self.setup_axes(animate=True)
        f1 = self.get_graph(lambda x: cos(1/x) , x_min=-4, x_max=4)
        
        # Construct the Figures
        self.play(ShowCreation(f1))
        self.wait(1)

Error:
cos
cos2

Environment

OS System: Windows 10
manim version: master <V.6 Community Version>
python version: .3.7.0

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by comparing the supplied CreateGraph example with the intended cosine graph, focusing on the function passed to get_graph and its x range. Reproduce the result with the stated Manim, Python, and Windows environment, then confirm that the rendered graph matches the expected cosine curve.

Written by the indexing model from the issue text.

Assessment

Tech stack
numpy, python
Domain
computer-graphics
Issue type
Bug
Difficulty
1/5
Estimated time
Under an hour
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.