Jump to content

  •  

CNers have asked about a donation box for Cloudy Nights over the years, so here you go. Donation is not required by any means, so please enjoy your stay.

Photo

TAKI.BAS - What BASIC To Use?

  • Please log in to reply
17 replies to this topic

#1 The_Vagabond

The_Vagabond

    Ranger 4

  • *****
  • topic starter
  • Posts: 336
  • Joined: 27 Oct 2008
  • Loc: Charlotte Hall, Maryland

Posted 03 August 2019 - 05:15 PM

Okay, not sure what I'm doing wrong here. 

I'm running TAKI,BAS on an old HP95LX with GWBASIC on a CF card, and I'm getting some really... interesting results. Declinations in positive when they should be negative, and nowhere close, right ascensions horribly off. I've played around with the software before, and had similar results, but moved on (then, I was using Q-BASIC). Is this specific to a certain BASIC flavor?



#2 jeremiah2229

jeremiah2229

    Surveyor 1

  • *****
  • Posts: 1,830
  • Joined: 25 Jul 2015
  • Loc: Illinois, USA N 37° W 89°

Posted 03 August 2019 - 05:33 PM

Please paste the source here so we can have a look.

 

Thanks...



#3 The_Vagabond

The_Vagabond

    Ranger 4

  • *****
  • topic starter
  • Posts: 336
  • Joined: 27 Oct 2008
  • Loc: Charlotte Hall, Maryland

Posted 03 August 2019 - 07:03 PM

Here's the code in its entirety...

 

