Wikipedia: Let P be a point and C be a circle whose center is not P. Then the envelope of those circles whose center lies on C and that pass through P is a limaçon.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def S((a,b,c), k=1): | |
return (a, -2*a*k+b, a*k**2-b*k+c) | |
def T((a,b,c)): | |
return (c,b,a) | |
x = (1,33,-21) | |
x = (7, 33, -8) | |
x = (13,13,-22) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
import matplotlib.pyplot as plt | |
%matplotlib inline | |
# http://stackoverflow.com/questions/11175131/code-for-greatest-common-divisor-in-python | |
def gcd(x, y): | |
while y != 0: | |
(x, y) = (y, x % y) | |
return x |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import requests | |
key = '' | |
r = requests.get('http://datamine.mta.info/mta_esi.php?key=%s&feed_id=1'%(key)) | |
# http://datamine.mta.info/sites/all/files/pdfs/nyct-subway.proto.txt | |
# https://developers.google.com/transit/gtfs-realtime/gtfs-realtime-proto | |
# https://github.com/google/protobuf | |
import gtfs_realtime_pb2, nyct_subway_pb2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<head> | |
<script src="http://d3js.org/d3.v3.min.js" charset="utf-8"></script> | |
</head> | |
<body> | |
<svg id="board" width=500 height=500></svg> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- variant of tutorial | |
-- type "./notes" in terminal | |
{-# LANGUAGE OverloadedStrings #-} | |
import Control.Monad (forM_) | |
import Text.Blaze.Html5 | |
import Text.Blaze.Html5.Attributes | |
import qualified Text.Blaze.Html5 as H | |
import qualified Text.Blaze.Html5.Attributes as A |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
wget -O http://jaspervdj.be/blaze | blaze-from-html -v html4-transitional | |
#OR | |
curl -S http://jaspervdj.be/blaze | blaze-from-html -v html4-transitional |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- http://hackage.haskell.org/package/pipes-text-0.0.0.12/docs/Pipes-Text-IO.html | |
-- http://hackage.haskell.org/package/pipes | |
-- http://hackage.haskell.org/package/pipes-text | |
import Pipes | |
import qualified Pipes.Text as Text | |
import qualified Pipes.Text.IO as Text | |
import System.IO | |
-- http://stackoverflow.com/questions/19521246/what-does-mean-do-in-haskell |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sum [2,3,4] | |
product [2,3,4] |