Monday, December 5, 2016

macOS Sierra: Installing Haskell

Command:

$ brew install ghc cabal-install


Result:

==> Downloading https://homebrew.bintray.com/bottles/ghc-8.0.1_3.sierra.bottle.tar.gz
######################################################################## 100.0%
==> Pouring ghc-8.0.1_3.sierra.bottle.tar.gz
==> Using the sandbox
==> /usr/local/Cellar/ghc/8.0.1_3/bin/ghc-pkg recache
🍺  /usr/local/Cellar/ghc/8.0.1_3: 5,775 files, 1G
==> Downloading https://homebrew.bintray.com/bottles/cabal-install-1.24.0.1.sierra.bottle.tar.gz
######################################################################## 100.0%
==> Pouring cabal-install-1.24.0.1.sierra.bottle.tar.gz
==> Caveats
Bash completion has been installed to:
  /usr/local/etc/bash_completion.d
==> Summary
🍺  /usr/local/Cellar/cabal-install/1.24.0.1: 7 files, 27.7M

Laurence Day: Computerphile: Programming Paradigm: Imperative Programming & Functional Programming


  • sum [1..10]
  • sum::[Int]->Int



John Hughes (computer scientist): Computerphile: Functional Programming & Haskell

John Hughes (computer scientist)
Paul Hudak

Matt Phillips: Computerphile: Sega Game Coding in Assembly

Mike Pound: Computerphile: Slowloris Attack

Mike Pound


  • Low-and-slow attack

Thorsten Altenkirch: Computerphile: Quantum Computing 'Magic'

Thorsten Altenkirch
Peter Shor

  • Peter Shor
  • Quantum IO Monad

Sunday, December 4, 2016

Python: Returning Polynomial Function

Command:

$ cat makePoly.py 


Result:

# ax + b
def makePoly(arr):
    def fn(x):
        return sum(c*x**p for p,c in enumerate(arr))
    return fn

my_func = makePoly([6, 2])
print my_func(3) #return 12


Command:

$ python makePoly.py 


Result:

12

Python: Pi and Natural Logarithm

Command:

$ cat pi_and_natural_logarithm.py


Result:

import math

print 'Pi: %.30f' % math.pi
print 'e: %.30f' % math.e


Command:

$ python pi_and_natural_logarithm.py


Result:

Pi: 3.141592653589793115997963468544
e: 2.718281828459045090795598298428


Momoko Tsugunaga (嗣永桃子): PON!: ももち 卒業について告白!

Momoko Tsugunaga


  • 思ったより人気が出なかった

Robert Krulwich & Jonathan Borwein & Keith Devlin & Marcus du Sautoy & Simon Singh: World Science Festival: Mysteries of the Mathematical Universe

Robert Krulwich
Simon Singh
Marcus du Sautoy
Jonathan Borwein
Keith Devlin

Saturday, December 3, 2016

Python: Farey Sequence: The Farey sequences of orders 8

Command:

$ cat farey.py


Result:

def farey( n, asc=True ):
    if asc:
        a, b, c, d = 0, 1, 1 , n
    else:
        a, b, c, d = 1, 1, n-1, n
    print "%d/%d" % (a,b)
    while (asc and c <= n) or (not asc and a > 0):
        k = int((n + b)/d)
        a, b, c, d = c, d, k*c - a, k*d - b
        print "%d/%d" % (a,b)
farey(8)


Command:

$ python farey.py


Result:

0/1
1/8
1/7
1/6
1/5
1/4
2/7
1/3
3/8
2/5
3/7
1/2
4/7
3/5
5/8
2/3
5/7
3/4
4/5
5/6
6/7
7/8
1/1

Francis Bonahon (フランシス・ボナホン): Numberphile: Funny Fractions and Ford Circles

Francis Bonahon
Augustin-Louis Cauchy



  • Funny addition
  • Farey addition
  • Farey sum

Tadashi Tokieda (時枝正): Numberphile: A Strange Change of Rotation

Tadashi Tokieda

Ryoichi Taguchi (田口良一) & SEKAI NO OWARI: ミュージック・ポートレイト: 第一夜

Ryoichi Taguchi