Skip to content

Commit 485cdc4

Browse files
author
Oskar Lundström
committed
2 parents 7108549 + b0f5198 commit 485cdc4

File tree

3 files changed

+15
-25
lines changed

3 files changed

+15
-25
lines changed

Book/build.py

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -125,23 +125,13 @@ def build_index(sources):
125125
"Physics/src/Dimensions/Quantity/Test.lhs"),
126126
("Usage", "Physics/src/Dimensions/Usage.lhs"),
127127
]),
128-
("Vectors", [
129-
("Vector", "Physics/src/Vector/Vector.lhs")
130-
]),
131-
("Calculus", [
132-
("Introduction", "Physics/src/Calculus/Intro.lhs"),
133-
("Function expressions", "Physics/src/Calculus/FunExpr.lhs"),
134-
("Differential calculus", "Physics/src/Calculus/DifferentialCalc.lhs"),
135-
("Integral calculus", "Physics/src/Calculus/IntegralCalc.lhs"),
136-
("Visualization, Verification, and Application", "Physics/src/Calculus/VisVerApp.lhs"),
137-
]),
138128
("Newtonian Mechanics", [
139129
("Single particle mechanics", "Physics/src/NewtonianMechanics/SingleParticle.lhs")
130+
]),
131+
("Examples", [
132+
("Box on an incline", "Physics/src/Examples/Box_incline.lhs"),
133+
("Teeter", "Physics/src/Examples/Teeter.lhs"),
140134
])
141-
# ("Examples", [
142-
# ("Gungbräda", "Physics/src/Examples/Gungbraeda.lhs"),
143-
# ("krafter på lådor", "Physics/src/Examples/krafter_pa_lador.lhs"),
144-
# ])
145135
]
146136

147137
if not os.path.exists("build"):
Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -13,19 +13,19 @@ All vectors are in newton.
1313
> m = 2
1414
> alpha = 30
1515
>
16-
> unit_normal :: Double -> Vector2
16+
> unit_normal :: Double -> Vector2 Double
1717
> unit_normal a = V2 (cos a) (sin a)
1818
>
19-
> f_l_ :: Vector2 -> Angle -> Vector2
19+
> f_l_ :: Vector2 Double -> Angle -> Vector2 Double
2020
> f_l_ fa a = scale ((magnitude fa) * (cos a)) (unit_normal (a-(pi/2)))
2121
>
22-
> fn :: Vector2 -> Angle -> Vector2
22+
> fn :: Vector2 Double -> Angle -> Vector2 Double
2323
> fn fa a = negate (f_l_ fa a)
2424

2525
Frictionfree incline:
2626

2727

28-
> fr :: Vector2 -> Angle -> Vector2
28+
> fr :: Vector2 Double -> Angle -> Vector2 Double
2929
> fr fa a = (fn fa a) + fa
3030

3131

@@ -99,29 +99,29 @@ We have the normal force and only needs the constants.
9999

100100
The current speed does not affect the friction. However F*M = Nm = work = J -> racer cars burn tires.
101101

102-
> motscalar :: FricConst -> Vector2 -> Scalar
102+
> motscalar :: FricConst -> Vector2 Double -> Scalar
103103
> motscalar u f = u * (magnitude f)
104104

105105
Från en rörelse eller vekt, fixa komplementet
106106

107107

108-
> enh_vekt :: Vector2 -> Vector2
108+
> enh_vekt :: Vector2 Double -> Vector2 Double
109109
> enh_vekt v | magnitude v == 0 = (V2 0 0)
110110
> | otherwise = scale (1 / (magnitude v)) v
111111
>
112112
>
113-
> motkrafts :: FricConst -> Scalar -> Vector2 -> Vector2
113+
> motkrafts :: FricConst -> Scalar -> Vector2 Double -> Vector2 Double
114114
> motkrafts u s v = scale (u * s) (negate (enh_vekt v))
115115
>
116-
> motkraftv :: FricConst -> Vector2 -> Vector2 -> Vector2
116+
> motkraftv :: FricConst -> Vector2 Double -> Vector2 Double -> Vector2 Double
117117
> motkraftv u n v = scale (u * (magnitude n)) (negate (enh_vekt v))
118118

119119
Now we just need to sum the force vectors:
120120

121-
> fru :: Vector2 -> Angle -> FricConst -> Vector2
121+
> fru :: Vector2 Double -> Angle -> FricConst -> Vector2 Double
122122
> fru fa a u = (fr fa a) + (motkraftv u (fn fa a) (fr fa a))
123123
>
124-
> fru' :: Vector2 -> Angle -> FricConst -> Vector2
124+
> fru' :: Vector2 Double -> Angle -> FricConst -> Vector2 Double
125125
> fru' fa a u = (motkraftv u (fn fa a) (fr fa a))
126126

127127

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
> module Examples.Gungbraeda where
1+
> module Examples.Teeter where
22

33
Exam excercise 3, 2017-01-13
44

0 commit comments

Comments
 (0)