Skip to content

Commit 9726f48

Browse files
committed
Polished examples
1 parent 0be02a0 commit 9726f48

File tree

4 files changed

+38
-55
lines changed

4 files changed

+38
-55
lines changed
Lines changed: 30 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -1,93 +1,75 @@
1-
Improvmenet:
2-
notation
3-
formulas
4-
tests
5-
english
6-
71
Box on an incline
82
=================
93

104
> import Vector.Vector
115

12-
All vectors are in newton.
6+
All forces are represented in the form of a vector in this example.
137

148
![Incline](incline.png){.float-img-left}
159

1610
Notation:
17-
fg = gravitational accelleration
11+
$$ fg = gravitational\ accelleration $$
1812

19-
m = mass of box
13+
$$ m = mass\ of\ box $$
2014

2115
> fg = V2 0 (-10)
2216
> m = 2
2317

24-
> unit_normal :: Double -> Vector2 Double
25-
> unit_normal a = V2 (cos a) (sin a)
18+
A unit vector that we get from a degree $a$.
19+
20+
> unit_normal :: Angle -> Vector2 Double
21+
> unit_normal angle = V2 (cos angle) (sin angle)
2622

27-
Force against the incline from the box:
23+
Force against the incline $F_{\perp}$ from the box (negative in y-axis).
2824

2925
> f_l_ :: Vector2 Double -> Angle -> Vector2 Double
30-
> f_l_ fa a = scale ((magnitude fa) * (cos a)) (unit_normal (a-(pi/2)))
26+
> f_l_ fa angle = scale ((magnitude fa) * (cos angle)) (unit_normal (angle-(pi/2)))
3127

32-
The normal against the incline:
28+
The normal force $F_{n} = - F_{\perp}$ supporting the box from the incline (positive in y-axis):
3329

3430
> fn :: Vector2 Double -> Angle -> Vector2 Double
35-
> fn fa a = negate (f_l_ fa a)
36-
37-
Friction free incline:
31+
> fn fa angle = negate (f_l_ fa angle)
3832

39-
Resulting force:
33+
The resulting force is then the normal force from the incline plus the gravitational force.
34+
$$ F_{r} = F_{n} + F_{g} $$
4035

4136
> fr :: Vector2 Double -> Angle -> Vector2 Double
42-
> fr fa a = (fn fa a) + fa
37+
> fr fa angle = (fn fa angle) + fa
4338

4439
With friction:
4540

4641
$$ F_{friction} = \mu * F_{normal} \iff \mu = \frac{F_{friction}}{F_{normal}} $$
4742

48-
> us = 0.5
49-
> uk = 0.4
50-
51-
Add image how friction depends if there is movement.
52-
53-
![Friction](friction.png){.float-img-left}
54-
55-
> type FricConst = Double
43+
There are two different kinds of friction. One where the object is standing still on the surface, and the other where the object is sliding on the surface. In the case where the object is standing still, it remains still until the force applied on the object is greater than the maximum possible friction between the object and the surface. Once that level is surpassed, the object starts to slide.
5644

57-
Friction:
45+
When the object is sliding the maximum friction between the surface and the object is slightly less, as illustrated in the figure below.
5846

59-
friks = Fn * us, us = friction static
47+
![](friction.png){.float-img-left}
6048

61-
frikk = Fn * uk, uk = friction kinetic
49+
$$ F_{static\ friction} = \mu_{static} \cdot F_{normal} $$
50+
$$ F_{kinetic\ friction} = \mu_{kinetic} \cdot F_{normal} $$
6251

52+
We have the normal force against the incline and only need example constants.
6353

64-
We have the normal force and only needs the constants.
65-
66-
The current speed does not affect the friction.
67-
68-
> motscalar :: FricConst -> Vector2 Double -> Scalar
69-
> motscalar u f = u * (magnitude f)
54+
> type FricConst = Double
55+
> us = 0.5
56+
> uk = 0.4
7057

7158
Från en rörelse eller vekt, fixa komplementet
7259

