{ "cells": [], "metadata": { "kernelspec": { "display_name": "Python 3", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.6.3" } }, "nbformat": 4, "nbformat_minor": 2 } %matplotlib inline import matplotlib.pyplot as plt np.random.seed(seed=42) N = 1000 x = np.random.uniform(size=N, low=0, high=1) y = np.random.uniform(size=N, low=0, high=1) 1 accept = (x*x+y*y) <= 1 reject = np.logical_not(accept) fig, ax = plt.subplots(1) ax.scatter(x[accept], y[accept], c='b', alpha=0.2, edgecolor=None) ax.scatter(x[reject], y[reject], c='r', alpha=0.2, edgecolor=None) ax.set_aspect('equal')