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]
__call__(x)[source]

returns value of Expr at point x

index(x, v=None)[source]

finds an existing point or insert one and returns its index

__len__()[source]
__iter__()[source]

iterators through discontinuities. take the opportunity to delete redundant tuples

append(item)[source]

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

extend(iterable)[source]

appends an iterable of (x,y) values

__getitem__(i)[source]
__str__()[source]
iapply(f, right)[source]

apply function to self

apply(f, right=None)[source]

apply function to copy of self

applx(f)[source]

apply a function to each x value

__lshift__(dx)[source]
__rshift__(dx)[source]
__add__(right)
__and__(right)
__class__

alias of type

__delattr__

Implement delattr(self, name).

__dir__() → list

default dir() implementation

__div__(right)
__eq__(other)
__format__()

default object formatter

__ge__

Return self>=value.

__getattribute__

Return getattr(self, name).

__gt__

Return self>value.

__hash__ = None
__invert__()
__le__

Return self<=value.

__lt__(other)
__mul__(right)
__ne__

Return self!=value.

__neg__()
__new__()

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

__or__(right)
__reduce__()

helper for pickle

__reduce_ex__()

helper for pickle

__repr__()
__rmul__(right)
__setattr__

Implement setattr(self, name, value).

__sizeof__() → int

size of object in memory, in bytes

__sub__(right)
__truediv__(right)
__xor__(right)
html(**kwargs)
isconstant
Returns:True if Expr evaluates to a constant number of bool
latex()
Returns:string LaTex formula
plot(**kwargs)

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

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

@return x and y for a line plot

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