100 REM   PROGRAM FOR POINTING A TELESCOPE
105 REM            BY T. TAKI
110 REM
111 REM
115 DIM S$(17),B(17),D(17),Q(3,3)
120 DIM V(3,3),R(3,3),X(3,3),Y(3,3)
125 REM
130 REM     STAR DATA
135 FOR J=1 TO 17: READ S$(J),B(J),D(J): NEXT J
140 REM
145 REM     CONSTANTS
150 K=1.002738: G=57.2958
155 Z1=0: Z2=0: Z3=0: REM  MOUNT ERROR, IF ANY <<<<<<<<<
160 REM
165 FOR I=1 TO 2
166 PRINT
170 INPUT "NAME OF BASIC STAR  ";S$(0)
175 INPUT "TIME (MIN)        ";T
180 INPUT "TELESCOPE DIRECTION ";F
185 INPUT "TELESCOPE ELEVATION ";H
195   N=0
200   N=N+1: IF S$(0)=S$(N) THEN 215
205 IF N=17 THEN 170
210   GOTO 200
215   D(0)=D(N)/G: B(0)=(B(N)-K*T*0.25)/G
220   X(1,I)=COS(D(0))*COS(B(0))
225   X(2,I)=COS(D(0))*SIN(B(0))
230   X(3,I)=SIN(D(0))
235   F=F/G: H=(H+Z3)/G:  GOSUB 750
240   Y(1,I)=Y(1,0): Y(2,I)=Y(2,0): Y(3,I)=Y(3,0)
245 NEXT I
250 REM
255   X(1,3)=X(2,1)*X(3,2)-X(3,1)*X(2,2)
260   X(2,3)=X(3,1)*X(1,2)-X(1,1)*X(3,2)
265   X(3,3)=X(1,1)*X(2,2)-X(2,1)*X(1,2)
270   A=SQR(X(1,3)^2+X(2,3)^2+X(3,3)^2)
275   FOR I=1 TO 3: X(I,3)=X(I,3)/A: NEXT I
280 REM
285   Y(1,3)=Y(2,1)*Y(3,2)-Y(3,1)*Y(2,2)
290   Y(2,3)=Y(3,1)*Y(1,2)-Y(1,1)*Y(3,2)
295   Y(3,3)=Y(1,1)*Y(2,2)-Y(2,1)*Y(1,2)
300   A=SQR(Y(1,3)^2+Y(2,3)^2+Y(3,3)^2)
305   FOR I=1 TO 3: Y(I,3)=Y(I,3)/A: NEXT I
310 REM
311 REM
315 REM   TRANSFORM MATRIX
320 FOR I=1 TO 3: FOR J=1 TO 3
325 V(I,J)=X(I,J)
330 NEXT J: NEXT I
335 GOSUB 650: E=W
340 REM
345 FOR M=1 TO 3: FOR I=1 TO 3: FOR J=1 TO 3
350   V(I,J)=X(I,J)
355   NEXT J: NEXT I
360 FOR N=1 TO 3
365   V(1,M)=0: V(2,M)=0: V(3,M)=0: V(N,M)=1
370   GOSUB 650: Q(M,N)=W/E
375 NEXT N
380 NEXT M
385 REM
390  FOR I=1 TO 3: FOR J=1 TO 3: R(I,J)=0: NEXT J: NEXT I
395  FOR I=1 TO 3: FOR J=1 TO 3: FOR L=1 TO 3
400    R(I,J)=R(I,J)+Y(I,L)*Q(L,J)
405  NEXT L: NEXT J: NEXT I
410 REM
415  FOR M=1 TO 3
420    FOR I=1 TO 3: FOR J=1 TO 3
425  V(I,J)=R(I,J)
430    NEXT J: NEXT I
435    GOSUB 650: E=W
440    FOR N=1 TO 3
445  V(1,M)=0: V(2,M)=0: V(3,M)=0: V(N,M)=1
450  GOSUB 650: Q(M,N)=W/E
455    NEXT N
460  NEXT M
461 REM
462 REM
465 REM       TRANSFORMATION
470 PRINT "     ------"
475 INPUT "OPTION 1 OR 2";E
480    IF E=2 THEN 570
482    IF E<>1 THEN 475
483 REM
485 REM   CONVERT EQUATORIAL --> TELESCOPE
490 INPUT  "  RIGHT ASCENSION (DEG) ";B(0)
495 INPUT  "  DECLINATION (DEG)     ";D(0)
500 INPUT  "  TIME (MIN)     ";T
505 D(0)=D(0)/G: B(0)=(B(0)-K*T*0.25)/G
510 X(1,1)=COS(D(0))*COS(B(0))
515 X(2,1)=COS(D(0))*SIN(B(0))
520 X(3,1)=SIN(D(0))
525 Y(1,1)=0: Y(2,1)=0: Y(3,1)=0
530 FOR I=1 TO 3: FOR J=1 TO 3
535   Y(I,1)=Y(I,1)+R(I,J)*X(J,1)
540 NEXT J: NEXT I
545 GOSUB 685: F=F/G: H=H/G: GOSUB 785
550 GOSUB 685: H=H-Z3
555 PRINT USING "TELESCOPE DIRECTION (DEG):####.##";F
560 PRINT USING "TELESCOPE ELEVATION (DEG):####.##";H
565 GOTO 465
566 REM
570 REM  CONVERT TELESCOPE --> EQUATORIAL
575 INPUT "  TELESCOPE DIRECTION (DEG) ";F
580 INPUT "  TELESCOPE ELEVATION (DEG) ";H
585 INPUT "  TIME (MIN)   ";T
590 F=F/G: H=(H+Z3)/G: GOSUB 750
595 X(1,1)=Y(1,0): X(2,1)=Y(2,0): X(3,1)=Y(3,0)
600 Y(1,1)=0: Y(2,1)=0: Y(3,1)=0
605   FOR I=1 TO 3: FOR J=1 TO 3
610 Y(I,1)=Y(I,1)+Q(I,J)*X(J,1)
615   NEXT J: NEXT I
620 GOSUB 685: F=F+K*T*0.25: F=F-INT(F/360)*360
625 PRINT USING "RIGHT ASCENSION (DEG):####.##";F
630 PRINT USING "DECLINATION (DEG):    ####.##";H
635 GOTO 465
640 END
645 REM
650 REM    DETERMINANT SUBROUTINE
655 W=V(1,1)*V(2,2)*V(3,3)+V(1,2)*V(2,3)*V(3,1)
660 W=W+V(1,3)*V(3,2)*V(2,1)
665 W=W-V(1,3)*V(2,2)*V(3,1)-V(1,1)*V(3,2)*V(2,3)
670 W=W-V(1,2)*V(2,1)*V(3,3)
675 RETURN
680 REM
685 REM    ANGLE SUBROUTINE
690 C=SQR(Y(1,1)*Y(1,1)+Y(2,1)*Y(2,1))
695 IF C=0 AND Y(3,1)>0 THEN H=90
700 IF C=0 AND Y(3,1)<0 THEN H=-90
705 IF C<>0 THEN H=ATN(Y(3,1)/C)*G
710 REM
715 IF C=0 THEN F=1000
720 IF C<>0 AND Y(1,1)=0 AND Y(2,1)>0 THEN F=90
725 IF C<>0 AND Y(1,1)=0 AND Y(2,1)<0 THEN F=270
730 IF Y(1,1)>0 THEN F=ATN(Y(2,1)/Y(1,1))*G
735 IF Y(1,1)<0 THEN F=ATN(Y(2,1)/Y(1,1))*G+180
740 F=F-INT(F/360)*360
745 RETURN
746 REM
750 REM       SUBROUTINE
755 Y(1,0)=COS(F)*COS(H)-SIN(F)*(Z2/G)
760   Y(1,0)=Y(1,0)+SIN(F)*SIN(H)*(Z1/G)
765 Y(2,0)=SIN(F)*COS(H)+COS(F)*(Z2/G)
770   Y(2,0)=Y(2,0)-COS(F)*SIN(H)*(Z1/G)
775 Y(3,0)=SIN(H)
780 RETURN
781 REM
785 REM       SUBROUTINE
790 Y(1,1)=COS(F)*COS(H)+SIN(F)*(Z2/G)
795   Y(1,1)=Y(1,1)-SIN(F)*SIN(H)*(Z1/G)
800 Y(2,1)=SIN(F)*COS(H)-COS(F)*(Z2/G)
805   Y(2,1)=Y(2,1)+COS(F)*SIN(H)*(Z1/G)
810 Y(3,1)=SIN(H)
815 RETURN
816 REM
817 REM   STAR LIST
820 DATA "A UMI",  37.960,  89.264
825 DATA "A TAU",  68.980,  16.509
830 DATA "B ORI",  78.634,  -8.202
835 DATA "A AUR",  79.172,  45.998
840 DATA "A ORI",  88.793,   7.407
845 DATA "A CMA", 101.287, -16.716
850 DATA "A GEM", 113.650,  31.888
855 DATA "A CMI", 114.825,   5.225
860 DATA "B GEM", 116.329,  28.026
865 DATA "A LEO", 152.093,  11.967
870 DATA "A VIR", 201.298, -11.161
875 DATA "A BOO", 213.915,  19.183
880 DATA "A SCO", 247.352, -26.432
885 DATA "A LYR", 279.234,  38.784
890 DATA "A AQL", 297.695,   8.868
895 DATA "A CYG", 310.358,  45.280
900 DATA "A PSA", 344.413, -29.622
1000 REM *****************************************
1010 REM    FROM SKY & TELESCOPE, FEBRUARY, 1989,
1020 REM    PAGES 194-196. LINES 760 AND 795
1030 REM    CONTAINED ERRORS AS PRINTED IN THE
1040 REM    MAGAZINE; THEY ARE CORRECTED HERE.

1050 REM ***************************************** 


  • jeremiah2229 likes this

#4 Jeff B1

Jeff B1

    Soyuz

  • -----
  • Posts: 3,575
  • Joined: 07 Mar 2014
  • Loc: South Central Florida

Posted 04 August 2019 - 07:18 AM

Man, GWBASIC goes back many Moons.  I started using it in the 1970’s because the FORTRAN compilers were crude and not readily available for PCs then.  PCs were also crude so I used the BASIC that came in DEC PDP11 computers I worked with on the job.  Then after several iterations of BASIC I settled on Visual Basic that still works well.  Guess it was the closest thing to FORTRAN.   Without a working GWBASIC compiler it will be difficult to troubleshoot that TAKI.BAS; however, it may work as a VBA module, so maybe someone that uses VBA can convert it and see how it works.


Edited by Jeff B1, 04 August 2019 - 07:19 AM.


#5 Jeff B1

Jeff B1

    Soyuz

  • -----
  • Posts: 3,575
  • Joined: 07 Mar 2014
  • Loc: South Central Florida

Posted 04 August 2019 - 12:59 PM

Here may be the answer:  http://www.takitoshi...hop/aim/aim.htm



#6 The_Vagabond

The_Vagabond

    Ranger 4

  • *****
  • topic starter
  • Posts: 336
  • Joined: 27 Oct 2008
  • Loc: Charlotte Hall, Maryland

