Beranda contoh snippet dari yayo arellano byBang Kus -Agustus 19, 2024 import numpy as np import matplotlib.pyplot as plt def f1(x): return 2*(1-x) def f2(x): return 0 x = np.linspace(-5,5,1000) y = np.piecewise(x,[(x>0)*(x<1),(x≤0)*(x≥1)],[f1,f2]) plt.figure(figsize =(8,6)) plt.plot(x,y) Facebook Twitter