Integral Functions#

Truncate#

class cake.Truncate(parameter: Any, coefficient: Any = 1, power: Any = 1)[source]#

Bases: Function

Truncate function, see math.trunc

>>> t = Truncate(Variable('x'))
>>> t.evaluate(x=1.55)
Real(1.0)
>>> t.evaluate(x=3)
Real(3.0)
>>> t.evaluate(x=Variable('y'))
Truncate(y)
auto_postprocess: bool#

Whether to automatically post process value

auto_prehandle: bool#

Whether to automatically pre-handle a value, this is right before the value is passed through the handler

Warning

this is after the value is converted to radians!

auto_preprocess: bool#

Whether to automatically preprocess value

auto_to_radians: bool#

Convert value to radians before passing through function

coefficient: Any#

Functions coefficient

copy() Function#

Returns a shallow copy of the function

evaluate(to_radians: bool = False, use_preprocess: bool = False, use_postprocess: bool = False, use_prehandler: bool = False, **kwds) Any#

Evaluates the function, returning a result.

Parameters:
  • to_radians (bool) – Whether to convert value given to radians, useful for trig applications.

  • use_preprocess (bool) – Whether to use given pre processor, if any.

  • use_postprocess (bool) – Whether to use given post processor, if any.

  • use_prehandler (bool) – Whether to use given pre handler, if any.

  • **kwds (Any[Like[cake.BasicNode]]) – Any values for variables to use.

parameter: Any#

Internal parameter of function

postprocessor: Callable[[Any], Any]#

postprocessor function

power: Any#

Power function is raised to

prehandler: Callable[[Any], Any]#

prehandler function

preprocessor: Callable[[dict], dict]#

preprocessor function, the value passed is the dictionary of given values, must return a new mapping of values to use instead.

Ceil#

class cake.Ceil(parameter: Any, coefficient: Any = 1, power: Any = 1)[source]#

Bases: Function

Ceil function, see math.ceil

>>> c = Ceil(Variable('x'))
>>> c.evaluate(x=1.2)
Real(2.0)
>>> c.evaluate(x=1.532)
Real(2.0)
>>> c.evaluate(x=Variable('y'))
Ceil(y)
auto_postprocess: bool#

Whether to automatically post process value

auto_prehandle: bool#

Whether to automatically pre-handle a value, this is right before the value is passed through the handler

Warning

this is after the value is converted to radians!

auto_preprocess: bool#

Whether to automatically preprocess value

auto_to_radians: bool#

Convert value to radians before passing through function

coefficient: Any#

Functions coefficient

copy() Function#

Returns a shallow copy of the function

evaluate(to_radians: bool = False, use_preprocess: bool = False, use_postprocess: bool = False, use_prehandler: bool = False, **kwds) Any#

Evaluates the function, returning a result.

Parameters:
  • to_radians (bool) – Whether to convert value given to radians, useful for trig applications.

  • use_preprocess (bool) – Whether to use given pre processor, if any.

  • use_postprocess (bool) – Whether to use given post processor, if any.

  • use_prehandler (bool) – Whether to use given pre handler, if any.

  • **kwds (Any[Like[cake.BasicNode]]) – Any values for variables to use.

parameter: Any#

Internal parameter of function

postprocessor: Callable[[Any], Any]#

postprocessor function

power: Any#

Power function is raised to

prehandler: Callable[[Any], Any]#

prehandler function

preprocessor: Callable[[dict], dict]#

preprocessor function, the value passed is the dictionary of given values, must return a new mapping of values to use instead.

Floor#

class cake.Floor(parameter: Any, coefficient: Any = 1, power: Any = 1)[source]#

Bases: Function

Floor function, see math.floor

>>> f = Floor(Variable('x'))
>>> f.evaluate(x=1.5)
Real(1.0)
>>> f.evaluate(x=3.563)
Real(3.0)
>>> f.evaluate(x=Variable('y'))
Floor(y)
auto_postprocess: bool#

Whether to automatically post process value

auto_prehandle: bool#

Whether to automatically pre-handle a value, this is right before the value is passed through the handler

Warning

this is after the value is converted to radians!

auto_preprocess: bool#

Whether to automatically preprocess value

auto_to_radians: bool#

Convert value to radians before passing through function

coefficient: Any#

Functions coefficient

copy() Function#

Returns a shallow copy of the function

evaluate(to_radians: bool = False, use_preprocess: bool = False, use_postprocess: bool = False, use_prehandler: bool = False, **kwds) Any#

Evaluates the function, returning a result.

Parameters:
  • to_radians (bool) – Whether to convert value given to radians, useful for trig applications.

  • use_preprocess (bool) – Whether to use given pre processor, if any.

  • use_postprocess (bool) – Whether to use given post processor, if any.

  • use_prehandler (bool) – Whether to use given pre handler, if any.

  • **kwds (Any[Like[cake.BasicNode]]) – Any values for variables to use.

parameter: Any#

Internal parameter of function

postprocessor: Callable[[Any], Any]#

postprocessor function

power: Any#

Power function is raised to

prehandler: Callable[[Any], Any]#

prehandler function

preprocessor: Callable[[dict], dict]#

preprocessor function, the value passed is the dictionary of given values, must return a new mapping of values to use instead.

Round#

class cake.Round(parameter: Any, coefficient: Any = 1, power: Any = 1, n_places: int = 2)[source]#

Bases: Function

Round function, see round

>>> r = Round(Variable('x'))
>>> r.evaluate(x=1.3)
Real(1.3)
>>> r.evaluate(x=1.532)
Real(1.53)
>>> r.evaluate(x=y)
Round(y, places=2)
>>> r = Round(Variable('x'), n_places=3)
>>> r.evaluate(x=3.2222)
Real(3.222)

Inherits same parameters as Function

Parameters:

n_places (int) – Number of places to round object, defaults to 2.

auto_postprocess: bool#

Whether to automatically post process value

auto_prehandle: bool#

Whether to automatically pre-handle a value, this is right before the value is passed through the handler

Warning

this is after the value is converted to radians!

auto_preprocess: bool#

Whether to automatically preprocess value

auto_to_radians: bool#

Convert value to radians before passing through function

coefficient: Any#

Functions coefficient

copy() Function#

Returns a shallow copy of the function

evaluate(to_radians: bool = False, use_preprocess: bool = False, use_postprocess: bool = False, use_prehandler: bool = False, **kwds) Any#

Evaluates the function, returning a result.

Parameters:
  • to_radians (bool) – Whether to convert value given to radians, useful for trig applications.

  • use_preprocess (bool) – Whether to use given pre processor, if any.

  • use_postprocess (bool) – Whether to use given post processor, if any.

  • use_prehandler (bool) – Whether to use given pre handler, if any.

  • **kwds (Any[Like[cake.BasicNode]]) – Any values for variables to use.

parameter: Any#

Internal parameter of function

postprocessor: Callable[[Any], Any]#

postprocessor function

power: Any#

Power function is raised to

prehandler: Callable[[Any], Any]#

prehandler function

preprocessor: Callable[[dict], dict]#

preprocessor function, the value passed is the dictionary of given values, must return a new mapping of values to use instead.