CodeWalrus Website => Game, Software and Music Downloads => Programs and Utilities => Topic started by: E37 on July 28, 2016, 02:37:56 pm

Title: [ti-83+/84+] Solver
Post by: E37 on July 28, 2016, 02:37:56 pm
I made Solver to help with math. Duh.
It can, in reality do a lot of other things.

It allows the user to type in commands in the homescreen of the calc.
Here is a complete (I think) list of the functions:

Command - function - comments
PING - Displays "PONG!" - not really useful but can be used to check if it is installed
XON - none - turns the axes on
XOFF - none - what do you think?
TRACE - uses the Trace command - my calc's trace key broke so I added this to help
RAD - none - sets the mode to radians
DEG - none - what do you think?
*something*=*somethingElse* - solutions - solves the equation for the first variable (from the left) returns up to 999 solutions. See below for more detailed description.
*something*==*somethingElse* - 1 or 0 - tests for equality (one if *something* = *somethingElse* zero if not) this is the same as the standard single = test
Y=*equ* - "Sent" if sent and "Failed!" if none are free -sends *equ* to the first empty Y= space. See below

KILL - none - crashes the calc, resets the RAM, and turns the calc off
prgm*programName* - runs the program - if basic runs normally, if ASM runs it without the need of the "Asm(" command. Only runs NoShell

Details on a couple commands
*something*=*somethingElse* - it will solve for any variable. It looks for the first variable and turns all instances of in the equation into 'X'. Basically only use 'X' on its own. "5A=X" would be turned into "5X=X" and return 0. But, if B=3, and the equation "6A=B" was entered it would return the correct solution for A and treat B as a constant. X does work correctly on its own! "X^2=9" would return 3 and -3! The list of solutions is in Ans. If the solutions of the equation are 1,5,9,8 and 2, Ans would be the list {1,5,9,8,2}

Y=*equ* - If "Y=X" was entered and Y1 and Y2 had an equation then Y3 would = "X". If Y1 and Y3 had an equation, then it would be entered in Y2. It will never enter equations in Y0 for reasons explained later.

What it affects:
It does use several variables. It destroys the equation Y0, the Lists ASM and L1. Note that L1 is 2 separate tokens and NOT TO BE CONFUSED with the default list L1 that is available with 2nd,1.

Sound cool? The download is below. I would be happy to add a command for you, even if it is really simple. (Like *yourname* - returns "IS COOL")

Want to make your own sets of commands or think mine are lame? Here is the instructions to make your own. It is really easy, all you need to know is how to program basic. (no Axe or ASM!)

Solver is really a basic program in a wrapper that runs it and gives it the last entry in Str0. Here are the Variables you can use without affecting any user variables:
Y0 - This gets cleared after every time the program runs so you are free to use it.
Str0 - the entry the user typed in is passed in Str0. There are a couple special things about it though. If the program ends with Str0 in any state (but deleted) it will assume that the program has run successfully and will disable the OS's evaluation of the entry. So if Str0 has been deleted it tells the OS that it doesn't need to do anything and to evaluate it. If "5+9" is entered and Str0 is deleted when the basic program returns, the OS will return 14. If Str0 is still intact, Solver will tell the OS that it took care of it, and nothing will be displayed. (Don't worry if you are confused, I will provide an example)
List ASM - This is a list to be declared by the basic program and I use it to save the Letter Variables I use and restore them when the program returns. The Basic program handles this completely and Solver only deletes it once the Basic program quits.
List L1 - Pretty much the same as ASM. Use it for whatever you want. It also gets cleared upon exit.
Str9 - Solver saves it and restores its correct value upon exit. Use it for whatever you want.
If the program throws an error it won't show up. Instead the Basic program exits quietly and the Solver code still runs. My equation solver is designed to error, continually checking for solutions until it errors at which point it quits.

Here is an example program:
:If Str0="E37"      //tests to see if the user entered E37
:Then:Disp "Is Cool!"   //function
:Return:End      //return with Str0 intact (so the OS doesn't try to calculate E*37 and show that result)
:If Str0="5+5"
:Then:Disp "Do it yourself!"
:If InString(Str0,"*")            //If the entry has a times sign in it
:Then:Disp expr(Str0)+randInt(-1,1)      //and or subtract one and display the result
:Return:End               //Stop OS evaluation and return
:1->dim(lASM)            //Setup a variable (I don't really need one)
:Expr(Str0)->lASM(1)         //Saves the value to the variable
:Disp Str0,"="            //Displays *the entry* = *what the OS evaluates the entry to be*
:DelVar Str0            //Tells the OS to evaluate the entry and display the result

If you have a custom Basic Program you made, post it and I will compile it and give you the download with your custom command set.

I hope this helps! (or at least was interesting)
Title: Re: Solver
Post by: DJ Omnimaga on July 28, 2016, 09:08:29 pm
Hm interesting. If it has a lot of small math tools bundled together this could be handy for people who don't want to have multiple files on their calculator (providing that Solver is in 1 file or 2). I don't think I understand the purpose of the custom BASIC code at the bottom, though. Is it so that people can modify their copy of Solver or does it have like a custom language?
Title: Re: Solver
Post by: E37 on July 28, 2016, 10:19:11 pm
The code at the bottom is so people can modify their copy of Solver. Unfortunately, (for now) these edits require a recompile.
I hope in the future to add a way to upload files to it. (I'm already getting ideas)
Its main purpose is to allow people to run their math programs at a command without them taking up space in the program menu. (and hopefully being more accessible)
The biggest downfall is that the basic program is copied into ram each time so there needs to be enough free memory for it to run. I don't know how to execute from archive. (I'm pretty sure it is theoretically possible for appvs and prgms but have no idea how.)
My (current) file is all wrapped up into one file. You only need to send the solver application (and install it) in order for my version to run.

This whole program came from a basic program I once wrote that emulated the homescreen. It basically was an Input - evaluation loop. I always wanted to add other functionality. (Also ever since I learned hooks were a thing I have been very fascinated with them - and the power that came with them)
I would need to know how to execute appvs or programs from archive for this project to really take off. I'm sure there is a way to execute basic programs from archive in an app, but haven't done the research yet. It's on my list of things to do!

In conclusion, I guess with some work it could act as a lib for basic. (one that allows the programmer to add commands)
(I'm listening to The Legendary Axe while writing this - Cause' it's awesome!)
Title: Re: Solver
Post by: DJ Omnimaga on July 29, 2016, 01:29:56 am
Ah I see now. That said, I cannot help much since I don't do Axe anymore. You would need to make an help topic here and/or Omni. Good luck, though!

Also glad that you like my song :3=