I'm now working in ICE, should I also make a TI-BASIC version?
definitely!
 35%  [ 5 ]
Absolutely not!
 14%  [ 2 ]
Just make the main version in TI-BASIC!
 50%  [ 7 ]
Total Votes : 14

What do you mean?
(I'm very new to working with and programming for the calculator)

The output is already stored in str9 as weekday and in W as number.
stbradley

I was looking at the program you posted above and thought the calculations looked familiar. I compared it to a program I wrote long ago that had a similar calculation to compute the Julian Day number from a calendar date. Even some of the variable names were the same. It was for an Astronomy program I wrote. I used the example calculations from the book Astronomical Algorithms by Jean Meeus. I was just wondering if you also had a copy of that book. Itís filled with a lot of calculations used for computing the positions of the planets and moons and other astronomical events for different dates, past or future. One chapter (8 pages) explained the use of Julian dates and how to calculate them with several examples. I find the book very interesting, but then I like books with a lot of calculations in them.
stbradley wrote:
ClrHome
Disp "ENTER DATE AS"
Input "(MMDD:YYYY):",G
iPart(abs(G)/100)→M
iPart(abs(G)-M*100)→D
fPart(G)*10000→Y
If M≤2:Then
(Y-1)→Y
(M+12)→M
End
If ((Y=1582) and (M=10)) and (D>4 and D<15):4→D
If (Y>1582) or (Y=1582 and M>10) or (Y=1582 and M=10 and D≥15):Then
int(Y/100)→A
(2-A+int(A/4))→B
Else
0→B
End
remainder(int(365.25(Y+4716))+int(30.6001(M+1))+D+B-1523,7)→θ
Disp θ
Return

You should use code tags Wink
I went ahead and golfed it down a little bit. I'm sure there's still a few more optimizations that I haven't added

Code:
ClrHome
Disp "ENTER DATE AS
Input "(MMDD:YYYY):",G
iPart(sub(abs(G→M
iPart(abs(G)-|E2M→D
|E4fPart(G→Y
If M≤2:Then
Y-1→Y
M+12→M
End
If Y=1582 and M=10 and D>4 and D<15:4→D
2→A
If Y>1582 or (Y=1582 and 10.15≤M+sub(D
int(sub(Y→A
remainder(int(365.25(Y+4716))+int(30.6001(M+1))+D-A+int(A/4)-1521,7


If the last line is value-returning, it will be displayed.
You don't need to close your parentheses.
You have a couple rare opportunities to use the sub() command to divide by 100 (sub(A) will return A/100)
Also 2-A+int(A/4) will be 0 if A=2, so you can use that to shrink down the code a little.
Greetings

dave1707 wrote:


I was looking at the program you posted above and thought the calculations looked familiar. I compared it to a program I wrote long ago that had a similar calculation to compute the Julian Day number from a calendar date. Even some of the variable names were the same. It was for an Astronomy program I wrote. I used the example calculations from the book Astronomical Algorithms by Jean Meeus. I was just wondering if you also had a copy of that book.

You are correct and have a good memory and yes I was lazy and used the same variables as are in that book because it is easier to debug. I almost pulled that calculation from Meeus' other book Astronomical Formula for calculators which uses a slightly different method. I have a rather large collection of textbooks and papers that deal with the subject of astronomical calculations which I find interesting.

If you like this sort of thing you may be interested in a C library I wrote called The Astronomical Papers Library (APL). It can be downloaded from SourceForge
https://sourceforge.net/projects/astronomicalpap/

mr womp womp: Cool. I spend the majority of my programming time writing C programs so I'm used to strict C syntax rules which carries over to my TI-BASIC. I only consider myself an average TI-BASIC programmer and have only read Kerm Martian's book once 4 or 5 years ago so I don't recall all the shortcuts. However, I would be interested in any other ways you might come up with to squeeze down my code as I find this interesting.
I've just changed stuff in the 'lite' version of the program, so now it is only 1,6KB!
I just hope that everything still works as it should...
And with this change, I might also be able to bring down the file size of the normal BASIC version, if I there make the same change, but I'll have to look at that later.
You can find it on the beta branch on the Github repository (https://github.com/PrivacyDragon/Day-of-Week-TI-84Plus-CE/tree/beta)
stbradley;

I downloaded your APL code. Itís written in C so I probably wonít do anything with the code except look thru it. I used C by profession for many, many years, but Iím retired now and code on the iPad using Lua. I have several astronomy programs on the iPad along with hundreds of other programs that I wrote just for kicks. I have several books on astronomy and orbit calculations that Iíve had for many years. My first astronomy program was written in basic on an Apple II and was published in the Micro magazine back in 1980. I had other programs that were in Byte magazine and in the AppleSoft books. I have several TI calculators that I code on every now and then, but they donít come close to the ease of the iPad. I recently got an iPhone and was able to copy all my programs to it (600+). I can write Lua code on the iPhone, but the screen is really small compared to the iPad.

Privacy_Dragon;

Sorry for posting something different in your discussion.
I learn actually more from this project than I expected at first!
There were so many exceptions of countries that switched...
There are areas that switched to the Gregorian calendar and later changed back to Julian, and thereafter again to Gregorian. ..
One country also changed side of the international dateline when they switched to the Gregorian calendar, so the change was one day less than normal...
Then there is Sweden and Finland, they used several years another calendar with the goal to gradually switch to Gregorian calendar, but they forgot something some years so it didn't work. Then they switched back to Julian calendar and later switched to Gregorian calendar. ..
Then there is Turkey, there they switched to the Gregorian calendar, but still did something different for a time...
This project is a little bit cursed...
Yesterday I found out still the small (beta) version had big problems and it was actually hard to fix those...
But now I have something again and I really hope that it hasn't bugs anymore...

Today I'll ask my standard betatester for this program to test it...
Privacy_Dragon wrote:
This project is a little bit cursed...
Yesterday I found out still the small (beta) version had big problems and it was actually hard to fix those...
But now I have something again and I really hope that it hasn't bugs anymore...

Today I'll ask my standard betatester for this program to test it...


Will that affect the Organizer at all? Could you test it out to make sure I got it working right?
https://www.cemetech.net/downloads/files/2025/x2177
RoccoLox Programs wrote:

Will that affect the Organizer at all? Could you test it out to make sure I got it working right?
https://www.cemetech.net/downloads/files/2025/x2177

Sadly, yes...
I've looked at it this morning, and very sadly the organizer has the problems of this too...
I hope to receive feedback today or tomorrow from my betatester, since I've today given him the newest beta version.
But I have found where the problem was, so I hope it's now fixed, but until I've had that confirmed I don't dare to say that for sure.
But it's only with the julian dates.
Privacy_Dragon wrote:

Sadly, yes...
I've looked at it this morning, and very sadly the organizer has the problems of this too...
I hope to receive feedback today or tomorrow from my betatester, since I've today given him the newest beta version.
But I have found where the problem was, so I hope it's now fixed, but until I've had that confirmed I don't dare to say that for sure.
But it's only with the julian dates.

Darn. Sad Please send me the fixed version ASAP.
I'll be working hard on it today during the moments I can find time.
(Maybe during some boring lessons won't be a good idea though...)
And as soon as I've got it ready and working and correct.., I'll send it !
I've fixed it! Smile
Later today when I'm home I'll send it!
(I was working to fix this when travelling to school with the bus: seeing that the next bus is already about to go so having to run with bag and calculator in one hand, calculator case and phone in the other... I think that looked strange...)
The small version of the day of week program is uploaded!
You can download it Here!
Privacy_Dragon wrote:
The small version of the day of week program is uploaded!
You can download it Here!

Thank you very much Privacy_Dragon! I'll be putting that into the next version of the Organizer.
Privacy_Dragon wrote:
I still have to make it possible to set when your specific country changed to the Gregorian calendar, and maybe I'll make a option to set the date notation (YYYY/MM/DD - DD/MM/YYYY.......) but every time I tried that before, I got my program not working anymore...
Can that happen if you use too much Goto commands?


So in other words, you made a program that allows you to get a Julian date of week instead of the proleptic Gregorian date?
The idea is that you can let the program calculate the day of week even for dates when the Julian calendar was used, by setting the date it changed for you.
So yes, you can also let all dates be Julian, by setting the changing date somewhere in the future.
I have now also ported this to the TI-nspire!
And I have included a port of the date converter program I made!



  
Register to Join the Conversation
Have your own thoughts to add to this or any other topic? Want to ask a question, offer a suggestion, share your own programs and projects, upload a file to the file archives, get help with calculator and computer programming, or simply chat with like-minded coders and tech and calculator enthusiasts via the site-wide AJAX SAX widget? Registration for a free Cemetech account only takes a minute.

» Go to Registration page
Page 3 of 3
» All times are GMT - 5 Hours
 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

 

Advertisement