Skip to content

Added documentation for discontinuous functions #2279

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 9 commits into from
Nov 29, 2021
Merged

Added documentation for discontinuous functions #2279

merged 9 commits into from
Nov 29, 2021

Conversation

icedcoffeeee
Copy link
Collaborator

@icedcoffeeee icedcoffeeee commented Nov 9, 2021

Overview: What does this pull request change?

  • Added documentation for the parameters discontinuities and dt
  • Added an example of how to better portray discontinuous functions

Motivation and Explanation: Why and how do your changes improve the library?

The example added:

class DiscontinousExample(Scene):
    def construct(self):
        ax1 = NumberPlane((-3, 3), (-4, 4))
        ax2 = NumberPlane((-3, 3), (-4, 4))
        VGroup(ax1, ax2).arrange()
        discontinuous_function = lambda x: (x ** 2 - 2) / (x ** 2 - 4)
        before = ax1.plot(discontinuous_function, color=RED)
        after = ax2.plot(
            discontinuous_function,
            discontinuities=[-2, 2],  # discontinuous points
            dt=0.1,  # left and right tolerance of discontinuity
            color=GREEN,
        )
        self.add(ax1, ax2, before, after)

Outcome:

DiscontinousExample_ManimCE_v0 12 0

Links to added or changed documentation pages

Documentation

Further Information and Comments

Reviewer Checklist

  • The PR title is descriptive enough for the changelog, and the PR is labeled correctly
  • If applicable: newly added non-private functions and classes have a docstring including a short summary and a PARAMETERS section
  • If applicable: newly added functions and classes are tested

@Darylgolden
Copy link
Member

Can you fix the docs build and merge conflict?

Copy link
Member

@Darylgolden Darylgolden left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor comment about phrasing, otherwise LGTM

@@ -62,6 +66,28 @@ def construct(self):
self.add(axes, curve1)
self.set_camera_orientation(phi=80 * DEGREES, theta=-60 * DEGREES)
self.wait()

.. attention::
In case your function contains discontinuous points, observe
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this wording is a little strange. How about "If your function has discontinuities, you'll have to specify the location of the discontinuities manually. See the following example for guidance."

Copy link
Member

@behackl behackl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@Darylgolden
Copy link
Member

I think it'll be good to call "before" and "after" "incorrect" and "correct" instead.

@hydrobeam hydrobeam added the documentation Improvements or additions to documentation label Nov 27, 2021
@behackl behackl requested a review from Darylgolden November 29, 2021 12:10
@behackl behackl dismissed Darylgolden’s stale review November 29, 2021 21:29

Variable names have been changed.

@behackl behackl merged commit a8f5280 into ManimCommunity:main Nov 29, 2021
@icedcoffeeee icedcoffeeee deleted the discontinuous-graph branch December 3, 2021 05:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants