Skip to content

Instantly share code, notes, and snippets.

@vgoklani
Forked from glamp/log_func.py
Created September 27, 2016 17:07
Show Gist options
  • Save vgoklani/b4005a1fd7f142be913efb59af97c146 to your computer and use it in GitHub Desktop.
Save vgoklani/b4005a1fd7f142be913efb59af97c146 to your computer and use it in GitHub Desktop.
import numpy as np
import pylab as pl
x = np.random.uniform(1, 100, 1000)
y = np.log(x) + np.random.normal(0, .3, 1000)
pl.scatter(x, y, s=1, label="log(x) with noise")
pl.plot(np.arange(1, 100), np.log(np.arange(1, 100)), c="b", label="log(x) true function")
pl.xlabel("x")
pl.ylabel("f(x) = log(x)")
pl.legend(loc="best")
pl.title("A Basic Log Function")
pl.show()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment