Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #110 from moorepants/dynamics-overview-exercises
Added exercises to the dynamics overview notebook.
- Loading branch information
Showing
5 changed files
with
329 additions
and
36 deletions.
There are no files selected for viewing
10 changes: 10 additions & 0 deletions
10
notebooks/exercise_solutions/n01_vector_addition_scaling.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
from sympy import sin, cos, pi | ||
from sympy.abc import l, theta | ||
|
||
N = ReferenceFrame('N') | ||
|
||
v1 = l * cos(pi / 4) * N.x + l * sin(pi / 4) * N.y | ||
v2 = -10 * N.y | ||
v3 = l * cos(theta) * N.x + l * sin(theta) * N.y | ||
|
||
v1 + v2 - 5 * v3 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
p1 = 23 * N.x - 12 * N.y | ||
p2 = 16 * N.x + 2 * N.y - 4 * N.z | ||
p3 = N.x + 14 * N.z | ||
|
||
cross(p2 - p1, p3 - p1).magnitude() / 2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
from sympy import acos | ||
|
||
N = ReferenceFrame('N') | ||
|
||
v1 = a * N.x + b * N.y + a * N.z | ||
v2 = b * N.x + a * N.y + b * N.z | ||
|
||
acos(v1.dot(v2) / (v1.magnitude() * v2.magnitude())) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
from sympy import pi | ||
from sympy.abc import l, w | ||
|
||
keyboard_frame = ReferenceFrame('K') | ||
intermediate_frame = ReferenceFrame('I') | ||
screen_frame = ReferenceFrame('S') | ||
|
||
intermediate_frame.orient(keyboard_frame, 'Axis', (theta, -keyboard_frame.z)) | ||
screen_frame.orient(intermediate_frame, 'Axis', (pi, intermediate_frame.y)) | ||
|
||
v = l * keyboard_frame.y + w * keyboard_frame.z - l * screen_frame.y | ||
v.express(keyboard_frame) |
Oops, something went wrong.