code: def rect_example(savefile="rect_example.png"):
      def f(p, t):
          return jnp.polyval(p, t)
  
      p = jnp.array([1, 2, 3])
      time = jnp.linspace(0, 10, 1000)
  
      y1 = f(p, time)
      y2 = [qml.pulse.rect(f, windows=[(1, 7)])(p, t) for t in time]
  
      plt.plot(time, y1, label=f"polyval, P = {p}")
      plt.plot(time, y2, label="rect(polyval), windows = [(1, 7)]")
      plt.legend()
  
      plt.savefig(folder / savefile)
      plt.close()
  
imports: import pathlib
  import matplotlib.pyplot
  from jax import numpy
  import pennylane
label_desc: Use image node_id 3 for calling a global function with example usage: rect_example(savefile) and returns: jnp