Add files via upload
This commit is contained in:
parent
231b9e8062
commit
186a470753
@ -64,38 +64,35 @@
|
||||
"\n",
|
||||
" {(1, 3), (2, 4), (5, 7), (6, 8), (9, 10)}\n",
|
||||
"\n",
|
||||
"We'll write a program to generate all possible sets of rectangles, following method 2, and then just count how many there are. To implement method 2, first consider all possible ways to pick an `(A, B)` rectangle while leaving the rest of the sides:"
|
||||
"We'll write a program to generate all possible sets of rectangles, following method 2, and then just count how many there are. To implement method 2, the minimum side will always be the first element, A, in an (A, B) pair. We iterate through all possible values for B, and then join that pair with all possible rectangles made from the remaining sides. We also have to handle the case when there are no sides; then there is one possible set of rectangles: the empty set."
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 1,
|
||||
"metadata": {
|
||||
"collapsed": true
|
||||
},
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"def picks(sides):\n",
|
||||
" \"List [((A, B), rest), ...] where (A, B) is a possible next rectangle and `rest` is the rest of the sides.\"\n",
|
||||
" A = min(sides)\n",
|
||||
" return [((A, B), sides - {A, B}) for B in sides - {A}]"
|
||||
"def rectangle_sets(sides):\n",
|
||||
" \"Given a set of sides, list all distinct sets of rectangles that can be made.\"\n",
|
||||
" if not sides:\n",
|
||||
" return [ set() ]\n",
|
||||
" else:\n",
|
||||
" A = min(sides)\n",
|
||||
" return [ {(A, B)} | other_rects\n",
|
||||
" for B in sides if B is not A\n",
|
||||
" for other_rects in rectangle_sets(sides - {A, B}) ]"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 2,
|
||||
"metadata": {
|
||||
"collapsed": false
|
||||
},
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"data": {
|
||||
"text/plain": [
|
||||
"[((1, 2), {3, 4, 5, 6}),\n",
|
||||
" ((1, 3), {2, 4, 5, 6}),\n",
|
||||
" ((1, 4), {2, 3, 5, 6}),\n",
|
||||
" ((1, 5), {2, 3, 4, 6}),\n",
|
||||
" ((1, 6), {2, 3, 4, 5})]"
|
||||
"[{(1, 2), (3, 4)}, {(1, 3), (2, 4)}, {(1, 4), (2, 3)}]"
|
||||
]
|
||||
},
|
||||
"execution_count": 2,
|
||||
@ -104,41 +101,20 @@
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"# There are 5 ways to pick a rectangle from 6 sides:\n",
|
||||
"picks({1, 2, 3, 4, 5, 6})"
|
||||
"rectangle_sets({1, 2, 3, 4})"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"If we assume there will be exactly 10 sides in a set, we can just call `picks` 5 times in nested loops to get 5 rectangles:"
|
||||
"We see above that there are three possible rectangle sets for 4 sides (the 1 can pair with any other side, and then a second rectangle can only be made one way from the remaining 2 sides). Below we count how many can be made with 10 sides:"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 3,
|
||||
"metadata": {
|
||||
"collapsed": false
|
||||
},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"def sets_of_rectangles(sides):\n",
|
||||
" \"Given exactly 10 sides, list all distinct sets of rectangles that can be made from sides.\"\n",
|
||||
" return [{r1, r2, r3, r4, r5}\n",
|
||||
" for (r1, rest1) in picks(sides)\n",
|
||||
" for (r2, rest2) in picks(rest1)\n",
|
||||
" for (r3, rest3) in picks(rest2)\n",
|
||||
" for (r4, rest4) in picks(rest3)\n",
|
||||
" for (r5, _) in picks(rest4)]"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 4,
|
||||
"metadata": {
|
||||
"collapsed": false
|
||||
},
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"data": {
|
||||
@ -146,7 +122,7 @@
|
||||
"945"
|
||||
]
|
||||
},
|
||||
"execution_count": 4,
|
||||
"execution_count": 3,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
}
|
||||
@ -154,7 +130,7 @@
|
||||
"source": [
|
||||
"sides = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}\n",
|
||||
"\n",
|
||||
"all_sets = sets_of_rectangles(sides)\n",
|
||||
"all_sets = rectangle_sets(sides)\n",
|
||||
"\n",
|
||||
"len(all_sets)"
|
||||
]
|
||||
@ -170,27 +146,25 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 5,
|
||||
"metadata": {
|
||||
"collapsed": false
|
||||
},
|
||||
"execution_count": 4,
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"data": {
|
||||
"text/plain": [
|
||||
"[{(1, 2), (3, 4), (5, 8), (6, 9), (7, 10)},\n",
|
||||
" {(1, 2), (3, 10), (4, 6), (5, 9), (7, 8)},\n",
|
||||
" {(1, 3), (2, 10), (4, 9), (5, 7), (6, 8)},\n",
|
||||
" {(1, 4), (2, 10), (3, 8), (5, 9), (6, 7)},\n",
|
||||
" {(1, 5), (2, 9), (3, 6), (4, 10), (7, 8)},\n",
|
||||
" {(1, 6), (2, 9), (3, 10), (4, 7), (5, 8)},\n",
|
||||
" {(1, 7), (2, 9), (3, 8), (4, 10), (5, 6)},\n",
|
||||
" {(1, 8), (2, 7), (3, 5), (4, 10), (6, 9)},\n",
|
||||
" {(1, 9), (2, 7), (3, 10), (4, 6), (5, 8)},\n",
|
||||
" {(1, 10), (2, 7), (3, 8), (4, 9), (5, 6)}]"
|
||||
"[{(1, 2), (3, 4), (5, 6), (7, 8), (9, 10)},\n",
|
||||
" {(1, 2), (3, 10), (4, 8), (5, 6), (7, 9)},\n",
|
||||
" {(1, 3), (2, 10), (4, 6), (5, 7), (8, 9)},\n",
|
||||
" {(1, 4), (2, 10), (3, 5), (6, 8), (7, 9)},\n",
|
||||
" {(1, 5), (2, 9), (3, 8), (4, 6), (7, 10)},\n",
|
||||
" {(1, 6), (2, 9), (3, 5), (4, 7), (8, 10)},\n",
|
||||
" {(1, 7), (2, 9), (3, 4), (5, 8), (6, 10)},\n",
|
||||
" {(1, 8), (2, 7), (3, 9), (4, 5), (6, 10)},\n",
|
||||
" {(1, 9), (2, 7), (3, 5), (4, 6), (8, 10)},\n",
|
||||
" {(1, 10), (2, 7), (3, 4), (5, 8), (6, 9)}]"
|
||||
]
|
||||
},
|
||||
"execution_count": 5,
|
||||
"execution_count": 4,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
}
|
||||
@ -199,92 +173,6 @@
|
||||
"all_sets[::100]"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"However, I don't like the fact that the code only works for exactly 10 sides, and it violates the \"[don't repeat yourself](http://en.wikipedia.org/wiki/Don't_repeat_yourself)\" maxim by having essentially the same line of code repeated five times. So let's convert the nested-loop algorithm into a *recursive* algorithm that picks the first rectangle (in the same way as before), but then recursively solves for the remaining sides and unions the first rectangle with each set of rectangles from the remaining sides. To stop the recursion we have to handle the case when there are no sides; then there is one way to make a set of rectangles: the empty set."
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 6,
|
||||
"metadata": {
|
||||
"collapsed": true
|
||||
},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"def sets_of_rectangles(sides):\n",
|
||||
" \"Given a set of sides, list all distinct sets of rectangles that can be made from sides.\"\n",
|
||||
" if not sides:\n",
|
||||
" return [ set() ]\n",
|
||||
" else:\n",
|
||||
" return [{rect} | other_rects\n",
|
||||
" for (rect, rest) in picks(sides)\n",
|
||||
" for other_rects in sets_of_rectangles(rest)]"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 7,
|
||||
"metadata": {
|
||||
"collapsed": false
|
||||
},
|
||||
"outputs": [
|
||||
{
|
||||
"data": {
|
||||
"text/plain": [
|
||||
"[{(1, 2), (3, 4), (5, 6)},\n",
|
||||
" {(1, 2), (3, 5), (4, 6)},\n",
|
||||
" {(1, 2), (3, 6), (4, 5)},\n",
|
||||
" {(1, 3), (2, 4), (5, 6)},\n",
|
||||
" {(1, 3), (2, 5), (4, 6)},\n",
|
||||
" {(1, 3), (2, 6), (4, 5)},\n",
|
||||
" {(1, 4), (2, 3), (5, 6)},\n",
|
||||
" {(1, 4), (2, 5), (3, 6)},\n",
|
||||
" {(1, 4), (2, 6), (3, 5)},\n",
|
||||
" {(1, 5), (2, 3), (4, 6)},\n",
|
||||
" {(1, 5), (2, 4), (3, 6)},\n",
|
||||
" {(1, 5), (2, 6), (3, 4)},\n",
|
||||
" {(1, 6), (2, 3), (4, 5)},\n",
|
||||
" {(1, 6), (2, 4), (3, 5)},\n",
|
||||
" {(1, 6), (2, 5), (3, 4)}]"
|
||||
]
|
||||
},
|
||||
"execution_count": 7,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"# For example, with 6 sides:\n",
|
||||
"sets_of_rectangles({1, 2, 3, 4, 5, 6})"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 8,
|
||||
"metadata": {
|
||||
"collapsed": false
|
||||
},
|
||||
"outputs": [
|
||||
{
|
||||
"data": {
|
||||
"text/plain": [
|
||||
"945"
|
||||
]
|
||||
},
|
||||
"execution_count": 8,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"# Reaffirm the answer with 10 sides\n",
|
||||
"all_sets = sets_of_rectangles(sides)\n",
|
||||
"len(all_sets)"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
@ -305,10 +193,8 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 9,
|
||||
"metadata": {
|
||||
"collapsed": false
|
||||
},
|
||||
"execution_count": 5,
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"data": {
|
||||
@ -316,7 +202,7 @@
|
||||
"190"
|
||||
]
|
||||
},
|
||||
"execution_count": 9,
|
||||
"execution_count": 5,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
}
|
||||
@ -334,10 +220,8 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 10,
|
||||
"metadata": {
|
||||
"collapsed": false
|
||||
},
|
||||
"execution_count": 6,
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"data": {
|
||||
@ -345,7 +229,7 @@
|
||||
"110"
|
||||
]
|
||||
},
|
||||
"execution_count": 10,
|
||||
"execution_count": 6,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
}
|
||||
@ -363,10 +247,8 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 11,
|
||||
"metadata": {
|
||||
"collapsed": false
|
||||
},
|
||||
"execution_count": 7,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"def total_area(rectangles): return sum(w * h for (w, h) in rectangles)"
|
||||
@ -374,10 +256,8 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 12,
|
||||
"metadata": {
|
||||
"collapsed": false
|
||||
},
|
||||
"execution_count": 8,
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"data": {
|
||||
@ -385,7 +265,7 @@
|
||||
"{(1, 2), (3, 4), (5, 6), (7, 8), (9, 10)}"
|
||||
]
|
||||
},
|
||||
"execution_count": 12,
|
||||
"execution_count": 8,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
}
|
||||
@ -396,10 +276,8 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 13,
|
||||
"metadata": {
|
||||
"collapsed": false
|
||||
},
|
||||
"execution_count": 9,
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"data": {
|
||||
@ -407,7 +285,7 @@
|
||||
"{(1, 10), (2, 9), (3, 8), (4, 7), (5, 6)}"
|
||||
]
|
||||
},
|
||||
"execution_count": 13,
|
||||
"execution_count": 9,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
}
|
||||
@ -439,10 +317,8 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 14,
|
||||
"metadata": {
|
||||
"collapsed": false
|
||||
},
|
||||
"execution_count": 10,
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
@ -466,10 +342,8 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 15,
|
||||
"metadata": {
|
||||
"collapsed": false
|
||||
},
|
||||
"execution_count": 11,
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"data": {
|
||||
@ -477,7 +351,7 @@
|
||||
"{176, 185, 188, 189}"
|
||||
]
|
||||
},
|
||||
"execution_count": 15,
|
||||
"execution_count": 11,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
}
|
||||
@ -509,10 +383,8 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 16,
|
||||
"metadata": {
|
||||
"collapsed": false
|
||||
},
|
||||
"execution_count": 12,
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"data": {
|
||||
@ -525,15 +397,15 @@
|
||||
" (121, {(1, 8), (2, 7), (3, 10), (4, 6), (5, 9)}),\n",
|
||||
" (121, {(1, 8), (2, 9), (3, 7), (4, 6), (5, 10)}),\n",
|
||||
" (121, {(1, 8), (2, 10), (3, 5), (4, 9), (6, 7)}),\n",
|
||||
" (121, {(1, 9), (2, 7), (3, 6), (4, 10), (5, 8)}),\n",
|
||||
" (121, {(1, 9), (2, 7), (3, 8), (4, 6), (5, 10)}),\n",
|
||||
" (121, {(1, 9), (2, 7), (3, 10), (4, 5), (6, 8)}),\n",
|
||||
" (121, {(1, 9), (2, 7), (3, 6), (4, 10), (5, 8)}),\n",
|
||||
" (121, {(1, 9), (2, 8), (3, 6), (4, 7), (5, 10)}),\n",
|
||||
" (121, {(1, 10), (2, 5), (3, 9), (4, 8), (6, 7)}),\n",
|
||||
" (121, {(1, 10), (2, 8), (3, 7), (4, 5), (6, 9)}),\n",
|
||||
" (144, {(1, 3), (2, 9), (4, 10), (5, 7), (6, 8)}),\n",
|
||||
" (144, {(1, 3), (2, 10), (4, 8), (5, 7), (6, 9)}),\n",
|
||||
" (144, {(1, 3), (2, 10), (4, 7), (5, 9), (6, 8)}),\n",
|
||||
" (144, {(1, 3), (2, 10), (4, 8), (5, 7), (6, 9)}),\n",
|
||||
" (144, {(1, 5), (2, 6), (3, 8), (4, 10), (7, 9)}),\n",
|
||||
" (144, {(1, 7), (2, 4), (3, 8), (5, 9), (6, 10)}),\n",
|
||||
" (144, {(1, 7), (2, 9), (3, 5), (4, 6), (8, 10)}),\n",
|
||||
@ -541,12 +413,12 @@
|
||||
" (144, {(1, 9), (2, 6), (3, 5), (4, 7), (8, 10)}),\n",
|
||||
" (144, {(1, 10), (2, 4), (3, 5), (6, 8), (7, 9)}),\n",
|
||||
" (169, {(1, 2), (3, 5), (4, 9), (6, 10), (7, 8)}),\n",
|
||||
" (169, {(1, 2), (3, 7), (4, 9), (5, 6), (8, 10)}),\n",
|
||||
" (169, {(1, 2), (3, 7), (4, 6), (5, 10), (8, 9)}),\n",
|
||||
" (169, {(1, 2), (3, 7), (4, 9), (5, 6), (8, 10)}),\n",
|
||||
" (169, {(1, 2), (3, 8), (4, 5), (6, 10), (7, 9)}),\n",
|
||||
" (169, {(1, 3), (2, 5), (4, 8), (6, 9), (7, 10)}),\n",
|
||||
" (169, {(1, 3), (2, 7), (4, 8), (5, 6), (9, 10)}),\n",
|
||||
" (169, {(1, 3), (2, 7), (4, 5), (6, 10), (8, 9)}),\n",
|
||||
" (169, {(1, 3), (2, 7), (4, 8), (5, 6), (9, 10)}),\n",
|
||||
" (169, {(1, 4), (2, 5), (3, 7), (6, 9), (8, 10)}),\n",
|
||||
" (169, {(1, 5), (2, 3), (4, 9), (6, 7), (8, 10)}),\n",
|
||||
" (169, {(1, 5), (2, 4), (3, 8), (6, 7), (9, 10)}),\n",
|
||||
@ -554,7 +426,7 @@
|
||||
" (169, {(1, 6), (2, 3), (4, 8), (5, 7), (9, 10)})]"
|
||||
]
|
||||
},
|
||||
"execution_count": 16,
|
||||
"execution_count": 12,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
}
|
||||
@ -568,10 +440,8 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 17,
|
||||
"metadata": {
|
||||
"collapsed": false
|
||||
},
|
||||
"execution_count": 13,
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"data": {
|
||||
@ -579,7 +449,7 @@
|
||||
"35"
|
||||
]
|
||||
},
|
||||
"execution_count": 17,
|
||||
"execution_count": 13,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
}
|
||||
@ -602,10 +472,8 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 18,
|
||||
"metadata": {
|
||||
"collapsed": false
|
||||
},
|
||||
"execution_count": 14,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"empty = (0, 0)\n",
|
||||
@ -618,10 +486,8 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 19,
|
||||
"metadata": {
|
||||
"collapsed": false
|
||||
},
|
||||
"execution_count": 15,
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"data": {
|
||||
@ -633,7 +499,7 @@
|
||||
" [(0, 0), (0, 0), (0, 0), (0, 0), (0, 0)]]"
|
||||
]
|
||||
},
|
||||
"execution_count": 19,
|
||||
"execution_count": 15,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
}
|
||||
@ -651,10 +517,8 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 20,
|
||||
"metadata": {
|
||||
"collapsed": false
|
||||
},
|
||||
"execution_count": 16,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"def place_rectangle_at(rect, grid, pos):\n",
|
||||
@ -673,10 +537,8 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 21,
|
||||
"metadata": {
|
||||
"collapsed": false
|
||||
},
|
||||
"execution_count": 17,
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"data": {
|
||||
@ -688,7 +550,7 @@
|
||||
" [(0, 0), (0, 0), (3, 4), (3, 4), (3, 4)]]"
|
||||
]
|
||||
},
|
||||
"execution_count": 21,
|
||||
"execution_count": 17,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
}
|
||||
@ -700,10 +562,8 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 22,
|
||||
"metadata": {
|
||||
"collapsed": false
|
||||
},
|
||||
"execution_count": 18,
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"data": {
|
||||
@ -715,7 +575,7 @@
|
||||
" [(2, 5), (2, 5), (3, 4), (3, 4), (3, 4)]]"
|
||||
]
|
||||
},
|
||||
"execution_count": 22,
|
||||
"execution_count": 18,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
}
|
||||
@ -730,10 +590,8 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 23,
|
||||
"metadata": {
|
||||
"collapsed": false
|
||||
},
|
||||
"execution_count": 19,
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"data": {
|
||||
@ -745,7 +603,7 @@
|
||||
" [(2, 5), (2, 5), (3, 4), (3, 4), (3, 4)]]"
|
||||
]
|
||||
},
|
||||
"execution_count": 23,
|
||||
"execution_count": 19,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
}
|
||||
@ -757,10 +615,8 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 24,
|
||||
"metadata": {
|
||||
"collapsed": false
|
||||
},
|
||||
"execution_count": 20,
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
@ -796,10 +652,8 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 25,
|
||||
"metadata": {
|
||||
"collapsed": false
|
||||
},
|
||||
"execution_count": 21,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"def pack(rectangles, grid):\n",
|
||||
@ -839,10 +693,8 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 26,
|
||||
"metadata": {
|
||||
"collapsed": false
|
||||
},
|
||||
"execution_count": 22,
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"data": {
|
||||
@ -854,7 +706,7 @@
|
||||
" [(2, 5), (2, 5), (3, 4), (3, 4), (3, 4)]]"
|
||||
]
|
||||
},
|
||||
"execution_count": 26,
|
||||
"execution_count": 22,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
}
|
||||
@ -881,10 +733,8 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 27,
|
||||
"metadata": {
|
||||
"collapsed": false
|
||||
},
|
||||
"execution_count": 23,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"from IPython.display import HTML, display, clear_output\n",
|
||||
@ -911,10 +761,8 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 28,
|
||||
"metadata": {
|
||||
"collapsed": false
|
||||
},
|
||||
"execution_count": 24,
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"data": {
|
||||
@ -948,10 +796,8 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 29,
|
||||
"metadata": {
|
||||
"collapsed": false
|
||||
},
|
||||
"execution_count": 25,
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"data": {
|
||||
@ -1079,12 +925,12 @@
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"It is gratifying to see the final results, and have the computation be so fast, but I'd like to get a better understanding of the process of finding the results. I can try to visualize the process by *animating* the search that `pack` does: every time we successfully call `place_rectangle_at`, I can show the new grid, and then pause for a short period. I accomplish this be modifying `pack` to take an optional argument, `animation`, which when false gives the same behavior as before, but when it is a number, pauses for that number of seconds in between displaying each step of the packing."
|
||||
"It is gratifying to see the final results, and have the computation be so fast, but I'd like to get a better understanding of the process of finding the results. I can try to visualize the process by *animating* the search that `pack` does: every time we successfully call `place_rectangle_at`, I can show the new grid, and then pause for a short period. I accomplish this by modifying `pack` to take an optional argument, `animation`, which when false gives the same behavior as before, but when it is a number, pauses for that number of seconds in between displaying each step of the packing."
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 30,
|
||||
"execution_count": 26,
|
||||
"metadata": {
|
||||
"collapsed": true
|
||||
},
|
||||
@ -1119,28 +965,26 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 31,
|
||||
"metadata": {
|
||||
"collapsed": false
|
||||
},
|
||||
"execution_count": 27,
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"data": {
|
||||
"text/html": [
|
||||
"<table>\n",
|
||||
"<tr><td style=\"background-color:slateblue\">89<td style=\"background-color:slateblue\">89<td style=\"background-color:slateblue\">89<td style=\"background-color:slateblue\">89<td style=\"background-color:slateblue\">89<td style=\"background-color:slateblue\">89<td style=\"background-color:slateblue\">89<td style=\"background-color:slateblue\">89<td style=\"background-color:coral\">50<td style=\"background-color:coral\">50<td style=\"background-color:coral\">50<td style=\"background-color:coral\">50<td style=\"background-color:coral\">50\n",
|
||||
"<tr><td style=\"background-color:slateblue\">89<td style=\"background-color:slateblue\">89<td style=\"background-color:slateblue\">89<td style=\"background-color:slateblue\">89<td style=\"background-color:slateblue\">89<td style=\"background-color:slateblue\">89<td style=\"background-color:slateblue\">89<td style=\"background-color:slateblue\">89<td style=\"background-color:coral\">50<td style=\"background-color:coral\">50<td style=\"background-color:coral\">50<td style=\"background-color:coral\">50<td style=\"background-color:coral\">50\n",
|
||||
"<tr><td style=\"background-color:slateblue\">89<td style=\"background-color:slateblue\">89<td style=\"background-color:slateblue\">89<td style=\"background-color:slateblue\">89<td style=\"background-color:slateblue\">89<td style=\"background-color:slateblue\">89<td style=\"background-color:slateblue\">89<td style=\"background-color:slateblue\">89<td style=\"background-color:coral\">50<td style=\"background-color:coral\">50<td style=\"background-color:coral\">50<td style=\"background-color:coral\">50<td style=\"background-color:coral\">50\n",
|
||||
"<tr><td style=\"background-color:slateblue\">89<td style=\"background-color:slateblue\">89<td style=\"background-color:slateblue\">89<td style=\"background-color:slateblue\">89<td style=\"background-color:slateblue\">89<td style=\"background-color:slateblue\">89<td style=\"background-color:slateblue\">89<td style=\"background-color:slateblue\">89<td style=\"background-color:coral\">50<td style=\"background-color:coral\">50<td style=\"background-color:coral\">50<td style=\"background-color:coral\">50<td style=\"background-color:coral\">50\n",
|
||||
"<tr><td style=\"background-color:slateblue\">89<td style=\"background-color:slateblue\">89<td style=\"background-color:slateblue\">89<td style=\"background-color:slateblue\">89<td style=\"background-color:slateblue\">89<td style=\"background-color:slateblue\">89<td style=\"background-color:slateblue\">89<td style=\"background-color:slateblue\">89<td style=\"background-color:coral\">50<td style=\"background-color:coral\">50<td style=\"background-color:coral\">50<td style=\"background-color:coral\">50<td style=\"background-color:coral\">50\n",
|
||||
"<tr><td style=\"background-color:slateblue\">89<td style=\"background-color:slateblue\">89<td style=\"background-color:slateblue\">89<td style=\"background-color:slateblue\">89<td style=\"background-color:slateblue\">89<td style=\"background-color:slateblue\">89<td style=\"background-color:slateblue\">89<td style=\"background-color:slateblue\">89<td style=\"background-color:coral\">50<td style=\"background-color:coral\">50<td style=\"background-color:coral\">50<td style=\"background-color:coral\">50<td style=\"background-color:coral\">50\n",
|
||||
"<tr><td style=\"background-color:slateblue\">89<td style=\"background-color:slateblue\">89<td style=\"background-color:slateblue\">89<td style=\"background-color:slateblue\">89<td style=\"background-color:slateblue\">89<td style=\"background-color:slateblue\">89<td style=\"background-color:slateblue\">89<td style=\"background-color:slateblue\">89<td style=\"background-color:coral\">50<td style=\"background-color:coral\">50<td style=\"background-color:coral\">50<td style=\"background-color:coral\">50<td style=\"background-color:coral\">50\n",
|
||||
"<tr><td style=\"background-color:slateblue\">89<td style=\"background-color:slateblue\">89<td style=\"background-color:slateblue\">89<td style=\"background-color:slateblue\">89<td style=\"background-color:slateblue\">89<td style=\"background-color:slateblue\">89<td style=\"background-color:slateblue\">89<td style=\"background-color:slateblue\">89<td style=\"background-color:coral\">50<td style=\"background-color:coral\">50<td style=\"background-color:coral\">50<td style=\"background-color:coral\">50<td style=\"background-color:coral\">50\n",
|
||||
"<tr><td style=\"background-color:slateblue\">89<td style=\"background-color:slateblue\">89<td style=\"background-color:slateblue\">89<td style=\"background-color:slateblue\">89<td style=\"background-color:slateblue\">89<td style=\"background-color:slateblue\">89<td style=\"background-color:slateblue\">89<td style=\"background-color:slateblue\">89<td style=\"background-color:coral\">50<td style=\"background-color:coral\">50<td style=\"background-color:coral\">50<td style=\"background-color:coral\">50<td style=\"background-color:coral\">50\n",
|
||||
"<tr><td style=\"background-color:cyan\">46<td style=\"background-color:cyan\">46<td style=\"background-color:cyan\">46<td style=\"background-color:cyan\">46<td style=\"background-color:cyan\">46<td style=\"background-color:cyan\">46<td style=\"background-color:yellow\">12<td style=\"background-color:yellow\">12<td style=\"background-color:coral\">50<td style=\"background-color:coral\">50<td style=\"background-color:coral\">50<td style=\"background-color:coral\">50<td style=\"background-color:coral\">50\n",
|
||||
"<tr><td style=\"background-color:cyan\">46<td style=\"background-color:cyan\">46<td style=\"background-color:cyan\">46<td style=\"background-color:cyan\">46<td style=\"background-color:cyan\">46<td style=\"background-color:cyan\">46<td style=\"background-color:chartreuse\">37<td style=\"background-color:chartreuse\">37<td style=\"background-color:chartreuse\">37<td style=\"background-color:chartreuse\">37<td style=\"background-color:chartreuse\">37<td style=\"background-color:chartreuse\">37<td style=\"background-color:chartreuse\">37\n",
|
||||
"<tr><td style=\"background-color:cyan\">46<td style=\"background-color:cyan\">46<td style=\"background-color:cyan\">46<td style=\"background-color:cyan\">46<td style=\"background-color:cyan\">46<td style=\"background-color:cyan\">46<td style=\"background-color:chartreuse\">37<td style=\"background-color:chartreuse\">37<td style=\"background-color:chartreuse\">37<td style=\"background-color:chartreuse\">37<td style=\"background-color:chartreuse\">37<td style=\"background-color:chartreuse\">37<td style=\"background-color:chartreuse\">37\n",
|
||||
"<tr><td style=\"background-color:cyan\">46<td style=\"background-color:cyan\">46<td style=\"background-color:cyan\">46<td style=\"background-color:cyan\">46<td style=\"background-color:cyan\">46<td style=\"background-color:cyan\">46<td style=\"background-color:chartreuse\">37<td style=\"background-color:chartreuse\">37<td style=\"background-color:chartreuse\">37<td style=\"background-color:chartreuse\">37<td style=\"background-color:chartreuse\">37<td style=\"background-color:chartreuse\">37<td style=\"background-color:chartreuse\">37</table>"
|
||||
"<tr><td style=\"background-color:chartreuse\">37<td style=\"background-color:chartreuse\">37<td style=\"background-color:chartreuse\">37<td style=\"background-color:coral\">50<td style=\"background-color:coral\">50<td style=\"background-color:coral\">50<td style=\"background-color:coral\">50<td style=\"background-color:coral\">50<td style=\"background-color:coral\">50<td style=\"background-color:coral\">50<td style=\"background-color:coral\">50<td style=\"background-color:coral\">50<td style=\"background-color:coral\">50\n",
|
||||
"<tr><td style=\"background-color:chartreuse\">37<td style=\"background-color:chartreuse\">37<td style=\"background-color:chartreuse\">37<td style=\"background-color:coral\">50<td style=\"background-color:coral\">50<td style=\"background-color:coral\">50<td style=\"background-color:coral\">50<td style=\"background-color:coral\">50<td style=\"background-color:coral\">50<td style=\"background-color:coral\">50<td style=\"background-color:coral\">50<td style=\"background-color:coral\">50<td style=\"background-color:coral\">50\n",
|
||||
"<tr><td style=\"background-color:chartreuse\">37<td style=\"background-color:chartreuse\">37<td style=\"background-color:chartreuse\">37<td style=\"background-color:coral\">50<td style=\"background-color:coral\">50<td style=\"background-color:coral\">50<td style=\"background-color:coral\">50<td style=\"background-color:coral\">50<td style=\"background-color:coral\">50<td style=\"background-color:coral\">50<td style=\"background-color:coral\">50<td style=\"background-color:coral\">50<td style=\"background-color:coral\">50\n",
|
||||
"<tr><td style=\"background-color:chartreuse\">37<td style=\"background-color:chartreuse\">37<td style=\"background-color:chartreuse\">37<td style=\"background-color:coral\">50<td style=\"background-color:coral\">50<td style=\"background-color:coral\">50<td style=\"background-color:coral\">50<td style=\"background-color:coral\">50<td style=\"background-color:coral\">50<td style=\"background-color:coral\">50<td style=\"background-color:coral\">50<td style=\"background-color:coral\">50<td style=\"background-color:coral\">50\n",
|
||||
"<tr><td style=\"background-color:chartreuse\">37<td style=\"background-color:chartreuse\">37<td style=\"background-color:chartreuse\">37<td style=\"background-color:coral\">50<td style=\"background-color:coral\">50<td style=\"background-color:coral\">50<td style=\"background-color:coral\">50<td style=\"background-color:coral\">50<td style=\"background-color:coral\">50<td style=\"background-color:coral\">50<td style=\"background-color:coral\">50<td style=\"background-color:coral\">50<td style=\"background-color:coral\">50\n",
|
||||
"<tr><td style=\"background-color:chartreuse\">37<td style=\"background-color:chartreuse\">37<td style=\"background-color:chartreuse\">37<td style=\"background-color:yellow\">12<td style=\"background-color:slateblue\">89<td style=\"background-color:slateblue\">89<td style=\"background-color:slateblue\">89<td style=\"background-color:slateblue\">89<td style=\"background-color:slateblue\">89<td style=\"background-color:slateblue\">89<td style=\"background-color:slateblue\">89<td style=\"background-color:slateblue\">89<td style=\"background-color:slateblue\">89\n",
|
||||
"<tr><td style=\"background-color:chartreuse\">37<td style=\"background-color:chartreuse\">37<td style=\"background-color:chartreuse\">37<td style=\"background-color:yellow\">12<td style=\"background-color:slateblue\">89<td style=\"background-color:slateblue\">89<td style=\"background-color:slateblue\">89<td style=\"background-color:slateblue\">89<td style=\"background-color:slateblue\">89<td style=\"background-color:slateblue\">89<td style=\"background-color:slateblue\">89<td style=\"background-color:slateblue\">89<td style=\"background-color:slateblue\">89\n",
|
||||
"<tr><td style=\"background-color:cyan\">46<td style=\"background-color:cyan\">46<td style=\"background-color:cyan\">46<td style=\"background-color:cyan\">46<td style=\"background-color:slateblue\">89<td style=\"background-color:slateblue\">89<td style=\"background-color:slateblue\">89<td style=\"background-color:slateblue\">89<td style=\"background-color:slateblue\">89<td style=\"background-color:slateblue\">89<td style=\"background-color:slateblue\">89<td style=\"background-color:slateblue\">89<td style=\"background-color:slateblue\">89\n",
|
||||
"<tr><td style=\"background-color:cyan\">46<td style=\"background-color:cyan\">46<td style=\"background-color:cyan\">46<td style=\"background-color:cyan\">46<td style=\"background-color:slateblue\">89<td style=\"background-color:slateblue\">89<td style=\"background-color:slateblue\">89<td style=\"background-color:slateblue\">89<td style=\"background-color:slateblue\">89<td style=\"background-color:slateblue\">89<td style=\"background-color:slateblue\">89<td style=\"background-color:slateblue\">89<td style=\"background-color:slateblue\">89\n",
|
||||
"<tr><td style=\"background-color:cyan\">46<td style=\"background-color:cyan\">46<td style=\"background-color:cyan\">46<td style=\"background-color:cyan\">46<td style=\"background-color:slateblue\">89<td style=\"background-color:slateblue\">89<td style=\"background-color:slateblue\">89<td style=\"background-color:slateblue\">89<td style=\"background-color:slateblue\">89<td style=\"background-color:slateblue\">89<td style=\"background-color:slateblue\">89<td style=\"background-color:slateblue\">89<td style=\"background-color:slateblue\">89\n",
|
||||
"<tr><td style=\"background-color:cyan\">46<td style=\"background-color:cyan\">46<td style=\"background-color:cyan\">46<td style=\"background-color:cyan\">46<td style=\"background-color:slateblue\">89<td style=\"background-color:slateblue\">89<td style=\"background-color:slateblue\">89<td style=\"background-color:slateblue\">89<td style=\"background-color:slateblue\">89<td style=\"background-color:slateblue\">89<td style=\"background-color:slateblue\">89<td style=\"background-color:slateblue\">89<td style=\"background-color:slateblue\">89\n",
|
||||
"<tr><td style=\"background-color:cyan\">46<td style=\"background-color:cyan\">46<td style=\"background-color:cyan\">46<td style=\"background-color:cyan\">46<td style=\"background-color:slateblue\">89<td style=\"background-color:slateblue\">89<td style=\"background-color:slateblue\">89<td style=\"background-color:slateblue\">89<td style=\"background-color:slateblue\">89<td style=\"background-color:slateblue\">89<td style=\"background-color:slateblue\">89<td style=\"background-color:slateblue\">89<td style=\"background-color:slateblue\">89\n",
|
||||
"<tr><td style=\"background-color:cyan\">46<td style=\"background-color:cyan\">46<td style=\"background-color:cyan\">46<td style=\"background-color:cyan\">46<td style=\"background-color:slateblue\">89<td style=\"background-color:slateblue\">89<td style=\"background-color:slateblue\">89<td style=\"background-color:slateblue\">89<td style=\"background-color:slateblue\">89<td style=\"background-color:slateblue\">89<td style=\"background-color:slateblue\">89<td style=\"background-color:slateblue\">89<td style=\"background-color:slateblue\">89</table>"
|
||||
],
|
||||
"text/plain": [
|
||||
"<IPython.core.display.HTML object>"
|
||||
@ -1188,10 +1032,8 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 32,
|
||||
"metadata": {
|
||||
"collapsed": false
|
||||
},
|
||||
"execution_count": 28,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"from __future__ import division\n",
|
||||
@ -1225,18 +1067,16 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 33,
|
||||
"metadata": {
|
||||
"collapsed": false
|
||||
},
|
||||
"execution_count": 29,
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"data": {
|
||||
"text/plain": [
|
||||
"'537 + 489 == 1026'"
|
||||
"'857 + 349 == 1206'"
|
||||
]
|
||||
},
|
||||
"execution_count": 33,
|
||||
"execution_count": 29,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
}
|
||||
@ -1247,17 +1087,15 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 34,
|
||||
"metadata": {
|
||||
"collapsed": false
|
||||
},
|
||||
"execution_count": 30,
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"CPU times: user 32.1 s, sys: 91.8 ms, total: 32.2 s\n",
|
||||
"Wall time: 32.3 s\n"
|
||||
"CPU times: user 29 s, sys: 42.2 ms, total: 29.1 s\n",
|
||||
"Wall time: 29.1 s\n"
|
||||
]
|
||||
},
|
||||
{
|
||||
@ -1266,7 +1104,7 @@
|
||||
"96"
|
||||
]
|
||||
},
|
||||
"execution_count": 34,
|
||||
"execution_count": 30,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
}
|
||||
@ -1297,7 +1135,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 35,
|
||||
"execution_count": 31,
|
||||
"metadata": {
|
||||
"collapsed": true
|
||||
},
|
||||
@ -1328,25 +1166,23 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 36,
|
||||
"metadata": {
|
||||
"collapsed": false
|
||||
},
|
||||
"execution_count": 32,
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"lambda M,Y,O,U,E: Y and M and ((100*Y+10*O+U) == (10*M+E)**2)\n"
|
||||
"lambda Y,M,E,O,U: Y and M and ((100*Y+10*O+U) == (10*M+E)**2)\n"
|
||||
]
|
||||
},
|
||||
{
|
||||
"data": {
|
||||
"text/plain": [
|
||||
"(<function __main__.<lambda>>, 'MYOUE')"
|
||||
"(<function __main__.<lambda>>, 'YMEOU')"
|
||||
]
|
||||
},
|
||||
"execution_count": 36,
|
||||
"execution_count": 32,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
}
|
||||
@ -1357,25 +1193,23 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 37,
|
||||
"metadata": {
|
||||
"collapsed": false
|
||||
},
|
||||
"execution_count": 33,
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"lambda A,Y,P,M,U,E,B,L,R,N: P and N and B and ((100*N+10*U+M) + (100*B+10*E+R) == (1000*P+100*L+10*A+Y))\n"
|
||||
"lambda L,A,Y,P,M,E,R,U,B,N: P and B and N and ((100*N+10*U+M) + (100*B+10*E+R) == (1000*P+100*L+10*A+Y))\n"
|
||||
]
|
||||
},
|
||||
{
|
||||
"data": {
|
||||
"text/plain": [
|
||||
"(<function __main__.<lambda>>, 'AYPMUEBLRN')"
|
||||
"(<function __main__.<lambda>>, 'LAYPMERUBN')"
|
||||
]
|
||||
},
|
||||
"execution_count": 37,
|
||||
"execution_count": 33,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
}
|
||||
@ -1386,7 +1220,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 38,
|
||||
"execution_count": 34,
|
||||
"metadata": {
|
||||
"collapsed": true
|
||||
},
|
||||
@ -1414,18 +1248,16 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 39,
|
||||
"metadata": {
|
||||
"collapsed": false
|
||||
},
|
||||
"execution_count": 35,
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"data": {
|
||||
"text/plain": [
|
||||
"'537 + 489 = 1026'"
|
||||
"'857 + 349 = 1206'"
|
||||
]
|
||||
},
|
||||
"execution_count": 39,
|
||||
"execution_count": 35,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
}
|
||||
@ -1436,17 +1268,15 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 40,
|
||||
"metadata": {
|
||||
"collapsed": false
|
||||
},
|
||||
"execution_count": 36,
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"CPU times: user 1.87 s, sys: 8.03 ms, total: 1.88 s\n",
|
||||
"Wall time: 1.89 s\n"
|
||||
"CPU times: user 1.75 s, sys: 3.29 ms, total: 1.76 s\n",
|
||||
"Wall time: 1.76 s\n"
|
||||
]
|
||||
},
|
||||
{
|
||||
@ -1455,7 +1285,7 @@
|
||||
"96"
|
||||
]
|
||||
},
|
||||
"execution_count": 40,
|
||||
"execution_count": 36,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
}
|
||||
@ -1488,9 +1318,9 @@
|
||||
"name": "python",
|
||||
"nbconvert_exporter": "python",
|
||||
"pygments_lexer": "ipython3",
|
||||
"version": "3.5.1"
|
||||
"version": "3.5.3"
|
||||
}
|
||||
},
|
||||
"nbformat": 4,
|
||||
"nbformat_minor": 0
|
||||
"nbformat_minor": 1
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user