-
Content Count
4,690 -
Joined
-
Last visited
-
Days Won
2
Content Type
Profiles
Member Map
Forums
Blogs
Gallery
Calendar
Store
Everything posted by Vorticon
-
I'm interested.
-
I would love to see that RND algorithm. Here's Picalc's XB source: 10 REM PI CALCULATOR 20 REM BY WALID MAALOULI 30 REM AUGUST 2007 40 REM 100 CALL CLEAR 110 OPTION BASE 1 120 DIM SUM(652),SUM1(652),TERM(652),TEMP(652) 130 DISPLAY AT(1,8):"Pi Calculator" :: DISPLAY AT(3,6):"By Walid Maalouli" :: DISPLAY AT(5,9):"August 2007" 140 DISPLAY AT(10,2)BEEP:"# of decimals (mult. of 8)" :: DISPLAY AT(11,2):"(Maximum of 5200 decimals)" :: ACCEPT AT(13,12)VALIDATE(DIGIT):D 150 IF D>5200 THEN 140 160 ITR=INT(D/1.4) :: D=INT(D/8)+2 170 SUM(1)=3 :: SUM(2)=20000000 :: TERM(1)=0 :: TERM(2)=20000000 :: S=0 :: DENOM1=3 :: TBASE=25 :: MULT=16 180 FOR N=1 TO ITR+1 190 IF FLAG=0 THEN DISPLAY AT(20,5):"Term 1 iteration #";N;" " ELSE DISPLAY AT(20,5):"Term 2 iteration #";N;" " 200 IF N=1 THEN 220 210 FOR I=1 TO D :: TERM(I)=TEMP(I) :: NEXT I 220 DENOM=TBASE :: REMAINDER=0 230 GOSUB 1050 240 FOR I=1 TO D :: TEMP(I)=TERM(I) :: NEXT I 250 DENOM=DENOM1 :: REMAINDER=0 260 GOSUB 1050 270 FOR I=1 TO D 280 IF S=0 THEN 300 290 SUM(I)=SUM(I)+MULT*TERM(I) :: GOTO 310 300 SUM(I)=SUM(I)-MULT*TERM(I) 310 NEXT I 320 IF S=0 THEN S=1 ELSE S=0 330 FOR I=D TO 2 STEP-1 340 IF SUM(I)>=100000000 THEN 350 ELSE IF SUM(I)<0 THEN 390 ELSE 420 350 QUOTIENT=INT(SUM(I)/100000000) 360 SUM(I)=SUM(I)-QUOTIENT*100000000 370 SUM(I-1)=SUM(I-1)+QUOTIENT 380 GOTO 420 390 QUOTIENT=INT(SUM(I)/100000000)+1 400 SUM(I)=SUM(I)-(QUOTIENT-1)*100000000 410 SUM(I-1)=SUM(I-1)+QUOTIENT-1 420 NEXT I 430 IF FLAG=2 THEN 680 440 DENOM1=DENOM1+2 450 NEXT N 460 IF FLAG=1 THEN 620 470 TBASE=57121 :: DENOM1=3 :: MULT=4 480 FOR I=1 TO D 490 SUM1(I)=SUM(I) 500 SUM(I)=0 :: TERM(I)=0 510 NEXT I 520 TERM(1)=4 530 DENOM=239 :: REMAINDER=0 540 GOSUB 1050 550 FOR I=1 TO D 560 SUM(I)=TERM(I) :: TERM(I)=0 570 NEXT I 580 DENOM=239 :: TERM(1)=1 :: REMAINDER=0 590 GOSUB 1050 600 FLAG=1 :: S=0 610 GOTO 180 620 PRINT :: PRINT "Finalizing calculations..." :: PRINT 630 FOR I=1 TO D 640 SUM1(I)=SUM1(I)-SUM(I) :: SUM(I)=SUM1(I) 650 NEXT I 660 FLAG=2 670 GOTO 330 680 CALL CLEAR :: DISPLAY AT(2,3)BEEP:"Calculations complete!" 690 DISPLAY AT(5,3):"Send results to:" :: DISPLAY AT(8,5):"1- Screen" :: DISPLAY AT(10,5):"2- Printer (PIO)" :: DISPLAY AT(12,5):"3- File" 700 CALL KEY(0,K,ST) :: IF ST=0 THEN 700 710 IF K<49 OR K>51 THEN 700 720 ON K-48 GOTO 730,860,950 730 CALL CLEAR :: PRINT "Pi=3." 740 FOR I=2 TO D-1 750 SUM$=STR$(SUM(I)) 760 IF LEN(SUM$)=8 THEN 780 770 SUM$="0"&SUM$ :: GOTO 760 780 PRINT SUM$;" "; 790 L=L+1 :: IF L=64 THEN 800 ELSE 830 800 PRINT :: PRINT :: DISPLAY AT(24,1)BEEP:"Press any key to continue" :: L=0 810 CALL KEY(0,K,ST) :: IF ST=0 THEN 810 820 CALL CLEAR 830 NEXT I 840 PRINT :: PRINT :: DISPLAY AT(24,1)BEEP:"End. Press any key to exit" 850 CALL KEY(0,K,ST) :: IF ST=0 THEN 850 ELSE STOP 860 OPEN #1:"PIO" 870 PRINT #1:"Pi=3." 880 FOR I=2 TO D-1 890 SUM$=STR$(SUM(I)) 900 IF LEN(SUM$)=8 THEN 920 910 SUM$="0"&SUM$ :: GOTO 900 920 PRINT #1:SUM$;" "; 930 NEXT I 940 CLOSE #1 :: END 950 DISPLAY AT(22,1)BEEP:"Enter path.filename:" :: ACCEPT AT(24,1):FL$ 960 OPEN #1:FL$,OUTPUT,VARIABLE 80 970 PRINT #1:"Pi=3." 980 FOR I=2 TO D-1 990 SUM$=STR$(SUM(I)) 1000 IF LEN(SUM$)=8 THEN 1020 1010 SUM$="0"&SUM$ :: GOTO 1000 1020 PRINT #1:SUM$;" "; 1030 NEXT I 1040 CLOSE #1 :: END 1050 REM DIVIDE SUBROUTINE 1060 FOR I=1 TO D 1070 DIVIDEND=REMAINDER*100000000+TERM(I) 1080 TERM(I)=INT(DIVIDEND/DENOM) 1090 REMAINDER=DIVIDEND-TERM(I)*DENOM 1100 NEXT I 1110 RETURN
-
Interesting... So the TI Basic RND function is sub-optimal... Learn something every day.
-
Yes I get it. Nicely done! So MLC's RND function only returns integers 0-4095? That's an interesting choice I have not seen before. Why is that? Unfortunately, your method cannot be converted to XB without some contortions given the differences in RND returns, which will defeat the potential speed benefit... Perhaps you should consider converting Picalc to MLC!
-
While clearly you are using the same concept as the XB one, I'm not able to quite understand the algorithm which is impressively fast because of my unfamiliarity with MLC. Would you mind expanding on it a bit?
-
So that's interesting. In my previous trials, I had been using RXB. On a hunch, I tried it with standard XB for 200,000 iterations and I got Pi = 3.1482, a much better result. Is the RND function of RXB different from XB? Also regarding Picalc, I dug up my documentation on it and I used Machin's formula which is Pi = 16 * arctan(1/5) - 4 * arctan(1/239) Fred Kaal did some speed comparisons for 100 decimals in August 2007 which he posted on the old Yahoo listserve: Geneve: ExBasic = 7min 32sec, C99 = 30 seconds TI 99/4A: ExBasic = 13min 51sec, C99 = 1min 16sec I'm seriously thinking about creating versions for Pascal and assembly just for kicks In case you want to look over the XB or C99 code, here's the disk which is also found on the tigameshelf.net site under Edutainment Picalc.dsk
-
Very nice Guillaume! While there is no execution speed difference between the packed and unpacked statements, the original listing is slower by 15 seconds over 200 iterations, which translates into about 4.2hrs over 200,000 iterations! I'm going to use this for a 1 million iterations trial
-
It's the journey my friend
-
Pi = 3.17322 with 134000 iterations.... So it appears that a larger number of iterations is going to be needed How about 1 million? By the way, if anyone wants to give it a shot as well, it is best to delete line 80 because printing to the screen slows things down significantly. More to come!
-
So it took about 14.5 hrs to complete 200,000 iterations, and I got Pi = 3.17228, whereas Dewdney got 3.14137 with 134,000 iterations. Hmmmm... My result is much worse than his even with a larger number of iterations, and I wonder if the randomizing function is to blame here... There is an important fact to mention here though: Dewdney had asked readers to send in runs of 1000 and he got 134 runs returned, and he averaged the combined result. Most likely each reader used a different machine with a different randomizing function although I can't imagine it should make much of a difference... I'm going to do another run to match Dewdney's 134,000 iterations and see what I get.
-
Here's an interesting way to approximate Pi taken from A.K. Dewdney's book "The Armchair Universe" from 1988: Assume a square field with a circle within it which touches all 4 sides of the square representing a pond in a cartesian field. The origin of the field is (0,0) and is the center of the pond, with (1,1) being the northeastern corner of the field. Fire a cannon randomly at the field n times, count the number of shots that land in the pond np, and calculate API=(n/np)*4. The result should be a very rough approximation of Pi. To get anywhere close though, n should be at least 100,000. However, the number of iterations required to get successive decimals of pi grows exponentially, and you probably will need something around 4 billion tries to get the first 4 decimals right! Here's the very short program: 10 CALL CLEAR 20 RANDOMIZE 30 INPUT "NUMBER OF TRIES? ":N 40 FOR I=1 TO N 50 X=RND::Y=RND 60 D=SQR(X^2+Y^2) 70 IF D<=1 THEN TOTAL=TOTAL+1 80 PRINT "ITERATION # ";I 90 NEXT I 100 API=(TOTAL/N)*4 110 PRINT "APPROXIMATE PI=";API 120 END I set up the program to run 200000 iterations on my TI before I left for work today and we'll see what I have when I get back
-
That would not be trivial given that the SAMS memory is accessible only in 4K chunks. Theoretically, you should be able to calculate over 166,000 decimals with it using Picalc's algorithm.😳
-
Happy birthday Pi!
-
Excellent! Please put me on the list for one should you ever decide to make a run.
-
Nice work guys! Question: is the full Hexbus spec implemented or just saving and loading functionality? For example, can you list a program to the SD card for later viewing or printing? How about sequential or random file access from within a running Basic program? Can the SD card be read by a computer or is it in a proprietary format?
-
Great! Will you be sharing your design and software? Perhaps a video demonstrating its function? I would love to replicate your project for my CC40.
-
I'm not sure this is a valid assumption. After all this is a retro forum dealing with a prehistoric computer system that is anything but straightforward in operation or set up, and I don't see too many "overcharged" people wildly running around tearing their hair out and screaming hysterically. Given the context, IMHO, I think most users will be just fine entering a couple or so text commands at a command prompt 😁
-
No, Mame runs a TI 99/4A emulator. See here
-
Doesn't MAME run on the Pi? If it does then you have there a full-featured emulator for the TI that is indeed continuously maintained thanks to mizapf. Problem solved
-
Electronics Help Need with CC-40 Memory Upgrade
Vorticon replied to dhe's topic in TI-99/4A Development
It's likely bad chips. I've had that issue myself. -
Well I suppose it's all moot now with HDX and TIDir
-
Does the program support the standard TI disk controller? The docs make no mention of it. I can see how this would have been a very useful program in its day. One could be working on a report at work and then come home and continue the project on the TI. Same with spreadsheet data...
-
Got it, even though I have not had desktop resizing issues on my end without them. I'll install them.
-
Using the switch -video auto did the trick. Thanks. Should I install the guest additions though? I thought they were primarily needed for access to the host computer from virtualbox...
-
I'm getting these errors when attempting to start the 99/8 emulation under Ubuntu. Any thoughts?
