코드
import matplotlib.pyplot as plt
var1 = [i for i in range(100)]
var2 = [2*i for i in range(100)]
avr1 = list(map(lambda x: (x+var2[x])/2, var1))
avr2 = list(map(lambda x: (x*var2[x])**0.5, var1))
plt.plot(range(100), var1)
plt.plot(range(100), var2)
plt.plot(range(100), avr1)
plt.plot(range(100), avr2)
plt.show()
히히
결과
- 1번, 4번선: $y=2x, y=x$
- 2번선: 산술평균, $y=\frac{3}{2}x$
- 3번선: 기하평군, $y=\sqrt{3}x$