Value

class manim_eng.units.Value(value: int | float, units: UnitSequence)

Bases: object

Representation of a quantity with units for display purposes.

This is not a full unit system implementation, and should not be treated as such. It is designed purely for being passed to display functions for them to pretty-print values with units with an ergonomic interface for the user.

This constructor should not be used directly, but rather a value should be constructed through the product of an integer or float with a (combination of) units.

>>> 2 * KILO * VOLT
2 kV
Parameters:
  • value (int | float) – The numerical value of the quantity.

  • units (UnitSequence) – The units of the quantity.

to_latex() str

Return a LaTeX math mode string representation of the unit.

static to_si(number: int | float) Value

Convert a number to a factor and an SI prefix.

Will only consider the standard multiples of 1000 (so e.g. ‘c’ for ‘centi’ will never be output).

Parameters:

number (int | float) – The value to convert.

Returns:

A Value with the new factor and the SI prefix as its only unit.

Return type:

Value