73-
74-
> enh_vekt :: Vector2 Double -> Vector2 Double
75-
> enh_vekt v | magnitude v == 0 = (V2 0 0)
60+
> unit_vec :: Vector2 Double -> Vector2 Double
61+
> unit_vec v | magnitude v == 0 = (V2 0 0)
7662
> | otherwise = scale (1 / (magnitude v)) v
77-
>
78-
>
63+
7964
> motkrafts :: FricConst -> Scalar -> Vector2 Double -> Vector2 Double
80-
> motkrafts u s v = scale (u * s) (negate (enh_vekt v))
81-
>
65+
> motkrafts u s v = scale (u * s) (negate (unit_vec v))
66+
8267
> motkraftv :: FricConst -> Vector2 Double -> Vector2 Double -> Vector2 Double
83-
> motkraftv u n v = scale (u * (magnitude n)) (negate (enh_vekt v))
68+
> motkraftv u normal v = scale (u * (magnitude normal)) (negate (unit_vec v))
8469

85-
Now we just need to sum the force vectors:
70+
Now we just need to sum the force vectors into $F_{r}$:
8671

8772
> fru :: Vector2 Double -> Angle -> FricConst -> Vector2 Double
8873
> fru fa a u = (fr fa a) + (motkraftv u (fn fa a) (fr fa a))
89-
>
90-
> fru' :: Vector2 Double -> Angle -> FricConst -> Vector2 Double
91-
> fru' fa a u = (motkraftv u (fn fa a) (fr fa a))
9274

9375

Physics/src/Examples/Teeter.lhs

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ Exam excercise 3, 2017-01-13
77
> import Prelude hiding (length)
88

99

10-
Two boxes, m1 and m2, rests on a beam in balance.
10+
Two boxes, $m_{1}$ and $m_{2}$, rests on a beam in balance.
1111

1212
Known values:
1313

@@ -19,7 +19,7 @@ Known values:
1919
> two = 2.0 # one
2020
> g = 9.0 # acceleration
2121

22-
![Teeter](teeter.png){.float-img-left}
22+
![](teeter.png){.float-img-left}
2323

2424
Direct implication:
2525

@@ -39,9 +39,9 @@ $$ \tau = distance\ from\ turning\ point \cdot mass \cdot gravitation $$
3939

4040
> m1_torq = m1 *# (g *# beam_left_L)
4141

42-
To get the beams torque on one side, we need to divide by 2 because the beam's torque is spread out linearly (the density of the beam is equal everywhere), which means the left parts mass centrum is \emph{half the distance} of the left parts total length.
42+
To get the beams torque on one side, we need to divide by 2 because the beam's torque is spread out linearly (the density of the beam is equal everywhere), which means the left parts mass centre is $half\ the\ distance$ of the left parts total length.
4343

44-
$$ beamL_{\tau} = beamL_{M} \cdot gravity \cdot \frac{distance}{2} $$
44+
$$ beamL_{\tau} = beamL_{M} \cdot gravity \cdot \frac{beam\ left\ length}{2} $$
4545

4646
where
4747

@@ -65,16 +65,17 @@ $$ m1_{\tau} + beamL_{\tau} = m2_{\tau} + beamR_{\tau} $$
6565

6666
$$ m1_{\tau} + beamL_{\tau} - beamR_{\tau} = m2_{\tau} $$
6767

68-
$$ \frac{m1_{\tau} + beamL_{\tau} - beamR_{\tau}}{m2} = x $$
68+
$$ the\ distance\ x = \frac{m2_{\tau}}{m2 \cdot gravitation} $$
6969

7070
Our solution:
7171

72-
> x = (m1_torq +# beamL_torq -# beamR_torq) /# m2
72+
> x = (m1_torq +# beamL_torq -# beamR_torq) /# (m2 *# g)
7373

7474
Security check:
7575

76-
> m2_torq = m2 *# x
76+
> m2_torq = (m2 *# g) *# x
7777

7878
> left_side_torque = m1_torq +# beamL_torq
7979
> right_side_torque = m2_torq +# beamR_torq
8080

81+
We can control that both sides total torque are equal, and that the dimensions of $x$ is a length.

Physics/src/Examples/friction.png

7.09 KB
Loading

0 commit comments

Comments
 (0)