Skip to content

Instantly share code, notes, and snippets.

@ljmartin
Created July 4, 2022 03:32
Show Gist options
  • Select an option

  • Save ljmartin/1f55eb3ea76c3a8ed16703cc7bd4d322 to your computer and use it in GitHub Desktop.

Select an option

Save ljmartin/1f55eb3ea76c3a8ed16703cc7bd4d322 to your computer and use it in GitHub Desktop.
a function that looks like y=x at a distance, but smoothly goes to 1 instead of 0.
def f(x):
return (x**3 + x**2 + x + 1) / (x**2 + x + 1)
x = np.linspace(0,10,100)
plt.plot(x, f(x))
plt.plot(x,x)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment