Air mass: Difference between revisions

Added 11l
(→‎{{header|Wren}}: Updated to use new core library methods.)
(Added 11l)
Line 16:
::     it flies in a specially retrofitted Boeing 747 about four flights a week.
<br><br>
 
=={{header|11l}}==
{{trans|Python}}
 
<lang 11l>V DEG = 0.017453292519943295769236907684886127134
V RE = 6371000
V dd = 0.001
V FIN = 10000000
 
F rho(a)
‘ the density of air as a function of height above sea level ’
R exp(-a / 8500.0)
 
F height(Float a; z, d)
a = altitude of observer
z = zenith angle (in degrees)
d = distance along line of sight
R sqrt((:RE + a) ^ 2 + d ^ 2 - 2 * d * (:RE + a) * cos((180 - z) * :DEG)) - :RE
 
F column_density(a, z)
‘ integrates density along the line of sight ’
V (dsum, d) = (0.0, 0.0)
L d < :FIN
V delta = max(:dd, (:dd) * d)
dsum += rho(height(a, z, d + 0.5 * delta)) * delta
d += delta
R dsum
 
F airmass(a, z)
R column_density(a, z) / column_density(a, 0)
 
print("Angle 0 m 13700 m\n "(‘-’ * 36))
L(z) (0.<91).step(5)
print(f:‘{z:3} {airmass(0, z):12.7} {airmass(13700, z):12.7}’)</lang>
 
{{out}}
<pre>
Angle 0 m 13700 m
------------------------------------
0 1.0000000 1.0000000
5 1.0038096 1.0038096
10 1.0153847 1.0153848
15 1.0351774 1.0351776
20 1.0639905 1.0639909
25 1.1030594 1.1030601
30 1.1541897 1.1541908
35 1.2199808 1.2199825
40 1.3041893 1.3041919
45 1.4123417 1.4123457
50 1.5528040 1.5528102
55 1.7387592 1.7387692
60 1.9921200 1.9921366
65 2.3519974 2.3520272
70 2.8953137 2.8953729
75 3.7958235 3.7959615
80 5.5388581 5.5392811
85 10.0789622 10.0811598
90 34.3298114 34.3666656
</pre>
 
=={{header|AWK}}==
1,453

edits