Skip to content

Commit 3dd68fc

Browse files
committed
new?
1 parent 7745e3f commit 3dd68fc

File tree

1 file changed

+39
-2
lines changed

1 file changed

+39
-2
lines changed

lectures/05-scipy/scipy-exercises-2.ipynb

Lines changed: 39 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,10 +67,47 @@
6767
},
6868
{
6969
"cell_type": "code",
70-
"execution_count": null,
70+
"execution_count": 7,
7171
"metadata": {},
7272
"outputs": [],
73-
"source": []
73+
"source": [
74+
"x = np.arange(13)\n",
75+
"A = hilbert(13)"
76+
]
77+
},
78+
{
79+
"cell_type": "code",
80+
"execution_count": 9,
81+
"metadata": {},
82+
"outputs": [
83+
{
84+
"data": {
85+
"text/plain": [
86+
"(array([ 1.20651400e-07, 9.99985193e-01, 2.00044484e+00,\n",
87+
" 2.99430401e+00, 4.03835041e+00, 4.85081620e+00,\n",
88+
" 6.34405283e+00, 6.55787325e+00, 8.20220729e+00,\n",
89+
" 9.23611572e+00, 9.58340889e+00, 1.12467970e+01,\n",
90+
" 1.19456441e+01]),\n",
91+
" array([], dtype=float64),\n",
92+
" 12,\n",
93+
" array([ 1.81383012e+00, 3.96833076e-01, 4.90294194e-02,\n",
94+
" 4.34875507e-03, 2.95177714e-04, 1.56237036e-05,\n",
95+
" 6.46641856e-07, 2.07632142e-08, 5.07655186e-10,\n",
96+
" 9.14127833e-12, 1.14354232e-13, 8.87566335e-16,\n",
97+
" 3.19134976e-18]))"
98+
]
99+
},
100+
"execution_count": 9,
101+
"metadata": {},
102+
"output_type": "execute_result"
103+
}
104+
],
105+
"source": [
106+
"b = A @ x\n",
107+
"import scipy.linalg\n",
108+
"x = scipy.linalg.lstsq(A, b)\n",
109+
"x"
110+
]
74111
},
75112
{
76113
"cell_type": "markdown",

0 commit comments

Comments
 (0)