# Difference between revisions of "Example:Star navigation"

## Contents

### Theory and background

A definition of celestial navigation from http://www.celnav.de:

"Celestial navigation is he art and science of finding one's geographic position by means of astronomical observations, particularly by measuring altitudes of celestial objects - sun, moon, planets, or stars."

From the above web page you will also find "A Short Guide to Celestial Navigation" in pdf format written by Henning Umland.

Here we demonstrate nomograms in the context of celetial navigation by presenting a nomogram for the formula used to compute altitude azimuth. How this formula is used in the celestial navigation is not explained here, the interested reader may refer, e.g., to the above mentioned document for further details. The formula is

$\cos(tapani)=\frac{\sin(d)-\sin(b)\sin(h)}{\cos(b)\cos(h)}$.

### Nomograph construction

Equation

$\cos(a)=\frac{\sin(d)-\sin(b)\sin(h)}{\cos(b)\cos(h)}$

may be transformed into constructional determinant by using variables x and y:

$\cos(a)\equiv x$

$\sin(d)\equiv y$

$x \cos(b)\cos(h) - y + \sin(b)\sin(h) = 0 \, .$

Last three equations are in matrix form:

$\begin{pmatrix} 1 & 0 & -\cos(a) \\ 0 & 1 & -\sin(d) \\ \cos(b)\cos(h) &-1 & \sin(b)\sin(h) \end{pmatrix} \begin{pmatrix} x \\ y \\ 1 \end{pmatrix} = 0.$

For this equation to be true in with any x and y, we require

$\begin{vmatrix} 1 & 0 & -\cos(a) \\ 0 & 1 & -\sin(d) \\ \cos(b)\cos(h) &-1 & \sin(b)\sin(h) \end{vmatrix} =0,$

and this is our constructional determinant. We may express the determinant in form (exchange 2nd and 3ed row, and 2nd and 3rd column) :

$\begin{vmatrix} 1 & -\cos(a) & 0\\ \cos(b)\cos(h) & \sin(b)\sin(h) &-1\\ 0 & -\sin(d) &1 \\ \end{vmatrix} =0,$

and further (multiply second row by -1)

$\begin{vmatrix} 1 & -\cos(a) & 0\\ -\cos(b)\cos(h) & -\sin(b)\sin(h) &1\\ 0 & -\sin(d) &1 \\ \end{vmatrix} =0,$

and (add to 3rd column -1 times first column)

$\begin{vmatrix} 1 & -\cos(a) & -1\\ -\cos(b)\cos(h) & -\sin(b)\sin(h) &1+\cos(b)\cos(h)\\ 0 & -\sin(d) &1 \\ \end{vmatrix} =0.$

### Generated nomograph

Generated portable document file (pdf): File:Ex star navi.pdf

### Source code

"""
ex_star_navi.py

Equation: cos(a)=(sin(d)-sin(b)sin(h))/(cos(b)cos(h))

This program is free software: you can redistribute it and/or modify
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program.  If not, see <http://www.gnu.org/licenses/>.
"""
from nomographer import *

# for testing
d=40.0*pi/180.0
h=30.0*pi/180.0
b=60.0*pi/180.0
print acos((sin(d)-sin(b)*sin(h))/(cos(b)*cos(h)))*180.0/pi
print arange(0.0,40.0,1.0,dtype=double).tolist()

a_params={
'u_min':0.0,
'u_max':90.0,
'f':lambda u:1,
'g':lambda u:-cos(u*pi/180.0),
'h':lambda u:-1.0,
'title':'a',
'title_x_shift':0.0,
'title_y_shift':0.25,
'scale_type':'linear',
'tick_levels':1,
'tick_text_levels':1,
'tick_side':'right',
'tag':'none',
'grid':False,
'extra_params':[{
'u_min':40.0,
'u_max':90.0,
'scale_type':'linear',
'tick_levels':4,
'tick_text_levels':3,
'tick_side':'right'},
{
'u_min':10.0,
'u_max':40.0,
'scale_type':'linear',
'tick_levels':3,
'tick_text_levels':2,
'tick_side':'right'}]}

d_params={
'u_min':0.0,
'u_max':90.0,
'f':lambda u:0.0,
'g':lambda u:-sin(u*pi/180.0),
'h':lambda u:1.0,
'title':'d',
'title_x_shift':0.0,
'title_y_shift':0.25,
'scale_type':'linear',
'tick_levels':1,
'tick_text_levels':1,
'tick_side':'right',
'tag':'none',
'grid':False,
'extra_params':[{
'u_min':0.0,
'u_max':40.0,
'scale_type':'linear',
'tick_levels':4,
'tick_text_levels':3,
'tick_side':'right'},
{
'u_min':40.0,
'u_max':80.0,
'scale_type':'linear',
'tick_levels':3,
'tick_text_levels':2,
'tick_side':'right'}]
}

bh_params={
'ID':'none', # to identify the axis
'tag':'none', # for aligning block wrt others
'title':'Grid',
'title_x_shift':0.0,
'title_y_shift':0.25,
'title_distance_center':0.5,
'title_opposite_tick':True,
'u_min':0.0, # for alignment
'u_max':1.0,  # for alignment
'f_grid':lambda u,v:-cos(u*pi/180.0)*cos(v*pi/180.0),
'g_grid':lambda u,v:-sin(u*pi/180.0)*sin(v*pi/180.0),
'h_grid':lambda u,v:1.0+cos(u*pi/180.0)*cos(v*pi/180.0),
'u_start':0.0,
'u_stop':90.0,
'v_start':0.0,
'v_stop':90.0,
'u_values':[0.0,15.0,30.0,40.0,45.0,50.0,55.0,60.0,65.0,70.0,75.0,80.0,85.0],
'v_values':[0.0,15.0,30.0,45.0,60.0,75.0,85.0],
'grid':True,
'text_prefix_u':r'',
'text_prefix_v':r'',
'text_distance':0.5,
'v_texts_u_start':True,
'v_texts_u_stop':False,
'u_texts_v_start':True,
'u_texts_v_stop':False,
'extra_params':[{
'u_start':0.0,
'u_stop':40.0,
'v_start':60.0,
'v_stop':89.9,
'u_values':arange(0.0,41.0,1.0,dtype=double).tolist(),
'v_values':arange(60.0,91.0,1.0,dtype=double).tolist(),
'v_texts_u_start':False,
'v_texts_u_stop':False,
'u_texts_v_start':False,
'u_texts_v_stop':False,
'u_line_color':color.cmyk.Sepia,
'v_line_color':color.cmyk.Sepia,
}
]
}

block_params={
'block_type':'type_9',
'f1_params':a_params,
'f2_params':bh_params,
'f3_params':d_params,
'transform_ini':False,
}

main_params={
'filename':'ex_star_navi.pdf',
'paper_height':15.0,
'paper_width':15.0,
'block_params':[block_params],
'transformations':[('rotate',0.01),('polygon',),('scale paper',)]
}
b=Nomographer(main_params)