# Ratio¶

class `mathtools.``Ratio`(numbers=(1, 1))

Ratio.

```>>> import abjad
```

Ratio of two numbers:

```>>> abjad.Ratio((2, 4))
Ratio((1, 2))
```

Ratio of three numbers:

```>>> abjad.Ratio((2, 4, 2))
Ratio((1, 2, 1))
```

## Attribute summary¶

 `count`(argument) Gets count of argument in ratio. `index`(argument) Gets index of argument in ratio. `multipliers` Gets multipliers of ratio. `numbers` Gets numbers of ratio. `__contains__`(argument) Is true when ratio contains argument. `__copy__`(*arguments) Copies Abjad value object. `__eq__`(argument) Is true when argument equals ratio. `__format__`([format_specification]) Formats duration. `__getitem__`(argument) Gets item or slice identified by argument. `__hash__`() Hashes ratio. `__iter__`() Iterates ratio. `__len__`() Gets length of ratio. `__ne__`(argument) Is true when Abjad object does not equal argument. `__rdiv__`(number) Divides number by ratio. `__repr__`() Gets interpreter representation of Abjad object. `__reversed__`() Iterates ratio in reverse. `__rtruediv__`(number) Divides number by ratio. `__str__`() Gets string representation of ratio.

`Ratio.``multipliers`

Gets multipliers of ratio.

Ratio of two numbers:

```>>> ratio = abjad.Ratio((2, 4))
>>> ratio.multipliers
(Multiplier(1, 3), Multiplier(2, 3))
```

Ratio of three numbers:

```>>> ratio = abjad.Ratio((2, 4, 2))
>>> ratio.multipliers
(Multiplier(1, 4), Multiplier(1, 2), Multiplier(1, 4))
```

Returns tuple of multipliers.

`Ratio.``numbers`

Gets numbers of ratio.

Ratio of two numbers:

```>>> ratio = abjad.Ratio((2, 4))
>>> ratio.numbers
(1, 2)
```

Ratio of three numbers:

```>>> ratio = abjad.Ratio((2, 4, 2))
>>> ratio.numbers
(1, 2, 1)
```

Set to tuple of two or more numbers.

Returns tuple of two or more numbers.

## Methods¶

`(NonreducedRatio).``count`(argument)

Gets count of argument in ratio.

Returns integer.

`(NonreducedRatio).``index`(argument)

Gets index of argument in ratio.

Returns integer.

## Special methods¶

`(NonreducedRatio).``__contains__`(argument)

Is true when ratio contains argument. Otherwise false.

Returns true or false.

`(AbjadValueObject).``__copy__`(*arguments)

Copies Abjad value object.

Returns new Abjad value object.

`Ratio.``__eq__`(argument)

Is true when argument equals ratio.

```>>> ratio_1 = abjad.Ratio((1, 2, 1))
>>> ratio_2 = abjad.Ratio((1, 2, 1))
>>> ratio_3 = abjad.Ratio((2, 3, 3))
```
```>>> ratio_1 == ratio_1
True
```
```>>> ratio_1 == ratio_2
True
```
```>>> ratio_1 == ratio_3
False
```
```>>> ratio_2 == ratio_1
True
```
```>>> ratio_2 == ratio_2
True
```
```>>> ratio_2 == ratio_3
False
```
```>>> ratio_3 == ratio_1
False
```
```>>> ratio_3 == ratio_2
False
```
```>>> ratio_3 == ratio_3
True
```
`(NonreducedRatio).``__format__`(format_specification='')

Formats duration.

Set format_specification to ‘’ or ‘storage’. Interprets ‘’ equal to ‘storage’.

```>>> ratio = abjad.NonreducedRatio((2, 4, 2))
>>> print(format(ratio))
```

Returns string.

`Ratio.``__getitem__`(argument)

Gets item or slice identified by argument.

```>>> ratio = abjad.Ratio((2, 4, 2))
>>> ratio[1]
2
```

Returns integer or tuple.

`Ratio.``__hash__`()

Hashes ratio.

Required to be explicitly redefined on Python 3 if __eq__ changes.

Returns integer.

`(NonreducedRatio).``__iter__`()

Iterates ratio.

Returns generator.

`Ratio.``__len__`()

Gets length of ratio.

```>>> ratio = abjad.Ratio((2, 4, 2))
>>> len(ratio)
3
```

Returns integer.

`(AbjadObject).``__ne__`(argument)

Is true when Abjad object does not equal argument. Otherwise false.

Returns true or false.

`(NonreducedRatio).``__rdiv__`(number)

Divides number by ratio.

```>>> 1 / abjad.Ratio((1, 1, 3))
[Fraction(1, 5), Fraction(1, 5), Fraction(3, 5)]
```
```>>> abjad.Fraction(1) / abjad.Ratio((1, 1, 3))
[Fraction(1, 5), Fraction(1, 5), Fraction(3, 5)]
```
```>>> 1.0 / abjad.Ratio((1, 1, 3))
[0.2, 0.2, 0.6]
```

Returns list of fractions or list of floats.

`(AbjadObject).``__repr__`()

Gets interpreter representation of Abjad object.

Returns string.

`(NonreducedRatio).``__reversed__`()

Iterates ratio in reverse.

Returns generator.

`(NonreducedRatio).``__rtruediv__`(number)

Divides number by ratio.

```>>> 1 / abjad.Ratio((1, 1, 3))
[Fraction(1, 5), Fraction(1, 5), Fraction(3, 5)]
```
```>>> abjad.Fraction(1) / abjad.Ratio((1, 1, 3))
[Fraction(1, 5), Fraction(1, 5), Fraction(3, 5)]
```
```>>> 1.0 / abjad.Ratio((1, 1, 3))
[0.2, 0.2, 0.6]
```

Returns list of fractions or list of floats.

`Ratio.``__str__`()

Gets string representation of ratio.

Ratio of two numbers:

```>>> str(abjad.Ratio((2, 4)))
'1:2'
```

Ratio of three numbers:

```>>> str(abjad.Ratio((2, 4, 2)))
'1:2:1'
```

Returns string.