-
Notifications
You must be signed in to change notification settings - Fork 2
/
pancanga3.13
2093 lines (1772 loc) · 63.5 KB
/
pancanga3.13
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
#!/usr/local/bin/perl
# Version 3.20040205
#{:::::::::::::::::::::::::::}
# {addition in perl version}
$true = 1;
$false = 0;
$variabledeclaration = $true;
sub numeric_p {
local($data) = @_;
if ($data =~ /^-?\d*\.?\d*(e\d|e-\d)?\d*$/) {
$true;
} else {
$false;
};
}
sub int_p {
local($data) = @_;
if ((&numeric_p($data) && (int($data) == $data))) {
$true;
} else {
$false;
};
}
sub trunc {
local($x) = @_;
int($x);
}
sub floor {
local($x) = @_;
local($y);
$y = int($x);
if ($x < $y) {
$y - 1;
} else {
$y;
};
}
sub frac {
local($x) = @_;
$x - int($x);
}
sub round {
local($x) = @_;
&floor($x + 0.5);
}
sub sqr {
local($x) = @_;
$x * $x;
}
# arctan(x) --> atan2(x,1)
#{:::::::::::::::::::::::::::}
# { mathematical constants }
$pi = atan2(1,1) * 4;
$pi2 = $pi * 2;
$rad = 180 / $pi;
# {for function arcsin}
$eps = 1e-6;
# {for calcuration cut off}
# in perl; precision changed
$epsiron = 1e-8;
#{:::::::::::::::::::::::::::}
# { settings }
$with_bija_pf = $false;
# $loc_lat = 28.6; # {Delhi}#20011114
$Ujjaini_lat = 23.2; # {Ujjaini}#20020304
$loc_lat = $Ujjaini_lat; #20020304
$Ujjaini_lon = 75.8; # {Ujjaini}#20011114#20020320
$loc_lon = $Ujjaini_lon; #20020304
$yearmax = 3000;
#{:::::::::::::::::::::::::::}
# {planets}
# type planets = (Star,
# Sun, Moon, Mercury, Venus, Mars, Jupiter, Saturn,
# Candrocca, Rahu);
%planet_name = (
'star', 'Star ',
'sun', 'Sun ',
'moon', 'Moon ',
'mercury', 'Mercury ',
'venus', 'Venus ',
'mars', 'Mars ',
'jupiter', 'Jupiter ',
'saturn', 'Saturn ',
'Candrocca', 'Candrocca ',
'Rahu', 'Rahu ',
);
$planet = $variabledeclaration;
# (Star, Sun, Moon, Mercury, Venus, Mars, Jupiter, Saturn, Candrocca, Rahu);
%YugaRotation ;
%PlanetRotation ;
%PlanetSighra ;
%PlanetMeanPosition ;
%PlanetTruePosition ;
%PlanetApogee ;
%PlanetCircumm ;
%PlanetCircums ;
# key == $planet; value == real;
$YugaCivilDays = $variabledeclaration;
$YugaSynodicMonth = $variabledeclaration;
$YugaAdhimasa = $variabledeclaration;
$YugaTithi = $variabledeclaration;
$YugaKsayadina = $variabledeclaration;
$lagna = $variabledeclaration;
#{:::::::::::::::::::::::::::}
$back_clong_ahar = -1;
$back_nclong_ahar = -1;
$back_clong = -1;
$back_nclong = -1;
# type paksas =(suklapaksa, krsnapaksa);
$year = $variabledeclaration;
$month = $variabledeclaration;
$paksa = $variabledeclaration;
# (suklapaksa, krsnapaksa);
$day = $variabledeclaration; # {for ahargana}
$ahar = $variabledeclaration; # {for ahargana}
$hours = $variabledeclaration;
$minutes = $variabledeclaration;
$JulianDay = $variabledeclaration; # {for Julian days}
$YearKali = $variabledeclaration;
$YearSaka = $variabledeclaration;
$YearVikrama = $variabledeclaration;
$masa_num = $variabledeclaration;
$saura_masa_num = $variabledeclaration; ###20000614
$saura_masa_day = $variabledeclaration; ###20001231
$tithi_day = $variabledeclaration;
$mslong = $variabledeclaration; # {solar position}
$tslong = $variabledeclaration; # {solar position}
$mllong = $variabledeclaration; # {lunar position}
$tllong = $variabledeclaration; # {lunar position}
$clong = $variabledeclaration;
$nclong = $variabledeclaration;
$tithi = $variabledeclaration;
$ftithi = $variabledeclaration;
$eqtime = $variabledeclaration; # {for equation of time}
$sriseh = $variabledeclaration;
$srisem = $variabledeclaration;
$weekday_name = $variabledeclaration;
$sukla_krsna = $variabledeclaration;
$adhimasa = $variabledeclaration;
$masa = $variabledeclaration;
$naksatra = $variabledeclaration;
$Jovian_Year_north = $variabledeclaration;
$Jovian_Year_south = $variabledeclaration;
$samkranti = $variabledeclaration; ###20010310
$samkranti_year = $variabledeclaration; ###20010310
$samkranti_month = $variabledeclaration; ###20010310
$samkranti_day = $variabledeclaration; ###20010310
$samkranti_hour = $variabledeclaration; ###20010310
$samkranti_min = $variabledeclaration; ###20010310
$ayanadeg = $variabledeclaration; ###20010313
$ayanamin = $variabledeclaration; ###20010313
$desantara = ($loc_lon - $Ujjaini_lon) / 360; #20011114 time
$counter = $variabledeclaration;
#{:::::::::::::::::::::::::::}
sub abs {
local($x) = @_;
if ($x < 0) {
$x * -1;
} else {
$x;
}
}
sub zero360 {
local($longitude) = @_;
# $longitude = $longitude - trunc($longitude / 360) * 360;
# in perl: trunc --> int
$longitude = $longitude - int($longitude / 360) * 360;
if ($longitude < 0) {
$longitude = $longitude + 360;
}
$longitude;
}
sub tan {
local($x) = @_;
sin($x) / cos($x);
}
sub arcsin { ###20010316
local($x) = @_;
if ($eps < &abs(1 - &sqr($x))) {
atan2($x / sqrt(1 - &sqr($x)), 1);
} elsif (0 < $x) { # {x is neary to 1}
$pi / 2; # {sin(pi/2)=1}
} else { # {x is neary to -1}
3 * $pi / 2; # {sin(3 pi/2)=-1}
}
}
sub three_relation {
local($a, $b, $c) = @_;
if (($a < $b) && ($b < $c)) {
1;
} elsif (($c < $b) && ($b < $a)) {
-1;
} else {
0;
}
}
#{:::::::::::::::::::::::::::}
# { from one date to another date }
sub next_date {
local($year, $month, $day) = @_;
$day = $day + 1;
if ($month == 2) {
if (29 < $day) {
$day = 1;
$month = $month + 1;
# ignoring the skipping year !!!
}
} elsif (($month == 4) ||
($month == 6) ||
($month == 9) ||
($month == 11)) {
if (30 < $day) {
$day = 1;
$month = $month + 1;
}
} else {
if (31 < $day) {
$day = 1;
$month = $month + 1;
}
}
if (12 < $month) {
$month = 1;
$year = $year + 1;
}
if (&ModernDate_to_JulianDay($year, $month, $day) ==
&ModernDate_to_JulianDay($year, $month + 1, 1)) {
($year, $month + 1, 1)
} else {
($year, $month, $day)
}
}
# procedure prec_tithi(var YearSaka, masa_num :integer;
# var paksa :paksas;
# var tithi_day :integer);
# begin
# if tithi_day = 1 then begin
# tithi_day := 15;
# if paksa = suklapaksa then begin
# paksa := krsnapaksa;
# dec(masa_num);
# if masa_num < 0 then begin
# masa_num := 11;
# dec(YearSaka)
# end
# end
# else paksa := suklapaksa;
# end
# else dec(tithi_day);
# end;
# procedure next_tithi(var YearSaka, masa_num :integer;
# var paksa :paksas;
# var tithi_day :integer);
# begin
# if tithi_day = 15 then begin
# tithi_day := 1;
# if paksa = krsnapaksa then begin
# paksa := suklapaksa;
# inc(masa_num);
# if 11 < masa_num then begin
# masa_num := 0;
# inc(YearSaka)
# end
# end
# else paksa := krsnapaksa;
# end
# else inc(tithi_day);
# end;
sub ModernDate_to_JulianDay {
local($year, $month, $day) = @_;
local($julian_day);
if ($month < 3) {
$year = $year -1 ;
$month = $month + 12;
}
$julian_day = int(365.25 * $year) + int(30.59 * ($month - 2)) + $day + 1721086.5;
if ($year < 0) {
$julian_day = $julian_day - 1;
if ((($year % 4) == 0) && (3 <= $month)) {
$julian_day = $julian_day + 1;
}
}
if (2299160 < $julian_day) {
$julian_day = $julian_day + int($year / 400) - int($year / 100) + 2;
}
$julian_day;
}
sub Julian_in_England_p {###20030331
local($JulianDay) = @_;
if ((2299160 < $JulianDay) && ($JulianDay <= 2361221)) {
$true;
} else {
$false;
};
}
sub JulianDay_to_JulianDate {###20040205
local($JulianDay) = @_;
local($j, $k, $l, $n, $i, $J, $I);
local($year, $month, $day);
$j = int($JulianDay) + 1402;
$k = int(($j - 1) / 1461);
$l = $j - 1461 * $k;
$n = int(($l - 1) / 365) - int($l / 1461);
$i = $l - 365 * $n + 30;
$J = int(80 * $i / 2447) ;
$day = $i - int(2447 *$J / 80);
$I = int($J / 11);
$month = $J + 2 -12 * $I;
$year = 4 * $k + $n +$I - 4716;
($year, $month, $day);
}
sub JulianDay_to_GregorianDate {###20030331
local($JulianDay) = @_;
local($a, $b, $c, $e, $f, $g, $h);
local($year, $month, $day); ###20010313
$a = $JulianDay + 68569;
$b = int($a / 36524.25);
$c = $a - int(36524.25 * $b + 0.75);
$e = int(($c + 1) / 365.2425);
$f = $c - int(365.25 * $e) + 31;
$g = int($f / 30.59);
$h = int($g / 11);
$day = &trunc($f - int(30.59 * $g) + ($JulianDay - int($JulianDay)));
$month = &trunc($g - 12 * $h + 2);
$year = &trunc(100 * ($b - 49) + $e + $h);
($year, $month, $day);
}
sub JulianDay_to_ModernDate {###20030331
local($JulianDay) = @_;
local($year, $month, $day);
if ($JulianDay < 2299239) {
&JulianDay_to_JulianDate($JulianDay);
} else {
&JulianDay_to_GregorianDate($JulianDay);
}
}
# killed ###20030331
#sub JulianDay_to_ModernDate {
# local($JulianDay) = @_;
#
# local($a, $b, $c, $e, $f, $g, $h);
# local($year, $month, $day); ###20010313
#
# if ($JulianDay < 2299239) {
# $a = int($JulianDay) + 68607;
# $b = int($a / 36525);
# $c = $a - int(36525 * $b);
# $e = int(($c + 1) / 365.25);
# } else {
# $a = $JulianDay + 68569;
# $b = int($a / 36524.25);
# $c = $a - int(36524.25 * $b + 0.75);
# $e = int(($c + 1) / 365.2425);
# }
#
# $f = $c - int(365.25 * $e) + 31;
# $g = int($f / 30.59);
# $h = int($g / 11);
# $day = &trunc($f - int(30.59 * $g) + ($JulianDay - int($JulianDay)));
# $month = &trunc($g - 12 * $h + 2);
# $year = &trunc(100 * ($b - 49) + $e + $h);
# ($year, $month, $day);
#}
sub JulianDay_to_Ahargana {
# {from epoch midnight to given midnight}
local($julian_day) = @_;
$julian_day - 588465.50;
}
sub Ahargana_to_JulianDay {
local($ahar) = @_;
588465.50 + $ahar;
}
sub Ahargana_to_Kali {
local($ahar) = @_;
# global variables: $YugaRotation{'sun'}, $YugaCivilDays
&trunc($ahar * $YugaRotation{'sun'} / $YugaCivilDays);
}
sub Kali_to_Ahargana {
local($YearKali, $masa_num, $tithi_day) = @_;
# global variables: $YugaAdhimasa, $YugaRotation{'sun'}, $YugaKsayadina, $YugaTithi
local($sm, $cm, $adhim, $avama, $tithi);
$sm = $YearKali;
$sm = $sm * 12 + $masa_num; # {expired saura masas}
$adhim = int($sm * $YugaAdhimasa / (12 * $YugaRotation{'sun'})); # {expired adhimasas}
$cm = $sm + $adhim; # {expired candra masas}
$tithi = 30 * $cm + $tithi_day -1; # {expired tithis}
$avama = int($tithi * $YugaKsayadina / $YugaTithi); # {expired avamas}
$tithi - $avama; # {ahargana from Kali epoch to given date}
}
sub Kali_to_Saka {
local($YearKali) = @_;
$YearKali - 3179;
}
sub Saka_to_Kali {
local($YearSaka) = @_;
$YearSaka + 3179;
}
#{:::::::::::::::::::::::::::}
# { condition check }
sub adhimasa_p {
local($clong, $nclong) = @_;
if (&trunc($clong / 30) == &trunc($nclong / 30)) {
$true;
} else {
$false;
}
}
#{:::::::::::::::::::::::::::}
# { INPUT }
sub read_real {
local($message, $min, $max) = @_;
local($number);
print $message;
chop($number = <>);
if (($number =~ /^$/) ||
!&numeric_p($number) ||
($number < $min) ||
($max < $number)) {
print " Number is not appropriate.\n";
&read_real($message, $min, $max);
} else {
$number;
}
}
sub read_integer {
local($message, $min, $max) = @_;
local($number);
print $message;
chop($number = <>);
if (($number =~ /^$/) ||
!&int_p($number) ||
($number < $min) ||
($max < $number)) {
print " Number is not appropriate.\n";
&read_integer($message, $min, $max);
} else {
$number;
}
}
sub show_map_of_india {
print " ------------------------------------------------------------ \n";
print "| Latitude |\n";
print "| |\n";
print "|_____ ______36 |\n";
print "| * Srinagar:34.1 |\n";
print "|_____ ______32 |\n";
print "| * Delhi:28.6 |\n";
print "|_____ * ______28 Kathmandu:27.7 |\n";
print "| * Varanasi:25.3 |\n";
print "|_____ ---\\ ______24 Ujjain:23.2 |\n";
print "| \\// * *___ Calcutta:22.6 |\n";
print "|_____ \\_/| _/~ ~_____20 |\n";
print "| |* _/ Bombay:19.0 |\n";
print "|_____ \\ * _/ ______16 Hyderabad:17.4 |\n";
print "| \\ | |\n";
print "|_____ \\ *| ______12 Madras:13.1 |\n";
print "| \\ / |\n";
print "|_____ \\*/ /\\ ______08 Trivandrum:8.5 |\n";
print "| |* | Colombo:6.9 |\n";
print "|_____ -- ______04 |\n";
print "| |\n";
print " ------------------------------------------------------------ \n";
}
sub read_local_latitude {
&read_real(" Input local latitude in degree = ", -80, 80);
}
sub show_map_of_india_longitude {#20011114
print " ------------------------------------------------------------ \n";
print "| Longitude |\n";
print "| | | | | | |\n";
print "| | | | | | |\n";
print "| * Srinagar:74.8 |\n";
print "| |\n";
print "| * Delhi:77.2 |\n";
print "| * Kathmandu:85.2 |\n";
print "| * Varanasi:83.0 |\n";
print "| ---\\ Ujjain:75.8 |\n";
print "| \\// * *___ Calcutta:88.4 |\n";
print "| \\_/| _/~ ~ |\n";
print "| |* _/ Bombay:72.8 |\n";
print "| \\ * _/ Hyderabad:78.5 |\n";
print "| \\ | |\n";
print "| \\ *| Madras:80.2 |\n";
print "| \\ / |\n";
print "| \\*/ /\\ Trivandrum:77.0 |\n";
print "| |* | Colombo:79.9 |\n";
print "| | | -- | | |\n";
print "| | | | | |\n";
print "| 70 80 90 |\n";
print " ------------------------------------------------------------ \n";
}
sub read_local_longitude {#20011114
&read_real(" Input local longitude in degree = ", -180, 180);
}
sub read_date {
# global variables: $yearmax
local($year, $month, $day);
local($inputdata);
print " Year Month Day = ";
chop($inputdata = <>);
($year, $month, $day) = split(/ +/, $inputdata, 3);
if (!defined($day) ||
!&int_p($year) ||
# ($year < -$yearmax) ||
($yearmax < $year) ||
!&int_p($month) ||
($month < 1) ||
(12 < $month) ||
($day < 0) ||
(32 < $day)) {
print " Date is not appropriate.\n";
&read_date;
} elsif (&JulianDay_to_Ahargana(&ModernDate_to_JulianDay($year, $month, $day)) < -1) {
# print " The days before the epoc of Kali are not known to us.\n";
print " Date is not appropriate.\n";
&read_date;
} else {
($year, $month, $day);
}
}
sub read_time {
local($hours, $minutes);
local($inputdata);
print " Time in hours and minutes = ";
chop($inputdata = <>);
($hours, $minutes) = split(/ +/, $inputdata, 2);
if (!defined($minutes) ||
!&int_p($hours) ||
($hours < 0) ||
(24 <= $hours) ||
($minutes < 0) ||
(60 <= $minutes)) {
print " Time is not appropriate.\n";
&read_time;
} else {
($hours, $minutes);
}
}
sub read_char {
local($message) = @_;
local($character);
print $message;
chop($character = <>);
$character =~ y/a-z/A-Z/;
$character = substr($character, 0, 1);
$character = $character . " ";
$character = substr($character, 0, 1);
}
sub read_indian_date {
local($saka_year, $vikrama_year, $masa_num, $paksa, $tithi_day);
local($paksa_ans);
print " 0(11).Caitra 1( 0).Vaisakha 2( 1).Jyaistha 3( 2).Asadha\n";
print " 4( 3).Sravana 5( 4).Bhadrapada 6( 5).Asvina 7( 6).Karttika\n";
print " 8( 7).Margasira 9( 8).Pausa 10( 9).Magha 11(10).Phalguna\n";
$year_ans = &read_char( "Saka years or Vikrama years? ...S/V ");
while ($year_ans !~ /[SV]/) {
$year_ans = &read_char("Saka years or Vikrama years? ...S/V ");
}
if ($year_ans eq "S") {
$saka_year = &read_integer("Saka years expired: ", 0, $yearmax);
} else {
$vikrama_year = &read_integer("Vikrama years expired: ", 0, $yearmax);
$saka_year = $vikrama_year - 135;
}
print "If purnimanta and krsna-paksa, enter the number in brackets\n";
$masa_num = &read_integer("Enter masa by the number: ", 0, 11);
$paksa_ans = &read_char( "Sukla- or Krsnapaksa ? ...s/k ");
while ($paksa_ans !~ /[KS]/) {
$paksa_ans = &read_char("Sukla- or Krsnapaksa ? ...s/k ");
}
if ($paksa_ans eq "S") {
$paksa = 'Suklapaksa';
} else {
$paksa = 'Krsnapaksa';
}
$tithi_day = &read_integer("Enter tithi by the number 1 to 15: ", 1, 15);
($saka_year, $masa_num, $paksa, $tithi_day);
}
#{:::::::::::::::::::::::::::}
# { get names }
sub get_weekday_name {
local($JulianDay) = @_;
%weekday_name = (
0, 'Monday',
1, 'Tuesday',
2, 'Wednesday',
3, 'Thursday',
4, 'Friday',
5, 'Saturday',
6, 'Sunday'
);
$weekday_name{&trunc($JulianDay + 0.5) % 7};
}
sub get_sukla_krsna {
local($paksa) = @_;
$paksa;
}
sub get_adhimasa {
local($clong, $nclong) = @_;
if (&adhimasa_p($clong, $nclong)) {
"Adhika-";
} else {
"";
}
}
sub get_masa_name {
local($number) = @_;
%masa_name = (
0, 'Caitra ',
1, 'Vaisakha ',
2, 'Jyaistha ',
3, 'Asadha ',
4, 'Sravana ',
5, 'Bhadrapada',
6, 'Asvina ',
7, 'Karttika ',
8, 'Margasirsa',
9, 'Pausa ',
10,'Magha ',
11,'Phalguna '
);
$masa_name{$number};
}
sub get_saura_masa_name { ###20000613
local($number) = @_;
%saura_masa_name = (
0, 'Mesa ',
1, 'Vrsa ',
2, 'Mithuna',
3, 'Karkata',
4, 'Simha ',
5, 'Kanya ',
6, 'Tula ',
7, 'Vrscika',
8, 'Dhanus ',
9, 'Makara ',
10,'Kumbha ',
11,'Mina '
);
$saura_masa_name{$number};
}
sub get_karana_name {
local($tithi) = @_;
%karana_name = (
0, 'kiMstughna',
1, 'bava ',
2, 'bAlava ',
3, 'kaulava ',
4, 'taitila ',
5, 'gara ',
6, 'vaNij ',
7, 'viSTi ',
8, 'zakuni ',
9, 'catuSpada ',
10,'nAga '
);
local($karana);
$karana = &trunc(2 * $tithi);
if ($karana == 0) {
$karana_name{0};}
elsif ($karana < 57) {
$karana = $karana % 7; ####20000910 few lines modified
if ($karana ==0){
$karana_name{7};
} elsif ($karana !=0){
$karana_name{$karana};
}
} elsif ($karana == 57) { ####20010409
$karana_name{8};
} elsif ($karana == 58) {
$karana_name{9};
} elsif ($karana == 59) {
$karana_name{10};
}
}
sub get_yoga_name {
local($tslong, $tllong) = @_;
%yoga_name = (
0, 'viSkambha',
1, 'prIti',
2, 'AyuSmat',
3, 'saubhAgya',
4, 'zobhana',
5, 'atigaNDa',
6, 'sukarman',
7, 'dhRti',
8, 'zUla',
9, 'gaNDa', #20010312
10, 'vRddhi',
11, 'dhruva',
12, 'vyAghAta',
13, 'harSaNa',
14, 'vajra',
15, 'siddhi',
16, 'vyatIpAta',
17, 'varIyas',
18, 'parigha',
19, 'ziva',
20, 'siddha',
21, 'sAdhya',
22, 'zubha',
23, 'zukla',
24, 'brahman',
25, 'aindra',
26, 'vaidhRti',
27, 'viSkambha'
);
local($yoga1, $yoga);
$yoga1 = &zero360($tslong + $tllong);
$yoga = &trunc($yoga1 * 27 / 360);
$yoga_name{$yoga};
}
sub get_naksatra_name {
local($tllong) = @_;
%naksatra_name = (
0, 'Asvini',
1, 'Bharani',
2, 'Krttika',
3, 'Rohini',
4, 'Mrgasira',
5, 'Ardra',
6, 'Punarvasu',
7, 'Pusya',
8, 'Aslesa',
9, 'Magha',
10,'P-phalguni',
11,'U-phalguni',
12,'Hasta',
13,'Citra',
14,'Svati',
15,'Visakha',
16,'Anuradha',
17,'Jyestha',
18,'Mula',
19,'P-asadha',
20,'U-asadha',
21,'Sravana',
22,'Dhanistha',
23,'Satabhisaj',
24,'P-bhadrapada',
25,'U-bhadrapada',
26,'Revati',
27,'Asvini'
);
$naksatra_name{&trunc($tllong * 27 / 360)};
}
sub get_Jovian_Year_name {
local($YearKali) = @_;
%Jovian_Year_name = (
0, 'kSaya(60)',
1, 'prabhava(1)',
2, 'vibhava(2)',
3, 'sukha(3)',
4, 'pramoda(4)',
5, 'prajApati(5)',
6, 'aGgiras(6)',
7, 'zrImukha(7)',
8, 'bhAva(8)',
9, 'yuvan(9)',
10,'dhAtR(10)',
11,'Izvara(11)',
12,'bahudhArya(12)',
13,'pramAthin(13)',
14,'vikrama(14)',
15,'vRSa(15)',
16,'citrabhAnu(16)',
17,'subhAnu(17)',
18,'tAraNa(18)',
19,'pArthiva(19)',
20,'vyaya(20)',
21,'sarvajit(21)',
22,'sarvadhArin(22)',
23,'virodhin(23)',
24,'vikRta(24)',
25,'khara(25)',
26,'nandana(26)',
27,'vijaya(27)',
28,'jaya(28)',
29,'manmatha(29)',
30,'durmukha(30)',
31,'hemalamba(31)',
32,'vilambin(32)',
33,'vikArin(33)',
34,'zArvari(34)',
35,'plava(35)',
36,'zubhakRt(36)',
37,'zobhana(37)',
38,'krodhin(38)',
39,'vizvAvasu(39)',
40,'parAbhava(40)',
41,'plavaGga(41)',
42,'kIlaka(42)',
43,'saumya(43)',
44,'sAdhAraNa(44)',
45,'virodhakRt(45)',
46,'paridhAvin(46)',
47,'pramAdin(47)',
48,'Ananda(48)',
49,'rAkSasa(49)',
50,'anala(50)',
51,'piGgala(51)',
52,'kAlayukta(52)',
53,'siddhArthin(53)',
54,'raudra(54)',
55,'durmati(55)',
56,'dundubhi(56)',
57,'rudhirodgArin(57)',
58,'raktAkSa(58)',
59,'krodhana(59)'
);
local($Jovian_Year);
$Jovian_Year = (&trunc(($YearKali * 211 - 108) / 18000) + $YearKali + 27) % 60;
$Jovian_Year_name{$Jovian_Year};
}
sub get_Jovian_Year_name_south {
local($YearKali) = @_;
local($Jovian_Year);
if ($YearKali < 4009) {
$Jovian_Year = $YearKali;
} else {
$Jovian_Year = ($YearKali - 14) % 60;
}
&get_Jovian_Year_name($Jovian_Year);
}
#{:::::::::::::::::::::::::::}
sub set_primary_constant {
$YugaRotation{'star'} = 1582237800; ###20020331
$YugaRotation{'sun'} = 4320000;
$YugaRotation{'moon'} = 57753336;
$YugaRotation{'mercury'} = 17937000; ###20010328
$YugaRotation{'venus'} = 7022388; ###20010328
$YugaRotation{'mars'} = 2296824; ###20010328
$YugaRotation{'jupiter'} = 364220;
$YugaRotation{'saturn'} = 146564; ###20010328
$YugaRotation{'Candrocca'} = 488219;
$YugaRotation{'Rahu'} = -232226;
}
sub add_bija{
# global variables: $with_bija_pf
if ($with_bija_pf) {
$YugaRotation{'star'} = $YugaRotation{'star'} + 28 ; ###20020331
$YugaRotation{'sun'} = $YugaRotation{'sun'};
$YugaRotation{'moon'} = $YugaRotation{'moon'};
$YugaRotation{'mercury'} = $YugaRotation{'mercury'} + 60; ###20020331
$YugaRotation{'venus'} = $YugaRotation{'venus'} - 12; ###20010328
$YugaRotation{'mars'} = $YugaRotation{'mars'} + 8; ###20010328
$YugaRotation{'jupiter'} = $YugaRotation{'jupiter'}; ###20010328
$YugaRotation{'saturn'} = $YugaRotation{'saturn'} + 4; ###20010328
$YugaRotation{'Candrocca'} = $YugaRotation{'Candrocca'} - 16 ; ###20010328