Goulib.piecewise module

piecewise-defined functions

class Goulib.piecewise.Piecewise(init=[], default=0, start=-inf)[source]

Bases: Goulib.expr.Expr

piecewise function defined by a sorted list of (startx, Expr)

__init__(init=[], default=0, start=-inf)[source]

returns value of Expr at point x

index(x, v=None)[source]

finds an existing point or insert one and returns its index


iterators through discontinuities. take the opportunity to delete redundant tuples


appends a (x,y) item. In fact inserts it at correct position and returns the corresponding index


appends an iterable of (x,y) values

iapply(f, right)[source]

apply function to self

apply(f, right=None)[source]

apply function to copy of self


apply a function to each x value


alias of type


Implement delattr(self, name).

__dir__() → list

default dir() implementation


default object formatter


Return self>=value.


Return getattr(self, name).


Return self>value.

__hash__ = None

Return self<=value.


Return self!=value.


Create and return a new object. See help(type) for accurate signature.


helper for pickle


helper for pickle


Implement setattr(self, name, value).

__sizeof__() → int

size of object in memory, in bytes

Returns:True if Expr evaluates to a constant number of bool
Returns:string LaTex formula

renders on IPython Notebook (alias to make usage more straightforward)

points(min=0, xmax=None, eps=0)[source]

@return x and y for a line plot

render(fmt='svg', **kwargs)
save(filename, **kwargs)