Stresses

This module provides functionality related to stresses of frameworks.

pyrigi.framework._rigidity.stress.is_dict_stress(framework, dict_stress, **kwargs)[source]

Return whether a dictionary specifies an equilibrium stress of the framework.

Definitions

Equilibrium Stress

Parameters:
Return type:

bool

Examples

>>> F = Framework.Complete([[0,0], [1,0], ['1/2',0]])
>>> is_dict_stress(F, {(0,1):'-1/2', (0,2):1, (1,2):1})
True
>>> is_dict_stress(F, {(0,1):1, (1,2):'-1/2', (0,2):1})
False

Notes

See is_vector_stress().

pyrigi.framework._rigidity.stress.is_stress(framework, stress, **kwargs)[source]

Alias for is_vector_stress() and is_dict_stress().

One of the alias methods is called depending on the type of the input.

Parameters:
Return type:

bool

pyrigi.framework._rigidity.stress.is_vector_stress(framework, stress, edge_order=None, numerical=False, tolerance=1e-09)[source]

Return whether a vector is an equilibrium stress.

Definitions

Equilibrium stress

Parameters:
  • framework (FrameworkBase)

  • stress (Sequence[Number]) – A vector to be checked whether it is a stress of the framework.

  • edge_order (Sequence[Edge]) – A list of edges, providing the ordering for the entries of the stress. If none is provided, the list from Graph.edge_list() is taken.

  • numerical (bool) – A Boolean determining whether the evaluation of the product of the stress and the rigidity matrix is symbolic or numerical.

  • tolerance – Absolute tolerance that is the threshold for acceptable equilibrium stresses. This parameter is used to determine the number of digits, to which accuracy the symbolic expressions are evaluated.

Return type:

bool

Examples

>>> G = Graph([[0,1],[0,2],[0,3],[1,2],[2,3],[3,1]])
>>> pos = {0: (0, 0), 1: (0,1), 2: (-1,-1), 3: (1,-1)}
>>> F = Framework(G, pos)
>>> omega1 = [-8, -4, -4, 2, 2, 1]
>>> is_stress(F, omega1)
True
>>> omega1[0] = 0
>>> is_stress(F, omega1)
False
>>> from pyrigi import frameworkDB
>>> F = frameworkDB.Complete(5, dim=2)
>>> stresses_F = stresses(F)
>>> is_stress(F, stresses_F[0])
True
pyrigi.framework._rigidity.stress.stress_matrix(framework, stress, edge_order=None, vertex_order=None)[source]

Construct the stress matrix of a stress.

Definitions

Parameters:
Return type:

MutableDenseMatrix

Examples

>>> G = Graph([[0,1],[0,2],[0,3],[1,2],[2,3],[3,1]])
>>> pos = {0: (0, 0), 1: (0,1), 2: (-1,-1), 3: (1,-1)}
>>> F = Framework(G, pos)
>>> omega = [-8, -4, -4, 2, 2, 1]
>>> stress_matrix(F, omega)
Matrix([
[-16,  8,  4,  4],
[  8, -4, -2, -2],
[  4, -2, -1, -1],
[  4, -2, -1, -1]])
pyrigi.framework._rigidity.stress.stress_matrix_rank(framework, stress, edge_order=None, numerical=False, tolerance=1e-09)[source]

Return the rank of the stress matrix for a given stress.

Definitions

Parameters:
  • framework (FrameworkBase)

  • stress (Stress) – A stress of the framework given as a vector.

  • edge_order (Sequence[Edge]) – A list of edges, providing the ordering of edges in stress. If None, Graph.edge_list() is assumed.

  • numerical (bool) –

    If True, the rank of the stress matrix with entries as floats is computed.

    Warning: For numerical=True the numerical rank computation may produce different results than the computation over exact coordinates.

  • tolerance (float) – Numerical tolerance used for computing the rank.

Return type:

int

Examples

>>> F = Framework.Complete([(0, 0), (0, 1), (-1, -1), (1, -1)])
>>> omega = [-8, -4, -4, 2, 2, 1]
>>> is_stress(F, omega)
True
>>> stress_matrix(F, omega)
Matrix([
[-16,  8,  4,  4],
[  8, -4, -2, -2],
[  4, -2, -1, -1],
[  4, -2, -1, -1]])
>>> stress_matrix_rank(F, omega)
1
pyrigi.framework._rigidity.stress.stresses(framework, edge_order=None, numerical=False, tolerance=1e-09)[source]

Return a basis of the space of equilibrium stresses.

Definitions

Equilibrium stress

Parameters:
  • framework (FrameworkBase)

  • edge_order (Sequence[Edge]) – A list of edges, providing the ordering for the entries of the stresses. If none is provided, the list from Graph.edge_list() is taken.

  • numerical (bool) – Determines whether the output is symbolic (default) or numerical.

  • tolerance (float) – Used tolerance when computing the stresses numerically.

Return type:

list[MutableDenseMatrix] | list[list[float]]

Examples

>>> G = Graph([[0,1],[0,2],[0,3],[1,2],[2,3],[3,1]])
>>> pos = {0: (0, 0), 1: (0,1), 2: (-1,-1), 3: (1,-1)}
>>> F = Framework(G, pos)
>>> stresses(F)
[Matrix([
[-8],
[-4],
[-4],
[ 2],
[ 2],
[ 1]])]