Ramp Function

Ramp Function#


Ramp Function Wiki

\( \begin{aligned} R(x)= \begin{cases} x & x \ge 0 \\ 0 & x \lt 0 \\ \end{cases} =\text{max}\, (x, 0) \end{aligned} \)


import numpy             as np
import matplotlib.pyplot as plt

x = np.linspace(-2, 2, 4001)
a = -1
b = 1
y = np.where(x < 0, 0, x)
plt.plot(x, y);
../../_images/ac1f4da9d2217b227df8127d33fb58341b880ca48caed363a041516fce35bb52.png