You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/blog/libra.md
+22-21Lines changed: 22 additions & 21 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,6 +2,7 @@
2
2
author: ${zainabali}
3
3
date: "2017-06-13"
4
4
tags: [technical]
5
+
katex: true
5
6
%}
6
7
7
8
# Compile time dimensional analysis with Libra
@@ -27,8 +28,8 @@ This is actually a form of dimensional analysis. We're mentally assigning the d
27
28
28
29
### Why is it important?
29
30
30
-
Ignoring the laws can result in serious problems.
31
-
Take the Mars Climate Orbiter, a $200 million space probe which successfully reached Mars after a year long voyage, but suddenly crashed into the Martian atmosphere on arrival. Most components on the orbiter were using metric units, however a single component was sending instructions in Imperial units. The other components did not detect this, and instead began a sudden descent causing the orbiter to burn up. This was a simple unit conversion error! It was a basic mistake that could have been easily avoided. It should have been picked up during testing, or in the runtime validation layer.
31
+
Ignoring the laws can result in serious problems.
32
+
Take the Mars Climate Orbiter, a $200 million space probe which successfully reached Mars after a year long voyage, but suddenly crashed into the Martian atmosphere on arrival. Most components on the orbiter were using metric units, however a single component was sending instructions in Imperial units. The other components did not detect this, and instead began a sudden descent causing the orbiter to burn up. This was a simple unit conversion error! It was a basic mistake that could have been easily avoided. It should have been picked up during testing, or in the runtime validation layer.
32
33
33
34
In fact, it could even have been caught at compile time.
34
35
@@ -42,21 +43,21 @@ We'll begin by working through our calculation in doubles before adding compile
42
43
43
44
The star that we're aiming for is Alpha Librae. This is pretty far, so we can only send one very small person. We have been given the following quantities to work with:
44
45
45
-
- rocket mass of a small person - 40kg
46
-
- fuel mass of a lot of fuel - 10<sup>4</sup>kg
47
-
- exhaust speed of a decent fuel - 10<sup>6</sup>ms<sup>-1</sup>
48
-
- distance to Alpha Librae - 77 ly
46
+
- rocket mass of a small person - @:math 40 \text{kg} @:@
47
+
- fuel mass of a lot of fuel - @:math 10^4 \text{kg} @:@
48
+
- exhaust speed of a decent fuel - @:math 10^6 \text{ms}^{-1} @:@
49
+
- distance to Alpha Librae - @:math77 \text{ly} @:@
49
50
50
51
We want to calculate when the rocket will arrive.
51
52
52
53
To do so, we're going to make use of a formula known as the *Ideal Rocket Equation*.
53
54
This calculates the speed of a rocket in ideal conditions.
0 commit comments