Add an 'exclude' parameter to 'curvipy.Interval'
Closed this issue · 0 comments
dylannalex commented
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
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.