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


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".

Asked By: Riley P



This is a common
in any electrical engineering text.

If you have a
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
voltage source, things are more complicated.
The simplest case tends to be a sinusoidal waveform,
which admits of analytic solutions for
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
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.

Answered By: J_H
Categories: questions Tags: ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.