Posted 04 August 2019 - 06:09 PM

Hey Jeff,

Yeah, I've already scoured Taki's site. At this point, I suspect that I might need to fire off an email to him (written to him before, he's a pretty friendly sort). The conversion process he's developed is pretty clever, and I'm looking at (perhaps) converting it to a spreadsheet to use in either my HP95LX or Psion Series 3. 
BASICA and Microsoft Tandy Model 100 BASIC 1.1 are also such fun. Same results, sadly. 



#7 lphilpot

lphilpot

    Vanguard

  • *****
  • Posts: 2,483
  • Joined: 15 Oct 2005
  • Loc: Central Lousiana, USA

Posted 04 August 2019 - 07:10 PM

Possibilities?

 

https://sourceforge....ojects/pcbasic/

 

https://www.thefreec...ers/basic.shtml

 

Or maybe install DOSbox and run it there?


  • The_Vagabond likes this

#8 jeremiah2229

jeremiah2229

    Surveyor 1

  • *****
  • Posts: 1,830
  • Joined: 25 Jul 2015
  • Loc: Illinois, USA N 37° W 89°

Posted 04 August 2019 - 07:40 PM

I ran the code in QBasic in a Dos virtual machine and it was stuck on the "Name of Basic Star", just reentered the procedure unending so apparently I am entering bogus data. TheVagabond if you would post here what you are entering I will use it here and try again. If I can find the error perhaps can easily port it to Lazarus and that will cross compile for several OSs.

 

 

Peace...



#9 lphilpot

lphilpot

    Vanguard

  • *****
  • Posts: 2,483
  • Joined: 15 Oct 2005
  • Loc: Central Lousiana, USA

Posted 04 August 2019 - 07:57 PM

It's been waaaay too long since I wrote / read any GWBASIC. I quickly moved on to QuickBASIC 4.5 then Basic PDS 7.1 in the late '80s / early '90s, before moving up to C.

 

Line 170? That (0) following the S$ input variable doesn't look quite right to my (very) foggy memory, but it could well be perfect BASIC -- and Toshimi Taki is waaaay smarter than me -- so it's probably correct, or means something else.



#10 TelescopeGreg

TelescopeGreg

    Skylab

  • -----
  • Posts: 4,438
  • Joined: 16 Jul 2018
  • Loc: Auburn, California, USA

Posted 04 August 2019 - 10:27 PM

It's been waaaay too long since I wrote / read any GWBASIC. I quickly moved on to QuickBASIC 4.5 then Basic PDS 7.1 in the late '80s / early '90s, before moving up to C.

 

Line 170? That (0) following the S$ input variable doesn't look quite right to my (very) foggy memory, but it could well be perfect BASIC -- and Toshimi Taki is waaaay smarter than me -- so it's probably correct, or means something else.

Not counting a couple of Basic Stamps, I haven't touched BASIC since, um, 1974?  So, kind of rusty here, too...

 

From context, it appears to be taking string input and putting it in the first string in the S$ array.  Later on (lines 195-205), they're trying to find that string among the data from the star list (lines 820-900), so you need to type it exactly as written ("A UMI", including case).  The star list is in the other 16 S$ strings.

 

What's odd is that they're treating S$ as an array of strings (i.e. 2-dimensions), but only have declared it as a single 17 character string.  Or at least, that's how I learned BASIC worked (HP's 2000 timeshare system, back in the 70's).  Easy edit, I suppose, if your version of BASIC chokes on it.  Perhaps DIM S$(17,5)?  {shrug}

 

The other dialect-specific syntax in this source is how it's putting multiple statements on a line. 

 

I never managed to get a copy of GWBASIC for my LX Palmtop, but it should be trivial to translate into another language for nearly any machine.  Is there a need?

 

Just don't try something really modern (Python), or it might have whiplash.  I can do C.  Anybody want to try LISP?

 

EDIT:  Perhaps try:  https://sourceforge....ojects/pcbasic/

 

EDIT**2:  lphilpot already suggested this...


Edited by TelescopeGreg, 04 August 2019 - 10:34 PM.

  • The_Vagabond likes this

#11 mich_al

mich_al

    Fly Me to the Moon

  • *****
  • Posts: 6,870
  • Joined: 10 May 2009
  • Loc: Rural central lower Michigan Yellow Skies

Posted 05 August 2019 - 09:37 AM

  Anybody want to try LISP?

It's been a while but I used to think it was fun, haven't heard it mentioned much.



#12 lphilpot

lphilpot

    Vanguard

  • *****
  • Posts: 2,483
  • Joined: 15 Oct 2005
  • Loc: Central Lousiana, USA

Posted 05 August 2019 - 10:32 PM

The other dialect-specific syntax in this source is how it's putting multiple statements on a line. 

IIRC, that was supported through PDS, by PowerBasic and several other dialects.

 

This might be of use to the OP: http://seed7.sourcef...rshots/bas7.htm    ...?

 

It supposedly supports GWBASIC code and can be built on a number of OSes:

 

Seed7 runs on the following operating systems:

 

Linux is supported with the following compilers:
gcc (the development is done using gcc under Linux)
clang
icc
tcc

 

Unix (I used Seed7 also under various Unix variants, so it is probably easy to port Seed7 to a Unix variant)
 

BSD (there is a FreeBSD port and an OpenBSD port)
 

Windows is supported with the following compilers:
MinGW GCC (the binary Windows release of Seed7 uses MinGW)
Cygwin GCC (the X11 graphics needs Cygwin/X)
clang
MSVC cl.exe (cl.exe is the stand-alone compiler of MSVC)
tcc
BDS bcc32.exe (bcc32.exe is the stand-alone compiler of the BDS)

 

DOS (uses DJGPP. Sockets, graphics, processes and databases are currently not supported)
 

Mac OS X is supported with the following compilers:
gcc
clang



#13 The_Vagabond

The_Vagabond

    Ranger 4

  • *****
  • topic starter
  • Posts: 336
  • Joined: 27 Oct 2008
  • Loc: Charlotte Hall, Maryland

Posted 08 August 2019 - 09:54 PM

I see this little topic took on a life of its own, and I had given up!

What's happening with my two TAKI attempts is that the results are way off. I've been deliberately choosing targets south of the celestial equator to check the accuracy, and what's happening is the declination is in positive numbers higher than 90°, and the right ascension is off by about 1 hr minimum. I've removed the code from the Tandy Model 102 to free up space, but the results were almost identical. 

I've reached the point where a BASICA install on the CF card is very tempting. I also have an Atari Portfolio and the PowerBASIC card for it. 

My programming days are far behind me, and I really wasn't that good to begin with, so in a way this is an exercise in futility. 

Also, apparently I am a place where old handhelds go to retire. 



#14 gregj888

gregj888

    Mercury-Atlas

  • -----
  • Posts: 2,824
  • Joined: 26 Mar 2006
  • Loc: Oregon

Posted 08 August 2019 - 10:32 PM

I went to sleep in 2019 and woke up in 1984...  Well that's better than the McMath that's time warped in the mid 70's :-)



#15 DAVIDG

DAVIDG

    Voyager 1

  • *****
  • Posts: 11,035
  • Joined: 02 Dec 2004
  • Loc: Hockessin, De

Posted 09 August 2019 - 04:35 PM

 Have you read the original article in Sky and Tel and are you entering the RA/DEC  and "telescope coordinates " in the correct decimal format and the correct orientation? The program is looking for  "Az" angle to be measured clockwise  like standard angles are measured and not like true Azimuth and RA is expressed in decimal degrees not hours and decimal  minutes  You also need to enter the time between each calibration star and then the present time that you want the program to calculate the "telescope coordinates" from the RA/DEC you enter for the object you want to observe.

 So the program first ask you for the name of one of the calibration stars.  ie  A UMI  as in alpha Ursa Major. You then center that star and enter the elevation and "Az" angle and a start time. You then move the scope to the second calibration star, enter the name and the angles of were the scope is pointed and the present time. The program is now calibrated from those four coordinates and the delta time   when you centered up the two stars and entered the data. Now you can either  tell the program what the " Telescope angles" that the telescope is point now    and the time and  it will convert that back into a true RA/DEC or you can enter the RA/DEC of an object you wish to observe and the time from when you calibrated the system and it will calculate the telescope angles to point the scope too so it is in the eyepiece. 

 Run the examples in the article and see if you get the same results. I think you  are entering the data wrong and that is why your getting the wrong results. 

 

 

I built my own digital setting circle system using Commadore C-64 and used the code without an issue.

Here is a link to the article https://archive.org/...02-cbr/page/n85

 

             - Dave  


Edited by DAVIDG, 09 August 2019 - 05:06 PM.

  • The_Vagabond and jeremiah2229 like this

#16 catalogman

catalogman

    Apollo

  • *****
  • Posts: 1,254
  • Joined: 25 Nov 2014

Posted 12 August 2019 - 11:31 AM

The OP's program is in Microsoft BASIC.

 

Download Decimal BASIC

 

http://hp.vector.co....008683/english/

 

and select

 

Option > Syntax > Microsoft BASIC compatible
<click OK>
Run > Run

 

To get the same results as the magazine article, change the mount error in line 155 of the OP's program to

 

155 Z1=-0.04: Z2=0.4: Z3=-1.63: REM  MOUNT ERROR, IF ANY <<<<<<<<<

 

The magazine article uses the wrong versions of lines 760 and 795.

 

The attachment below includes both the wrong version (to test the magazine programs) and the correct version.

Notice that there's very little difference in the output!

 

--catalogman

Attached Thumbnails

  • TAKI_wrong.JPG
  • TAKI_correct.JPG

Attached Files


  • jeremiah2229 likes this

#17 The_Vagabond

The_Vagabond

    Ranger 4

  • *****
  • topic starter
  • Posts: 336
  • Joined: 27 Oct 2008
  • Loc: Charlotte Hall, Maryland

Posted 16 August 2019 - 10:18 PM

Wow, this topic developed quite the life!

Been busy with this silly little thing called "life" of late, so haven't checked on this. Dave, I'm getting different results from different BASICS, none correct. As for your suggestion, at least the original article is at Archive dot Org, so I'll probably PDF the original instructions and go over them again, but near as I can tell, not really entering the data wrong. 

Catalogman, Decimal BASIC looks intriguing. The accompanying PARACT BASIC reminds me of MS BASIC for Macintosh, mid 1980's, or Locomotive BASIC for GEM. Sadly, moving beyond the realm of what I was hoping to accomplish, that being using my HP Palmtop in the field. 
According to Taki, there was a Palm OS implementation of TAKI.BAS out there. Being as I still have a few Palms (especially fond of my III's), might go that route, but you know how it is, we need to DIY to feel a sense of accomplishment coupled to abject failure. 
Thanks to all of you for making this quite the discussion.



#18 The_Vagabond

The_Vagabond

    Ranger 4

  • *****
  • topic starter
  • Posts: 336
  • Joined: 27 Oct 2008
  • Loc: Charlotte Hall, Maryland

Posted 19 August 2019 - 11:45 AM

Alright, I've been playing with it some more, and some numbers are starting to be correct, others not. 

One of the things I should have paid attention to in his example - he used Polaris (A UMI) as one of his two setting stars. The other was Capella. 
Using his example, I tested out the software, and yes, it worked. But, the moment I used it against the little planetarium program I've been using for the tests (actually a site, Star Atlas), I begin getting anomalous results again. However, if I set one of my two stars as Polaris, things smoothed out a bit. Now, the DEC is coming out correctly, whilst RA is a couple of hours (better than 30°) off. 

More tweaking, but I think we're heading in the right direction now.  




CNers have asked about a donation box for Cloudy Nights over the years, so here you go. Donation is not required by any means, so please enjoy your stay.


Recent Topics






Cloudy Nights LLC
Cloudy Nights Sponsor: Astronomics