# negate_elements¶

`sequencetools.``negate_elements`(sequence, absolute=False, indices=None, period=None)

Negates sequence elements.

Negates all elements:

```>>> sequence = [1, 2, 3, 4, 5, -6, -7, -8, -9, -10]
>>> sequencetools.negate_elements(sequence)
[-1, -2, -3, -4, -5, 6, 7, 8, 9, 10]
```

Negates elements at indices 0, 1 and 2:

```>>> sequence = [1, 2, 3, 4, 5, -6, -7, -8, -9, -10]
>>> sequencetools.negate_elements(sequence, indices=[0, 1, 2])
[-1, -2, -3, 4, 5, -6, -7, -8, -9, -10]
```

Negates elements at indices congruent to 0, 1 or 2 mod 5:

```>>> sequence = [1, 2, 3, 4, 5, -6, -7, -8, -9, -10]
>>> sequencetools.negate_elements(
...     sequence,
...     indices=[0, 1, 2],
...     period=5,
...     )
[-1, -2, -3, 4, 5, 6, 7, 8, -9, -10]
```

Negates the absolute value of all elements:

```>>> sequence = [1, 2, 3, 4, 5, -6, -7, -8, -9, -10]
>>> sequencetools.negate_elements(sequence, absolute=True)
[-1, -2, -3, -4, -5, -6, -7, -8, -9, -10]
```

Negates the absolute value elements at indices 0, 1 and 2:

```>>> sequence = [1, 2, 3, 4, 5, -6, -7, -8, -9, -10]
>>> sequencetools.negate_elements(
...     sequence,
...     absolute=True,
...     indices=[0, 1, 2],
...     )
[-1, -2, -3, 4, 5, -6, -7, -8, -9, -10]
```

Negates the absolute value elements at indices congruent to 0, 1 or 2 mod 5:

```>>> sequence = [1, 2, 3, 4, 5, -6, -7, -8, -9, -10]
>>> sequencetools.negate_elements(
...     sequence,
...     absolute=True,
...     indices=[0, 1, 2],
...     period=5,
...     )
[-1, -2, -3, 4, 5, -6, -7, -8, -9, -10]
```

Returns newly constructed list.