Skip to content

Commit 1714701

Browse files
committed
Haha common.
1 parent eb8fe15 commit 1714701

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

python/stochastic/common.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#! /usr/bin/env python3
2+
3+
import math
4+
5+
"""
6+
Not in the original code listing. This factors out the common functions
7+
used in Chapter 2.
8+
"""
9+
10+
def euc_2d(p1, p2):
11+
dx = p1[0] - p2[0]
12+
dy = p1[1] - p2[1]
13+
return math.sqrt((dx ** 2) + (dy ** 2))

0 commit comments

Comments
 (0)