Skip to content
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

Add an 'exclude' parameter to 'curvipy.Interval' #9

Closed
dylannalex opened this issue Dec 7, 2022 · 0 comments
Closed

Add an 'exclude' parameter to 'curvipy.Interval' #9

dylannalex opened this issue Dec 7, 2022 · 0 comments
Labels
enhancement New feature or request wontfix This will not be worked on

Comments

@dylannalex
Copy link
Owner

dylannalex commented Dec 7, 2022

The idea is to exclude a list of values from the interval, so they won't be considered when plotting the curve.

curvipy.Interval:
    Parameters
    ----------
    start : int or float
        Real number in which the interval starts.
    end : int or float
        Real number in which the interval ends.
    samples: int
        Number of values within the interval. The more samples, the more precise the \
        curve plot is.
    exclude: list[int or float]
        List of values that will be excluded from the interval.

Example: imagine we want to plot the curve $f(x) = 1/x$ on the interval $x \in [-a, a]$. Since $f(0)$ is not defined, the current way of doing that is to create two intervals:

import curvipy


def f(x):
    return 1 / x


plotter = curvipy.Plotter()

a = 10
curve = curvipy.Function(f)
interval_one = curvipy.Interval(-a, -0.1, 100)
interval_two = curvipy.Interval(0.1, a, 100)

plotter.plot_curve(curve, interval_one)
plotter.plot_curve(curve, interval_two)
plotter.wait()

With an 'exclude' parameter on 'curvipy.Interval' class, we could accomplish the same goal with only one interval:

import curvipy


def f(x):
    return 1 / x


plotter = curvipy.Plotter()

a = 10
curve = curvipy.Function(f)
interval = curvipy.Interval(-a, a, 200, exclude=[0])

plotter.plot_curve(curve, interval)
plotter.wait()

If somebody wants to work on it, please make a comment. Implementing this is not as easy as it seems and might need modifications in other classes like curvipy.Plotter and/or curvipy.Curve.

@dylannalex dylannalex added the enhancement New feature or request label Dec 7, 2022
@dylannalex dylannalex added the wontfix This will not be worked on label Dec 28, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request wontfix This will not be worked on
Projects
None yet
Development

No branches or pull requests

1 participant