# What is the "peak to peak" analogy refrenced by numpy's .ptp function?

## Question:

The np.ptp function returns the range between minimum and maximum values along a specified axis. The numpy docs state that the "ptp" name is an acronym for "peak to peak". Can someone explain this analogy?

I would have thought this function would have been named "valley to peak".

## Answers:

This is a common

term

in any electrical engineering text.

If you have a

DC

voltage source referenced to some ground point,

it is easy to report the voltage

and predict how much a large-valued resistor would

heat up, that is, to predict dissipated power.

If you have an

AC

voltage source, things are more complicated.

The simplest case tends to be a sinusoidal waveform,

which admits of analytic solutions for

RMS

power dissipation.

But in general, an AC source might not be a perfect sinusoid.

It might be clipped, or have harmonics, or be approximately a square wave.

For all such cases we can accurately report the

peak-to-peak

voltage, even in an instance where an exotic waveform would make it a challenge

to predict what power would be dissipated by an attached load.