Skip to content

Commit

Permalink
Merge pull request #110 from moorepants/dynamics-overview-exercises
Browse files Browse the repository at this point in the history
Added exercises to the dynamics overview notebook.
  • Loading branch information
moorepants committed Jul 11, 2016
2 parents 1eb61da + 5b74421 commit cb26ba0
Show file tree
Hide file tree
Showing 5 changed files with 329 additions and 36 deletions.
10 changes: 10 additions & 0 deletions notebooks/exercise_solutions/n01_vector_addition_scaling.py
@@ -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
5 changes: 5 additions & 0 deletions notebooks/exercise_solutions/n01_vector_cross_product.py
@@ -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
8 changes: 8 additions & 0 deletions notebooks/exercise_solutions/n01_vector_dot_product.py
@@ -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()))
12 changes: 12 additions & 0 deletions notebooks/exercise_solutions/n01_vector_rotation.py
@@ -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)

0 comments on commit cb26ba0

Please sign in to comment.