以下に,この表を出力したコンピュータプログラム── html で実行する PHP プログラム──を示す:
";
/* 自転軸の傾き */
$n_degree = 23.4;
$n_radian = $n_degree * pi() / 180;
$n_s = sin( $n_radian );
$n_c = cos( $n_radian );
print "
緯度 |
日出 |
日入 |
南中 |
τπ |
τ0 |
τπ |
τ0 |
τπ |
τ0 |
";
for( $a_degree = 30; $a_degree < 61; $a_degree++ ){
/* 緯度 */
$a_radian = $a_degree * pi() / 180;
$a_s = sin( $a_radian );
$a_c = cos( $a_radian );
/* 計算 */
/* sunrise */
$t_pi[0] = 0;
$t_0[0] = 0;
$max[0] = 0;
$min[0] = 0;
/* sunset */
$t_pi[1] = 0;
$t_0[1] = 0;
$max[1] = 0;
$min[1] = 0;
/* midsun */
$t_pi[2] = 0;
$t_0[2] = 0;
$max[2] = 0;
$min[2] = 0;
for( $i = 0; $i < 360; $i++ ){
$t = $i * pi() / 180;
$t_s = sin( $t );
$t_c = cos( $t );
for( $k = 0; $k < 3; $k++ ){
switch( $k ){
case 0 :
$val = ( - $n_s * $a_s * $t_s * $t_c - $n_c * $t_c *
sqrt( pow($a_c, 2) - pow($n_s * $t_c, 2) ) ) / (1 - pow($n_s * $t_c, 2) );
break;
case 1 :
$val = ( - $n_s * $a_s * $t_s * $t_c + $n_c * $t_c *
sqrt( pow($a_c, 2) - pow($n_s * $t_c, 2) ) ) / (1 - pow($n_s * $t_c, 2) );
break;
case 2 :
$val = $t_s / sqrt ( 1 - pow( $n_s, 2 ) * pow( $t_c, 2 ) );
break;
}
if( $val > $max[$k] ){
$max[$k] = $val;
$t_0[$k] = $i;
}
if( $val < $min[$k] ){
$min[$k] = $val;
$t_pi[$k] = $i;
}
}
}
/* レコード書き出し */
print "
".$a_degree." |
";
for( $k = 0; $k < 3; $k++ ){
print "
".$t_pi[$k]." |
".$t_0[$k]." |
";
}
print "
";
}
print "
|