Of Mice and Math Programs
|
Posted on 28 August 1998
The following text was written by S.T.L.: Why'd I choose that title? I don't know,
it sounded niftier than, "Of Mice and Math and Science Programs". Anyways, it's
late at night again, and I'm browsing through the ticalc.org archives. One thing I notice is
that there is a serious deficiency of math/science programs in general, and a waaaay serious
deficit of assembly math/science programs. Well, I know they can't be as popular as games,
but they sure are darn useful. So, the basic idea of this article is that: Some changes need
to be made in the way math/science programs are conceived and written. Let me take
the TI-85 TI-Basic Math program Diviz as an example. It tests numbers to see if they're
prime. The author writes: "But this one is the fastest I've seen." Well, it's not that fast
at all. (No offense intended to the programmer, it's great he wrote a math program.) The
process Diviz uses is Baby Trial Divide. Without going into serious mathematical language
here, there exists a better process called Wheel Factorization. Had the author studied
Number Theory (the area of math involved with primes and such) a little, he'd at least know
about that. It's pretty simple, I implemented it on my TI-85. There are of course even
better things, but they can't be done on a TI-85. This example of deficient programming
isn't restricted to one program. There are some triangle solving programs there, and some of
them (all of them?) don't seem to know of the Law of Cosines, which would let them solve
more triangles. It's also pretty simple, I implemented it on my TI-85. Now, let's
talk about Periodic Table programs. I *used* to have one on my TI-85. I also can't program
one, since I'm assembly-illiterate. Yet I deleted it. Why? Because I do some heavy-duty work
with chemistry, and I'm a precision fanatic. I want as much precision in the atomic masses
as I can get. Thus I've gone back to using a paper table. *If* a TI-85 program that had 7+
decimal precision for atomic masses came out, it would be really useful. Now, all
this has led me to the opinion that math/science programmers have to know the subject
they're doing in detail before they write a program, so that it is as detailed, as
efficient, and as useful as possible. For example, I'm not bothering to upload my program
TRI, because anyone can hack up that sort of thing in TI-BASIC, and may even be better than
mine. I'm also probably not going to upload my program PRIME2. Why? Though it's pretty
speedy for a TI-85, for the TI-92, there's something infinitely better that I couldn't ever
make by myself. The TI-92 Number Theory library, the NTH, can be found at
http://home1.gte.net/paulp/nth/ Now, I think ticalc.org should have a link to that. :-D
So, what's this all mean? Well, I've got some opinions on that. Namely:
- There need to be more math and science programs (both TI-BASIC and assembly) for all the
TI calculators. (Granted, some cannot support the heavy-duty math sometimes required, as in
the NTH. No other calculator (except the TI-89) could support that.)
- A programmer
writing math/science should get to know the subject in detail, to make a program that has
many useful features.
- Also, a programmer writing math/science should go to extremes to
provide precision. (This mostly applies to science. I refuse to use a Periodic Table that
gives Oxygen a mass of 16. I'll consider using a Periodic Table that gives Oxygen a mass of
15.9994.)
- A programmer writing math/science should get to know ways to implement the
algorithms needed, in detail, to make an efficient and quick program. (This mostly applies
to math.) If game programmers spend sleepless nights to speed up their games and shave off
11 bytes, then so can math/science programmers.
- Also, programs should be written so that
they can be used as sub-programs, with no or little modification. For the case of the TI-92
(and 89) they should come in Function format, too. (This mostly applies to math programs. I
did this for my program PRIME2, transforming it into PRIME3.)
- Programs should be made
for really complicated things. Now, while programs that do (say) quadratic equations are
useful in their own right for some/most people, there also exists a need for heavy-duty math
and science. (Probably the NTH is the first attempt at this that I've seen. A look at the
ticalc.org archives shows that most TI-BASIC math programs are for a 8th grade Algebra I
audience. And the TI-BASIC science programs are for a medium high school level. And the
assembly programs are few and far between.)
Well, anyone else have other
suggestions?
|
|
Reply to this item
|
Re: Article: "Of Mice and Math Programs"
|
Kevin Uhlenhaker
|
Well here is my two cents. I do think that more people should post there math programs but, like me most people never get around to it. Also I write my programs for fun and not for money. If I do not like a program that I download I change it to suit my needs or I do not use it. Finally, all of the "advanced math" you people are trying do on the TI-85 and saying it can not do it, I wonder why? It is only one of the oldest graphing calculators that TI makes. Go and buy the TI-89 I got mine two days ago it is great.
|
Reply to this comment
|
30 August 1998, 06:34 GMT
|
|
Re: Article: "Of Mice and Math Programs"
|
Chris Weasel Edwards
(Web Page)
|
Here's an idea for article writers and others to consider: don't tell programmers what to do unless you're paying them or they ask you. That's all I care about in this argument.
|
Reply to this comment
|
30 August 1998, 19:39 GMT
|
|
Re: Article: "Of Mice and Math Programs"
|
Justin Van Winkle
(Web Page)
|
I'm about half finished with a physics program, but I don't have access to a physics book any longer. If someone wants to help me out, email me. Also, Requests are VERY welcome. The program has every equation i've come across, if you would like a specific equation included, drop me an email.
|
Reply to this comment
|
30 August 1998, 19:53 GMT
|
|
Re: Article: "Of Mice and Math Programs"
|
S.T.L.
(Web Page)
|
Yeah. Kewl. Okay! (A copy of this has been sent by Email to Tim).
My PRIME2 factored that baby in 10 minutes flat. Its first factor is 55511. Its second factor is 314159. Both of those turn out to be prime. You may be surprised to know that your algorith "divide by two then by the odds" is nothing other than Baby Trial Divide. :-D Thus my Wheel Factorization, or Enhanced Trial Divide, as I call it, is over 2x faster.
Right now, I can't think about trig, I like calc more.... so:
You should add "solid of revolution" to your calc program. You should add "length of an arc" to your calc program. By the way, the TI-85 has a builtin function for the length of an arc. I also can't remember synthetic division. Uh oh.
Okay, now for the long-held secret of Wheel Factorization. (Your program actually does this, but in the lowest case, so I don't count it as such.) I'm posting this to the Comments so everyone can learn this:
Let's begin with the simple case, that you use. Hope you know what mod is!
All primes are congruent to 1, mod 2, except for 2 itself. Thus you can divide by 2 (taking note if the number IS 2), and then by all the numbers that are congruent to 1, mod 2. I.E. The odd numbers.
All primes are congruent to 1 or 5, mod 6, except for 2 and 3. Thus you can divide by 2 and 3 (taking note if the number IS 2 or 3) and then by all the numbers that are congruent to 1 or 5, mod 6. Thus 5,7,11,13, and so on. (Notice how not ONLY do you skip the evens there, you skip all the multiples of 3! Right arm! Farm out!)
All primes are congruent to 1,7,11,13,17,19,23,29, mod 30, except for 2,3,and 5. Thus you can divide by 2,3,and 5 (taking note if the number IS blah blah) and then by all the numbers that are congruent to 1,7,11,13,17,19,23,29, mod 30. Now you're skipping a whole load of numbers. Right arm!
Now, to show you exactly WHAT the heck is going on here, take the special case of 2 and 5.
All primes are congruent to 1,3,7,9 mod 10. Thus you can divide by 2 and 5 (taking note blah blah) and then by all the numbers that are congruent to 1,3,7,9 mod 10. This is simply the "last digit" of the number.
If we keep all the primes in order (like 30=2*3*5) then the "congruent" thing will always be primes, you can see the pattern for yourself. With 2 and 5, 3 has been skipped, and you MUST allow the 9 mod 10 in there. (cause 19 = 9 mod 10). The obvious next case is 210, but I didn't have time to implement that in my PRIME2. PRIME2 should be up by now. If it isn't, it will be soon. It uses the mod 30 case.
:-D
STL
|
Reply to this comment
|
30 August 1998, 20:09 GMT
|
|
|
|
|
Re: Re: Article: "Of Mice and Math Programs"
|
snb
|
That is known as the sieve of Eratosthenes, created by Eratosthenes of Cyrene, an ancient Greek mathematician. Give it the proper name seeing as you are in all these advanced math classes, Mrs. Rant.
A better, simpler way to state it is as follows:
Remove multiples of all primes less than or equal to the square root of n to get all the prime numbers.
start with 2, remove 2(2), 3(2), 4(2), 5(2)...then go to 3: remove 2(3), 3(3), 4(3), 5(3)...then do 5 and 7 etc.
|
Reply to this comment
|
9 March 2003, 18:45 GMT
|
|
Re: Article: "Of Mice and Math Programs"
|
SR
|
I agree that there is a serious lack of good math programs for the ti-85 and ti-92. I have both calcs and haven't seen a math program worthy of keeping on my calc. In fustration I bought a Hp48GX and and it was the best thing I ever did. The Hp48 GX has a tremendous amount of math and science related programs (much of which is avialable at http://hp48.ml.org/ ) and the rpl programing language makes it easy to make your own math programs. In addition to the great math and science programs that are availble for the hp48GX there are numerous well written text, data, and spreed sheet editors (that are compatible with pc spreedsheet programs that exept a tabulated text input file).
|
Reply to this comment
|
30 August 1998, 22:18 GMT
|
|
Re: Article: "Of Mice and Math Programs"
|
me again
|
Well, it seems your article has gotten a pretty big response. Has anyone else noticed the sudden increase in math/science programs?
|
Reply to this comment
|
30 August 1998, 23:12 GMT
|
|
|
|
|
Re: Re: Article: "Of Mice and Math Programs"
|
S.T.L.
(Web Page)
|
Yes, I was surprised. I thought that because this article was more specialized, more "nerdy", that it would get a smaller response than the first. Yet they got about equal response. *hmmm* Anyways, I'm pleasantly surprised. My next article has been written, but because of a bug, I'm going to revise it so it's under 8K. Again, I expect a smaller response, but who knows? :-D Ah, I'm happy just when I write them.
|
Reply to this comment
|
31 August 1998, 05:50 GMT
|
|
Re: Article: "Of Mice and Math Programs"
|
Momaw Nadon
(Web Page)
|
If any one wants to know, there ARE people who develop math and science programs. I do. While I may not put out programs and functions very fast, I have a job (maybe some people have heard of this?) and cannot spend all day just...how was that? "shaving off 11 bytest"?
If anyone has any ideas for math-related programs, let me know. I'll be more than happy to help you develop it, or do it myself in my free time.
|
Reply to this comment
|
31 August 1998, 21:26 GMT
|
|
Re: Of Mice and Math Programs
|
Thinker1984
|
Woe! Woe to those helpless people who might actually have to do the work themselves instead of relying upon the benevolence of a programmer who has better things to do with his/her time! Oh, please! No offense, but:
1. People should be doing the work themselves anyway,
so who cares?
2. Actually, there are plenty of good programs out
there. For example, I have written nth degree
synthetic division and rational zero test programs.
No, they're not up here on ticalc.org yet, but my
point remains.
|
Reply to this comment
|
22 December 1999, 07:43 GMT
|
|
Re: Of Mice and Math Programs
|
Niten
|
As a member of my school's math team, I write plenty of useful math programs, especially on the 89. I currently have written a converter for bases between 2 and 36, a polygon area finder (for any convex polygon with given coordinates entered in any order it will evaluate the area, or will let you know if the polygon is not convex; after finding the area it can draw the polygon for you on the graph screen), a draw function (enter just about any equation, such as the general form of a conics plot, etc.., and it will graph it for you), some prime number-related stuff, and things of that nature.
However, they are generally only other members of our math team that use these programs, certainly not because they can't do these things on their own, but only because my programs do it a bit faster. In my opinion, these programs belong to our team, and they are not the kinds of things I would like to give any chance at working against us by making them available to rival schools. So I do not post them.
I have a feeling this may be true for other math programmers...
|
Reply to this comment
|
10 March 2000, 22:18 GMT
|
|
Re: Article: "Of Mice and Math Programs"
|
AWM
|
I agree that there are not enough math and science programs. My AP Calc teacher and I have made a few good programs for Calculus. Though they are not availible on the internet they can be obtained through me. Most of these programs will run on a 85 or 86. Integraf--A program that Integrates by graphing (LRSUM,RRSUM,MRSUM,TRAP,SIMP). Plus others.
|
Reply to this comment
|
22 November 1998, 02:14 GMT
|
|
Re: Of Mice and Math Programs
|
Abs S
|
I know this is off topic but I don't know where else to put this. Is there a program for the TI-86 that can factor like the TI-89 or TI-92? Onw of my friends has a TI-92 and al he has to do is put in the factor program and then type x2-7x+28 and it'll give him the answer in this form: (x- )(x- ). He can type anything he wants and it'll give him the answer. If anyone has a program like this please e-mail me. Thanks
|
Reply to this comment
|
2 April 2001, 22:20 GMT
|
|
Re: Of Mice and Math Programs
|
snb
|
Dear Mr. Precision Fanatic,
To how many decimal places do you write pi to in math?
A. 5 million
B. 10 million
C. 15 million
D. 20 million
:-)> bearded man
|
Reply to this comment
|
24 March 2002, 22:09 GMT
|
|
1 2 3 4 5
You can change the number of comments per page in Account Preferences.
|