c4dynamics.states.state.state.V

Contents

c4dynamics.states.state.state.V#

state.V()[source]#

Velocity Magnitude.

Calculates the magnitude of the object velocity :

\[V = \sum_{k=v_x,v_y,v_z} self.k^2\]

If the state doesn’t include any velocity coordinate (vx, vy, vz), a ValueError is raised.

Returns:

out (float) – Euclidean norm of the velocity vector. The return type specifically is a numpy.float64.

Raises:

TypeError – If the state does not include any velocity coordinate (vx, vy, vz).

Note

In the context of V(), vx, vy, vz, (case sensitive) are considered velocity coordinates.

Examples

>>> s = c4d.state(vx = 7, vy = 24)
>>> s.V()
25.0
>>> s = c4d.state(x = 100, y = 0, vx = -10, vy = 7)
>>> s.V()   
12.2...

Uncommenting the following line throws a type error:

>>> s = c4d.state(x = 100, y = 0)
>>> # s.V()
TypeError: state must have at least one velocity coordinate (vx, vy, or vz)