pyuncertainnumber.propagation.performance

Functions

func_inspect()

inspect the formatting of the user-defined function

foo_args(x0, x1, x2)

func signature with individual inputs (arguments)

foo_iter(x)

func signature with iterable input (list, tuple, np.ndarray)

foo_vec(x)

func signature with matrix input (2D np.ndarray)

foo_universal(x)

a universal signature that takes iterable and matrix inputs but not individual inputs

bar(x)

a simple 2-dimensional function for testing purposes

bar_vec(x)

a simple vectroised 2-dimensional function for testing purposes

bar_universal(x)

a universal signature that takes iterable and matrix inputs but not individual inputs

bar_individual(x0, x1)

a simple 2-dimensional function for testing purposes with individual inputs

cb_func(x)

Calculates deflection and stress for a cantilever beam.

cb_deflection(x)

Calculates deflection and stress for a cantilever beam.

cb_deflection_vectorised(x)

Vectorised version for calculating cantilever beam deflection over multiple inputs.

cb_deflection_separate(L, I, F, E)

compute the deflection in the cantilever beam example

cb_stress(y, L, I, F)

to compute bending stress in the cantilever beam example

Module Contents

pyuncertainnumber.propagation.performance.func_inspect()

inspect the formatting of the user-defined function

pyuncertainnumber.propagation.performance.foo_args(x0, x1, x2)

func signature with individual inputs (arguments)

pyuncertainnumber.propagation.performance.foo_iter(x)

func signature with iterable input (list, tuple, np.ndarray)

pyuncertainnumber.propagation.performance.foo_vec(x)

func signature with matrix input (2D np.ndarray)

pyuncertainnumber.propagation.performance.foo_universal(x)

a universal signature that takes iterable and matrix inputs but not individual inputs

caveat:
  • this function works with a vector Interval object

  • but wrong answer with a 2d matrix Interval object due to unclear broadcasting rules

pyuncertainnumber.propagation.performance.bar(x)

a simple 2-dimensional function for testing purposes

pyuncertainnumber.propagation.performance.bar_vec(x)

a simple vectroised 2-dimensional function for testing purposes

pyuncertainnumber.propagation.performance.bar_universal(x)

a universal signature that takes iterable and matrix inputs but not individual inputs

caveat:
  • this function works with a vector Interval object

  • but wrong answer with a 2d matrix Interval object due to unclear broadcasting rules

pyuncertainnumber.propagation.performance.bar_individual(x0, x1)

a simple 2-dimensional function for testing purposes with individual inputs

pyuncertainnumber.propagation.performance.cb_func(x)

Calculates deflection and stress for a cantilever beam.

Parameters:

x (np.array) – Array of input parameters: x[0]: Distance from the neutral axis to the point of interest (m) x[1]: Length of the beam (m) x[2]: Second moment of area (mm^4) x[3]: Applied force (N) x[4]: Young’s modulus (MPa)

Returns:

np.array([deflection (m), stress (MPa)])

Returns np.array([np.nan, np.nan]) if calculation error occurs.

pyuncertainnumber.propagation.performance.cb_deflection(x: list[numbers.Number] | numpy.ndarray | pyuncertainnumber.pba.intervals.number.Interval | list[pyuncertainnumber.pba.intervals.number.Interval])

Calculates deflection and stress for a cantilever beam.

Parameters:

x (np.array) – Array of input parameters: x[0]: Length of the beam (m) x[1]: Second moment of area (mm^4) x[2]: Applied force (N) x[3]: Young’s modulus (MPa)

Returns:

deflection (m)

Returns np.nan if calculation error occurs.

Return type:

float

pyuncertainnumber.propagation.performance.cb_deflection_vectorised(x: numpy.ndarray | pyuncertainnumber.pba.intervals.number.Interval)

Vectorised version for calculating cantilever beam deflection over multiple inputs.

Parameters:

x (Interval or np.ndarray) – 2D inputs of matrix shape, x.shape = (N, 4)

pyuncertainnumber.propagation.performance.cb_deflection_separate(L, I, F, E)

compute the deflection in the cantilever beam example

# TODO add typing for UncertainNumber :param L: Length of the beam (m) :type L: UncertainNumber :param I: Second moment of area (mm^4) :param F: Applied force (N) :param E: Young’s modulus (MPa)

Returns:

deflection (m)

Returns np.nan if calculation error occurs.

Return type:

float

pyuncertainnumber.propagation.performance.cb_stress(y, L, I, F)

to compute bending stress in the cantilever beam example