|
53 | 53 | }, |
54 | 54 | { |
55 | 55 | "cell_type": "code", |
56 | | - "metadata": {}, |
| 56 | + "metadata": { |
| 57 | + "ExecuteTime": { |
| 58 | + "end_time": "2026-02-08T11:48:53.982411Z", |
| 59 | + "start_time": "2026-02-08T11:48:52.996429Z" |
| 60 | + } |
| 61 | + }, |
57 | 62 | "source": [ |
58 | 63 | "%%capture\n", |
59 | 64 | "%pip install numpy\n", |
60 | 65 | "%pip install numpy --break-system-packages" |
61 | 66 | ], |
62 | 67 | "outputs": [], |
63 | | - "execution_count": null |
| 68 | + "execution_count": 1 |
64 | 69 | }, |
65 | 70 | { |
66 | 71 | "cell_type": "markdown", |
|
71 | 76 | }, |
72 | 77 | { |
73 | 78 | "cell_type": "code", |
74 | | - "metadata": {}, |
| 79 | + "metadata": { |
| 80 | + "ExecuteTime": { |
| 81 | + "end_time": "2026-02-08T11:48:53.989102Z", |
| 82 | + "start_time": "2026-02-08T11:48:53.983066Z" |
| 83 | + } |
| 84 | + }, |
75 | 85 | "source": [ |
76 | 86 | "import numpy as np\n", |
77 | 87 | "from math import pi, sin, cos" |
78 | 88 | ], |
79 | 89 | "outputs": [], |
80 | | - "execution_count": null |
| 90 | + "execution_count": 2 |
81 | 91 | }, |
82 | 92 | { |
83 | 93 | "cell_type": "markdown", |
|
127 | 137 | { |
128 | 138 | "cell_type": "code", |
129 | 139 | "metadata": { |
130 | | - "trusted": true |
| 140 | + "trusted": true, |
| 141 | + "ExecuteTime": { |
| 142 | + "end_time": "2026-02-08T11:48:53.995284Z", |
| 143 | + "start_time": "2026-02-08T11:48:53.989652Z" |
| 144 | + } |
131 | 145 | }, |
132 | 146 | "source": [ |
133 | 147 | "p = np.array([1.0, 2.0])\n", |
134 | 148 | "\n", |
135 | 149 | "print(f\"p={p}\")" |
136 | 150 | ], |
137 | | - "outputs": [], |
138 | | - "execution_count": null |
| 151 | + "outputs": [ |
| 152 | + { |
| 153 | + "name": "stdout", |
| 154 | + "output_type": "stream", |
| 155 | + "text": [ |
| 156 | + "p=[1. 2.]\n" |
| 157 | + ] |
| 158 | + } |
| 159 | + ], |
| 160 | + "execution_count": 3 |
139 | 161 | }, |
140 | 162 | { |
141 | 163 | "cell_type": "markdown", |
|
158 | 180 | { |
159 | 181 | "cell_type": "code", |
160 | 182 | "metadata": { |
161 | | - "trusted": true |
| 183 | + "trusted": true, |
| 184 | + "ExecuteTime": { |
| 185 | + "end_time": "2026-02-08T11:48:54.008003Z", |
| 186 | + "start_time": "2026-02-08T11:48:54.002363Z" |
| 187 | + } |
162 | 188 | }, |
163 | 189 | "source": [ |
164 | 190 | "p0 = np.array([1.0, 2.0])\n", |
|
170 | 196 | "\n", |
171 | 197 | "print(f\"p={p}\")" |
172 | 198 | ], |
173 | | - "outputs": [], |
174 | | - "execution_count": null |
| 199 | + "outputs": [ |
| 200 | + { |
| 201 | + "name": "stdout", |
| 202 | + "output_type": "stream", |
| 203 | + "text": [ |
| 204 | + "p=[10. 14.]\n" |
| 205 | + ] |
| 206 | + } |
| 207 | + ], |
| 208 | + "execution_count": 4 |
175 | 209 | }, |
176 | 210 | { |
177 | 211 | "cell_type": "markdown", |
|
191 | 225 | { |
192 | 226 | "cell_type": "code", |
193 | 227 | "metadata": { |
194 | | - "trusted": true |
| 228 | + "trusted": true, |
| 229 | + "ExecuteTime": { |
| 230 | + "end_time": "2026-02-08T11:48:54.022625Z", |
| 231 | + "start_time": "2026-02-08T11:48:54.014821Z" |
| 232 | + } |
195 | 233 | }, |
196 | 234 | "source": [ |
197 | 235 | "p0 = np.array([1.0, 2.0])\n", |
|
204 | 242 | "\n", |
205 | 243 | "print(f\"p_={p_}\")" |
206 | 244 | ], |
207 | | - "outputs": [], |
208 | | - "execution_count": null |
| 245 | + "outputs": [ |
| 246 | + { |
| 247 | + "name": "stdout", |
| 248 | + "output_type": "stream", |
| 249 | + "text": [ |
| 250 | + "p_=[0. 0.]\n" |
| 251 | + ] |
| 252 | + } |
| 253 | + ], |
| 254 | + "execution_count": 5 |
209 | 255 | }, |
210 | 256 | { |
211 | 257 | "cell_type": "markdown", |
|
234 | 280 | { |
235 | 281 | "cell_type": "code", |
236 | 282 | "metadata": { |
237 | | - "trusted": true |
| 283 | + "trusted": true, |
| 284 | + "ExecuteTime": { |
| 285 | + "end_time": "2026-02-08T11:48:54.033749Z", |
| 286 | + "start_time": "2026-02-08T11:48:54.028105Z" |
| 287 | + } |
238 | 288 | }, |
239 | 289 | "source": [ |
240 | 290 | "θ = pi/2\n", |
|
244 | 294 | "\n", |
245 | 295 | "print(f\"R={R}\")" |
246 | 296 | ], |
247 | | - "outputs": [], |
248 | | - "execution_count": null |
| 297 | + "outputs": [ |
| 298 | + { |
| 299 | + "name": "stdout", |
| 300 | + "output_type": "stream", |
| 301 | + "text": [ |
| 302 | + "R=[[ 6.123234e-17 -1.000000e+00]\n", |
| 303 | + " [ 1.000000e+00 6.123234e-17]]\n" |
| 304 | + ] |
| 305 | + } |
| 306 | + ], |
| 307 | + "execution_count": 6 |
249 | 308 | }, |
250 | 309 | { |
251 | 310 | "cell_type": "markdown", |
|
282 | 341 | { |
283 | 342 | "cell_type": "code", |
284 | 343 | "metadata": { |
285 | | - "trusted": true |
| 344 | + "trusted": true, |
| 345 | + "ExecuteTime": { |
| 346 | + "end_time": "2026-02-08T11:48:54.053367Z", |
| 347 | + "start_time": "2026-02-08T11:48:54.039405Z" |
| 348 | + } |
286 | 349 | }, |
287 | 350 | "source": [ |
288 | 351 | "θ = pi/2\n", |
|
296 | 359 | "\n", |
297 | 360 | "print(f\"H = {H}\")" |
298 | 361 | ], |
299 | | - "outputs": [], |
300 | | - "execution_count": null |
| 362 | + "outputs": [ |
| 363 | + { |
| 364 | + "name": "stdout", |
| 365 | + "output_type": "stream", |
| 366 | + "text": [ |
| 367 | + "H = [[ 6.123234e-17 -1.000000e+00 1.000000e-01]\n", |
| 368 | + " [ 1.000000e+00 6.123234e-17 2.000000e-01]\n", |
| 369 | + " [ 0.000000e+00 0.000000e+00 1.000000e+00]]\n" |
| 370 | + ] |
| 371 | + } |
| 372 | + ], |
| 373 | + "execution_count": 7 |
301 | 374 | }, |
302 | 375 | { |
303 | 376 | "cell_type": "markdown", |
|
341 | 414 | { |
342 | 415 | "cell_type": "code", |
343 | 416 | "metadata": { |
344 | | - "trusted": true |
| 417 | + "trusted": true, |
| 418 | + "ExecuteTime": { |
| 419 | + "end_time": "2026-02-08T11:48:54.067078Z", |
| 420 | + "start_time": "2026-02-08T11:48:54.054258Z" |
| 421 | + } |
345 | 422 | }, |
346 | 423 | "source": [ |
347 | 424 | "Rz = np.array([[cos(θ),-sin(θ), 0],\n", |
|
365 | 442 | "# A rotation about x\n", |
366 | 443 | "print(f\"Rx={Rx}\")" |
367 | 444 | ], |
368 | | - "outputs": [], |
369 | | - "execution_count": null |
| 445 | + "outputs": [ |
| 446 | + { |
| 447 | + "name": "stdout", |
| 448 | + "output_type": "stream", |
| 449 | + "text": [ |
| 450 | + "Rz=[[ 6.123234e-17 -1.000000e+00 0.000000e+00]\n", |
| 451 | + " [ 1.000000e+00 6.123234e-17 0.000000e+00]\n", |
| 452 | + " [ 0.000000e+00 0.000000e+00 1.000000e+00]]\n", |
| 453 | + "Ry=[[ 6.123234e-17 0.000000e+00 1.000000e+00]\n", |
| 454 | + " [ 0.000000e+00 1.000000e+00 0.000000e+00]\n", |
| 455 | + " [-1.000000e+00 0.000000e+00 6.123234e-17]]\n", |
| 456 | + "Rx=[[ 1.000000e+00 0.000000e+00 0.000000e+00]\n", |
| 457 | + " [ 0.000000e+00 6.123234e-17 -1.000000e+00]\n", |
| 458 | + " [ 0.000000e+00 1.000000e+00 6.123234e-17]]\n" |
| 459 | + ] |
| 460 | + } |
| 461 | + ], |
| 462 | + "execution_count": 8 |
370 | 463 | }, |
371 | 464 | { |
372 | 465 | "cell_type": "markdown", |
|
376 | 469 | "\n", |
377 | 470 | "Compositions in SO(3) follow the same rules as SO(2), where sequential rotations are represented by right multiplications. For instance,\n", |
378 | 471 | "\n", |
379 | | - "$$\\mymatrix{R}_c = \\mymatrix{R}_a\\mymatrix{R}^a_b\\mymatrix{R}^b_c.$$\n", |
| 472 | + "$$\\mymatrix{R}^0_c \\mymatrix{R}^0_a\\mymatrix{R}^a_b\\mymatrix{R}^b_c.$$\n", |
380 | 473 | "\n", |
381 | 474 | "This can be represented by the following equivalent piece of code using sample angles." |
382 | 475 | ] |
383 | 476 | }, |
384 | 477 | { |
385 | 478 | "cell_type": "code", |
386 | 479 | "metadata": { |
387 | | - "trusted": true |
| 480 | + "trusted": true, |
| 481 | + "ExecuteTime": { |
| 482 | + "end_time": "2026-02-08T11:48:54.082984Z", |
| 483 | + "start_time": "2026-02-08T11:48:54.068586Z" |
| 484 | + } |
388 | 485 | }, |
389 | 486 | "source": [ |
390 | | - "θa = pi/4\n", |
391 | | - "Ra = np.array([[cos(θa),-sin(θa), 0],\n", |
392 | | - " [sin(θa), cos(θa), 0],\n", |
| 487 | + "θ0_a = pi/4\n", |
| 488 | + "R0_a = np.array([[cos(θ0_a),-sin(θ0_a), 0],\n", |
| 489 | + " [sin(θ0_a), cos(θ0_a), 0],\n", |
393 | 490 | " [0, 0, 1]])\n", |
394 | 491 | "\n", |
395 | 492 | "θa_b = -pi/2\n", |
|
402 | 499 | " [0, cos(θb_c), -sin(θb_c)],\n", |
403 | 500 | " [0, sin(θb_c), cos(θb_c)]])\n", |
404 | 501 | "\n", |
405 | | - "Rc = Ra @ Ra_b @ Rb_c\n", |
406 | | - "print(f\"Rc={Rc}\")" |
| 502 | + "R0_c = R0_a @ Ra_b @ Rb_c\n", |
| 503 | + "print(f\"R0_c={R0_c}\")" |
407 | 504 | ], |
408 | | - "outputs": [], |
409 | | - "execution_count": null |
| 505 | + "outputs": [ |
| 506 | + { |
| 507 | + "name": "stdout", |
| 508 | + "output_type": "stream", |
| 509 | + "text": [ |
| 510 | + "R0_c=[[ 4.32978028e-17 -9.23879533e-01 -3.82683432e-01]\n", |
| 511 | + " [ 4.32978028e-17 3.82683432e-01 -9.23879533e-01]\n", |
| 512 | + " [ 1.00000000e+00 2.34326020e-17 5.65713056e-17]]\n" |
| 513 | + ] |
| 514 | + } |
| 515 | + ], |
| 516 | + "execution_count": 9 |
410 | 517 | }, |
411 | 518 | { |
412 | 519 | "cell_type": "markdown", |
|
420 | 527 | { |
421 | 528 | "cell_type": "code", |
422 | 529 | "metadata": { |
423 | | - "trusted": true |
| 530 | + "trusted": true, |
| 531 | + "ExecuteTime": { |
| 532 | + "end_time": "2026-02-08T11:48:54.180705Z", |
| 533 | + "start_time": "2026-02-08T11:48:54.083625Z" |
| 534 | + } |
424 | 535 | }, |
425 | 536 | "source": [ |
426 | 537 | "Ra_ = Rc @ Rb_c.T @ Ra_b.T \n", |
|
430 | 541 | "else:\n", |
431 | 542 | " print('The results are too different.')\n" |
432 | 543 | ], |
433 | | - "outputs": [], |
434 | | - "execution_count": null |
| 544 | + "outputs": [ |
| 545 | + { |
| 546 | + "ename": "NameError", |
| 547 | + "evalue": "name 'Rc' is not defined", |
| 548 | + "output_type": "error", |
| 549 | + "traceback": [ |
| 550 | + "\u001B[31m---------------------------------------------------------------------------\u001B[39m", |
| 551 | + "\u001B[31mNameError\u001B[39m Traceback (most recent call last)", |
| 552 | + "\u001B[36mCell\u001B[39m\u001B[36m \u001B[39m\u001B[32mIn[10]\u001B[39m\u001B[32m, line 1\u001B[39m\n\u001B[32m----> \u001B[39m\u001B[32m1\u001B[39m Ra_ = \u001B[43mRc\u001B[49m @ Rb_c.T @ Ra_b.T \n\u001B[32m 3\u001B[39m \u001B[38;5;28;01mif\u001B[39;00m np.allclose(Ra, Ra_):\n\u001B[32m 4\u001B[39m \u001B[38;5;28mprint\u001B[39m(\u001B[33m'\u001B[39m\u001B[33mThe results are pretty much the same!\u001B[39m\u001B[33m'\u001B[39m)\n", |
| 553 | + "\u001B[31mNameError\u001B[39m: name 'Rc' is not defined" |
| 554 | + ] |
| 555 | + } |
| 556 | + ], |
| 557 | + "execution_count": 10 |
435 | 558 | }, |
436 | 559 | { |
437 | 560 | "cell_type": "markdown", |
|
0 commit comments