Skip to content

Instantly share code, notes, and snippets.

@bechampion
Created June 27, 2017 07:14
Show Gist options
  • Save bechampion/25ef24c8ed82a787be2e517b671dbea7 to your computer and use it in GitHub Desktop.
Save bechampion/25ef24c8ed82a787be2e517b671dbea7 to your computer and use it in GitHub Desktop.
a basic curve
import numpy as np
import pylab as pl
def f(x):
return x**3 -3*x + 4
Y, X = np.mgrid[-10:10:100j, -10:10:100j]
print "res"
ys = list()
xs = list()
for i in range(0,len(Y)):
res = f(X.ravel()[i])
if res > 0:
ys.append(np.sqrt(res))
xs.append(X.ravel()[i])
pl.plot(xs, ys, "o")
pl.plot(xs, [-x for x in ys], "o")
pl.show()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment