-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmathutils.jl
More file actions
39 lines (32 loc) · 813 Bytes
/
mathutils.jl
File metadata and controls
39 lines (32 loc) · 813 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
"""
@mph2kph(value)
Converts a speed from miles per hour to kilometers per hour.
"""
macro mph2kph(value)
value = esc(value)
return :($value * 1.60934)
end
"""
@kph2mph(value)
Converts a speed from kilometers per hour to miles per hour.
"""
macro kph2mph(value)
value = esc(value)
return :($value * 0.621371)
end
"""
@mach_from_mph(velocity)
Converts a speed from miles per hour to Mach number, where Mach 1 is the speed of sound.
"""
macro mach_from_mph(velocity)
velocity = esc(velocity)
return :($velocity / (761.207 * 0.44704))
end
"""
@mach_from_kph(velocity)
Converts a speed from kilometers per hour to Mach number, where Mach 1 is the speed of sound.
"""
macro mach_from_kph(velocity)
velocity = esc(velocity)
return :($velocity / (1225 * 0.54))
end