Air mass: Difference between revisions
Content added Content deleted
(add further explanation) |
(Add Factor) |
||
Line 14: | Line 14: | ||
:* Do the same for the SOFIA infrared telescope, which has an orbiting altitude of 13,700 meters. |
:* Do the same for the SOFIA infrared telescope, which has an orbiting altitude of 13,700 meters. |
||
<br><br> |
<br><br> |
||
=={{header|Factor}}== |
|||
{{trans|FreeBASIC}} |
|||
{{works with|Factor|0.99 2021-02-05}} |
|||
<lang factor>USING: formatting io kernel math math.functions math.order |
|||
math.ranges math.trig sequences ; |
|||
CONSTANT: RE 6,371,000 ! Earth's radius in meters |
|||
CONSTANT: dd 0.001 ! integrate in this fraction of the distance already covered |
|||
CONSTANT: FIN 10,000,000 ! integrate to a height of 10000km |
|||
! the density of air as a function of height above sea level |
|||
: rho ( a -- x ) neg 8500 / e^ ; |
|||
! z = zenith angle (in degrees) |
|||
! d = distance along line of sight |
|||
! a = altitude of observer |
|||
:: height ( a z d -- x ) |
|||
RE a + :> AA |
|||
AA sq d sq + 180 z - deg>rad cos AA * d * 2 * - sqrt RE - ; |
|||
:: column-density ( a z -- x ) |
|||
! integrates along the line of sight |
|||
0 0 :> ( s! d! ) |
|||
[ d FIN < ] [ |
|||
dd dd d * max :> delta ! adaptive step size to avoid taking it forever |
|||
s a z d 0.5 delta * + height rho delta * + s! |
|||
d delta + d! |
|||
] while s ; |
|||
: airmass ( a z -- x ) |
|||
[ column-density ] [ drop 0 column-density ] 2bi / ; |
|||
"Angle 0 m 13700 m" print |
|||
"------------------------------------" print |
|||
0 90 5 <range> [ |
|||
dup [ 0 swap airmass ] [ 13700 swap airmass ] bi |
|||
"%2d %15.8f %17.8f\n" printf |
|||
] each</lang> |
|||
{{out}} |
|||
<pre> |
|||
Angle 0 m 13700 m |
|||
------------------------------------ |
|||
0 1.00000000 1.00000000 |
|||
5 1.00380963 1.00380965 |
|||
10 1.01538466 1.01538475 |
|||
15 1.03517744 1.03517765 |
|||
20 1.06399053 1.06399093 |
|||
25 1.10305937 1.10306005 |
|||
30 1.15418974 1.15419083 |
|||
35 1.21998076 1.21998246 |
|||
40 1.30418931 1.30419190 |
|||
45 1.41234169 1.41234567 |
|||
50 1.55280404 1.55281025 |
|||
55 1.73875921 1.73876915 |
|||
60 1.99212000 1.99213665 |
|||
65 2.35199740 2.35202722 |
|||
70 2.89531368 2.89537287 |
|||
75 3.79582352 3.79596149 |
|||
80 5.53885809 5.53928113 |
|||
85 10.07896219 10.08115981 |
|||
90 34.32981136 34.36666557 |
|||
</pre> |
|||
=={{header|FreeBASIC}}== |
=={{header|FreeBASIC}}== |