08: Execute the shit out of week 4
This commit is contained in:
@ -66,7 +66,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"execution_count": 1,
|
||||
"metadata": {
|
||||
"deletable": false,
|
||||
"nbgrader": {
|
||||
@ -137,7 +137,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"execution_count": 2,
|
||||
"metadata": {
|
||||
"deletable": false,
|
||||
"nbgrader": {
|
||||
@ -201,7 +201,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"execution_count": 3,
|
||||
"metadata": {
|
||||
"deletable": false,
|
||||
"nbgrader": {
|
||||
@ -216,7 +216,30 @@
|
||||
"task": false
|
||||
}
|
||||
},
|
||||
"outputs": [],
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"For sigma = 0.03\n",
|
||||
"b = [ 0.45440139 -0.76618454 0.45440139]\n",
|
||||
"lam = [0.62771919 0.62771831 0.62771919]\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"For sigma = 6.0\n",
|
||||
"b = [0.54177432 0.64262054 0.54177432]\n",
|
||||
"lam = [6.37228128 6.37228139 6.37228128]\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"For sigma = 1.99999989999999\n",
|
||||
"b = [-7.07106781e-01 -4.21799612e-14 7.07106781e-01]\n",
|
||||
"lam = [ 2. -0. 2.]\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"[6.37228132 2. 0.62771868]\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"# Use this cell for your own testing ...\n",
|
||||
"\n",
|
||||
@ -239,7 +262,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"execution_count": 4,
|
||||
"metadata": {
|
||||
"deletable": false,
|
||||
"nbgrader": {
|
||||
@ -305,7 +328,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"execution_count": 5,
|
||||
"metadata": {
|
||||
"deletable": false,
|
||||
"nbgrader": {
|
||||
@ -347,7 +370,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"execution_count": 6,
|
||||
"metadata": {
|
||||
"deletable": false,
|
||||
"nbgrader": {
|
||||
@ -362,7 +385,28 @@
|
||||
"task": false
|
||||
}
|
||||
},
|
||||
"outputs": [],
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"(3,) (3, 3) () (1, 3)\n",
|
||||
"(3,) (3, 3) () (0, 3)\n"
|
||||
]
|
||||
},
|
||||
{
|
||||
"data": {
|
||||
"text/plain": [
|
||||
"array([[ 3. , -2.23606798, 0. ],\n",
|
||||
" [-2.23606798, 4.6 , 1.2 ],\n",
|
||||
" [ 0. , 1.2 , 1.4 ]])"
|
||||
]
|
||||
},
|
||||
"execution_count": 6,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"B = np.array([[3,2,1],[2,3,2],[1,2,3]])\n",
|
||||
"\n",
|
||||
@ -405,7 +449,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"execution_count": 7,
|
||||
"metadata": {
|
||||
"deletable": false,
|
||||
"nbgrader": {
|
||||
@ -443,7 +487,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"execution_count": 8,
|
||||
"metadata": {
|
||||
"deletable": false,
|
||||
"nbgrader": {
|
||||
@ -458,7 +502,19 @@
|
||||
"task": false
|
||||
}
|
||||
},
|
||||
"outputs": [],
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"(3,) (3, 3) () (1, 3)\n",
|
||||
"(3,) (3, 3) () (0, 3)\n",
|
||||
"[[ 3. -2.23606798 0. ]\n",
|
||||
" [-2.23606798 4.6 1.2 ]\n",
|
||||
" [ 0. 1.2 1.4 ]]\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"A_tridiag = tridiagonalize(A)\n",
|
||||
"print(A_tridiag)"
|
||||
@ -466,7 +522,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"execution_count": 9,
|
||||
"metadata": {
|
||||
"deletable": false,
|
||||
"nbgrader": {
|
||||
@ -481,7 +537,15 @@
|
||||
"task": false
|
||||
}
|
||||
},
|
||||
"outputs": [],
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"[6.37228126 2.00000006 0.62771869]\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"def test_QREig():\n",
|
||||
" \"\"\"\n",
|
||||
@ -520,7 +584,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"execution_count": 10,
|
||||
"metadata": {
|
||||
"deletable": false,
|
||||
"nbgrader": {
|
||||
@ -535,7 +599,17 @@
|
||||
"task": false
|
||||
}
|
||||
},
|
||||
"outputs": [],
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"(array([ 0.54177424, -0.81706617, -0.1971891 ]), 3)\n",
|
||||
"(array([0.70710833, 0.31623112, 0.63245212]), 2)\n",
|
||||
"(array([ 0.45440144, 0.48208191, -0.749077 ]), 3)\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"\"\"\"\n",
|
||||
"Eigenvalues and -vectors calculated numerically for matrix A using functions from previous tasks.\n",
|
||||
@ -587,7 +661,18 @@
|
||||
"task": false
|
||||
}
|
||||
},
|
||||
"outputs": [],
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"(5,) (5, 5) () (3, 5)\n",
|
||||
"(5,) (5, 5) () (2, 5)\n",
|
||||
"(5,) (5, 5) () (1, 5)\n",
|
||||
"(5,) (5, 5) () (0, 5)\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"\"\"\"\n",
|
||||
"Completely 'random' and totally not self-made matrices C and D are being tridiagonalized and its eigenvalues and -vectors are\n",
|
||||
@ -623,7 +708,7 @@
|
||||
],
|
||||
"metadata": {
|
||||
"kernelspec": {
|
||||
"display_name": "Python 3 (ipykernel)",
|
||||
"display_name": "Python 3",
|
||||
"language": "python",
|
||||
"name": "python3"
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user