Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
probml
GitHub Repository: probml/pyprobml
Path: blob/master/notebooks/book1/08/smooth-vs-nonsmooth-1d.ipynb
1192 views
Kernel: Unknown Kernel
import numpy as np import matplotlib.pyplot as plt try: import probml_utils as pml except ModuleNotFoundError: %pip install -qq git+https://github.com/probml/probml-utils.git import probml_utils as pml x = np.linspace(-1, 1, 100) y = np.power(x, 2) plt.figure() plt.plot(x, y, "-", lw=3) plt.title("Smooth function") pml.savefig("smooth-fn.pdf") y = np.abs(x) plt.figure() plt.plot(x, y, "-", lw=3) plt.title("Non-smooth function") pml.savefig("nonsmooth-fn.pdf") plt.show()