durtools.in_terms_of — Abjad v1.1.1 documentation

### Navigation

- index
- modules |
- next |
- previous |
- Project Abjad »
- Abjad v1.1.1 documentation »
- Abjad API »

# durtools.in_terms_of

`abjad.tools.durtools.` `in_terms_of`(q, desired_denominator)

  Rewrite `q` in terms of `desired_denominator`.

  - `q`: `int`, `long`, `Rational`. Input value to rewrite.
  - `desired_denominator`: `int`. Desired denominator of output.

  Returns `(a', b')` pair such that `a' = a * desired_denominator / b` and `b' = desired_denominator`.

      >>> for pair in [(n, 6) for n in range(12)]:
      ...     print pair, in_terms_of(pair, 12)
      ...
      (0, 6) (0, 12)
      (1, 6) (2, 12)
      (2, 6) (4, 12)
      (3, 6) (6, 12)
      (4, 6) (8, 12)
      (5, 6) (10, 12)
      (6, 6) (12, 12)
      (7, 6) (14, 12)
      (8, 6) (16, 12)
      (9, 6) (18, 12)
      (10, 6) (20, 12)
      (11, 6) (22, 12)

### Navigation

- index
- modules |
- next |
- previous |
- Project Abjad »
- Abjad v1.1.1 documentation »
- Abjad API »