This commit is contained in:
Valentin Boettcher 2020-01-27 16:48:27 +01:00
parent a4fb767d61
commit 794b7fa58f
2 changed files with 77 additions and 36 deletions

View file

@ -2,7 +2,7 @@
"cells": [
{
"cell_type": "code",
"execution_count": 7,
"execution_count": 6,
"metadata": {
"autoscroll": false,
"collapsed": false,
@ -21,7 +21,7 @@
},
{
"cell_type": "code",
"execution_count": 9,
"execution_count": 7,
"metadata": {
"autoscroll": false,
"collapsed": false,
@ -38,7 +38,7 @@
},
{
"cell_type": "code",
"execution_count": 21,
"execution_count": 8,
"metadata": {
"autoscroll": false,
"collapsed": false,
@ -52,10 +52,10 @@
{
"data": {
"text/plain": [
"(<Figure size 640x480 with 1 Axes>,\n <matplotlib.axes._subplots.AxesSubplot at 0x7fac39e3f490>)"
"(<Figure size 640x480 with 1 Axes>,\n <matplotlib.axes._subplots.AxesSubplot at 0x7f55988afb80>)"
]
},
"execution_count": 21,
"execution_count": 8,
"metadata": {},
"output_type": "execute_result"
}
@ -67,7 +67,7 @@
},
{
"cell_type": "code",
"execution_count": 50,
"execution_count": 9,
"metadata": {
"autoscroll": false,
"collapsed": false,
@ -98,7 +98,7 @@
},
{
"cell_type": "code",
"execution_count": 142,
"execution_count": 10,
"metadata": {
"autoscroll": false,
"collapsed": false,
@ -113,16 +113,16 @@
"name": "stdout",
"output_type": "stream",
"text": [
"(array([ 4, 4, 9, 11, 13, 24, 27, 30, 40]), array([[0.4365859 , 0.00314502, 0.03385928],\n",
"(array([ 4, 4, 8, 11, 12, 24, 27, 32, 40]), array([[0.4365859 , 0.00314502, 0.03385928],\n",
" [0.38654813, 0.00246542, 0.01311343],\n",
" [0.39925472, 0.00175345, 0.0193526 ],\n",
" [0.37642096, 0.00165317, 0.0182458 ],\n",
" [0.39935277, 0.00158683, 0.00165195],\n",
" [0.4097683 , 0.00153681, 0.02061948],\n",
" [0.39369265, 0.00147652, 0.01981056],\n",
" [0.41640285, 0.00116798, 0.02043268],\n",
" [0.40118533, 0.00102217, 0.01063151],\n",
" [0.4014384 , 0.00097094, 0.007732 ],\n",
" [0.40573231, 0.00085894, 0.01187421]]), array([0.0287859 , 0.02125187, 0.00854528, 0.00844723, 0.0019683 ,\n",
" 0.00860285, 0.00661467, 0.0063616 , 0.00206769]))\n"
" [0.4146038 , 0.00100278, 0.00798558],\n",
" [0.40573231, 0.00085894, 0.01187421]]), array([0.0287859 , 0.02125187, 0.03137904, 0.00844723, 0.01410735,\n",
" 0.00860285, 0.00661467, 0.0068038 , 0.00206769]))\n"
]
}
],
@ -133,7 +133,7 @@
},
{
"cell_type": "code",
"execution_count": 147,
"execution_count": 11,
"metadata": {
"autoscroll": false,
"collapsed": false,
@ -150,12 +150,12 @@
"text": [
"1 & \\(\\sqrt{4}\\) & 0.4366 & 0.0031 & 0.0339 & 0.029 \\\\\n",
"2 & \\(\\sqrt{4}\\) & 0.3865 & 0.0025 & 0.0131 & 0.021 \\\\\n",
"3 & \\(\\sqrt{9}\\) & 0.3993 & 0.0018 & 0.0194 & 0.009 \\\\\n",
"3 & \\(\\sqrt{8}\\) & 0.3764 & 0.0017 & 0.0182 & 0.031 \\\\\n",
"4 & \\(\\sqrt{11}\\) & 0.3994 & 0.0016 & 0.0017 & 0.008 \\\\\n",
"5 & \\(\\sqrt{13}\\) & 0.4098 & 0.0015 & 0.0206 & 0.002 \\\\\n",
"5 & \\(\\sqrt{12}\\) & 0.3937 & 0.0015 & 0.0198 & 0.014 \\\\\n",
"6 & \\(\\sqrt{24}\\) & 0.4164 & 0.0012 & 0.0204 & 0.009 \\\\\n",
"7 & \\(\\sqrt{27}\\) & 0.4012 & 0.001 & 0.0106 & 0.007 \\\\\n",
"8 & \\(\\sqrt{30}\\) & 0.4014 & 0.001 & 0.0077 & 0.006 \\\\\n",
"8 & \\(\\sqrt{32}\\) & 0.4146 & 0.001 & 0.008 & 0.007 \\\\\n",
"9 & \\(\\sqrt{40}\\) & 0.4057 & 0.0009 & 0.0119 & 0.002 \\\\\n",
"\n"
]
@ -167,7 +167,7 @@
},
{
"cell_type": "code",
"execution_count": 144,
"execution_count": 12,
"metadata": {
"autoscroll": false,
"collapsed": false,
@ -184,7 +184,7 @@
},
{
"cell_type": "code",
"execution_count": 145,
"execution_count": 13,
"metadata": {
"autoscroll": false,
"collapsed": false,
@ -198,10 +198,10 @@
{
"data": {
"text/plain": [
"(0.4002, 0.0027, 0.0046)"
"(0.4007, 0.0027, 0.0071)"
]
},
"execution_count": 145,
"execution_count": 13,
"metadata": {},
"output_type": "execute_result"
}
@ -212,7 +212,7 @@
},
{
"cell_type": "code",
"execution_count": 148,
"execution_count": 19,
"metadata": {
"autoscroll": false,
"collapsed": false,
@ -227,14 +227,14 @@
"name": "stdout",
"output_type": "stream",
"text": [
"4 & \\mqty{2 & 0 & 0} \\\\\n",
"9 & \\mqty{2 & 2 & 1}, \\mqty{3 & 0 & 0} \\\\\n",
"11 & \\mqty{3 & 1 & 1} \\\\\n",
"13 & \\mqty{3 & 2 & 0} \\\\\n",
"24 & \\mqty{4 & 2 & 2} \\\\\n",
"27 & \\mqty{3 & 3 & 3}, \\mqty{5 & 1 & 1} \\\\\n",
"30 & \\mqty{5 & 2 & 1} \\\\\n",
"40 & \\mqty{6 & 2 & 0} \\\\\n",
"\\(\\sqrt{4}\\) & \\(\\mqty(2 & 0 & 0)\\) \\\\\n",
"\\(\\sqrt{8}\\) & \\(\\mqty(2 & 2 & 0)\\) \\\\\n",
"\\(\\sqrt{11}\\) & \\(\\mqty(3 & 1 & 1)\\) \\\\\n",
"\\(\\sqrt{12}\\) & \\(\\mqty(2 & 2 & 2)\\) \\\\\n",
"\\(\\sqrt{24}\\) & \\(\\mqty(4 & 2 & 2)\\) \\\\\n",
"\\(\\sqrt{27}\\) & \\(\\mqty(3 & 3 & 3)\\), \\(\\mqty(5 & 1 & 1)\\) \\\\\n",
"\\(\\sqrt{32}\\) & \\(\\mqty(4 & 4 & 0)\\) \\\\\n",
"\\(\\sqrt{40}\\) & \\(\\mqty(6 & 2 & 0)\\) \\\\\n",
"\n"
]
}
@ -245,7 +245,7 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 24,
"metadata": {
"autoscroll": false,
"collapsed": false,
@ -255,8 +255,49 @@
"slide_type": "-"
}
},
"outputs": [],
"source": []
"outputs": [
{
"data": {
"text/plain": [
"0.4033916337519268"
]
},
"execution_count": 24,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"hypothesis[1][:,0].mean()"
]
},
{
"cell_type": "code",
"execution_count": 25,
"metadata": {
"autoscroll": false,
"collapsed": false,
"ein.hycell": false,
"ein.tags": "worksheet-0",
"slideshow": {
"slide_type": "-"
}
},
"outputs": [
{
"data": {
"text/plain": [
"0.40685"
]
},
"execution_count": 25,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"(.4007+.413)/2"
]
}
],
"metadata": {

View file

@ -208,11 +208,11 @@ def find_miller_indices(squares):
square = squares
return np.array([(a, b, c) for (a, b, c) \
in np.ndindex((square+1, square+1, square+1)) \
if a**2 + b**2 + c**2 == square and a >= b >= c])
if (a % 2 + b % 2 + c % 2) in (0, 3) and a**2 + b**2 + c**2 == square and a >= b >= c])
def can_be_sum_of_squares(square):
for a, b, c in np.ndindex((square+1, square+1, square+1)):
if a**2 + b**2 + c**2 == square:
if (a % 2 + b % 2 + c % 2) in (0, 3) and a**2 + b**2 + c**2 == square:
return True
return False
@ -223,7 +223,7 @@ def generate_miller_table(squares):
out = ''
for i, ind_list in zip(squares, inds):
out += r'\(\sqrt{' + str(i) + '}\) & '
out += r'\(\sqrt{' + str(i) + r'}\) & '
for ind in ind_list:
out += r'\(\mqty(' + ' & '.join(ind.astype(str)) + r')\), '
out = out[:-2]