### WalrusIRC

You need to have 5 posts and not be part of restricted usergroups in order to use the WalrusIRC embedded shoutbox. However, you can also access our IRC channel called #CodeWalrus via EFnet.

### Author Topic: Solver  (Read 592 times)

0 Members and 1 Guest are viewing this topic.

#### E37

• Full User
• Join Date: Jul 2016
• Location: Lihilzard Empire
• Posts: 216
• Post Rating Ratio: +9/-0
• I own 2 game consoles, a ti-83 and a ti-84!
##### Solver
« 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:

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
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")

Extras!!!
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:
PRGM:SOMENAME
: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!"
:Return:End
:
: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)
« Last Edit: January 04, 2017, 10:48:11 pm by DJ Omnimaga »

• Consoles, mobile devices and vintage computers owned: Ti83,Ti84!
I've never finished a project, there is always a way to improve!
What's my calc's name? Convert \$37 to decimal. Look up that element in the periodic table. Then take the abbreviation of that element and you have it!
Look! A slime!    <(^.^)>

#### DJ Omnimaga

• Omni founder & CW co-founder
• CodeWalrus Staff
• Super User
• Forum Maintenance
• Original 5
• CodeWalrus Supporter
• Topic Management
• Join Date: Nov 2014
• Posts: 18242
• Post Rating Ratio: +91/-4
• Gender:
##### Re: Solver
« Reply #1 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?
• Calculators owned: TI-57, 73, TI-80 (broken), TI-81, TI-82, TI-83, TI-83+ (broken), TI-83+ (broken), TI-83+SE (broken), TI-84+, TI-84+CSE, TI-84+CE, TI-85, TI-86, TI-89T, TI-92, TI-Nspire, TI-Nspire CX (semi-broken), HP 39gII, HP Prime, Casio fx-7000G, fx-7400G+, fx-7700GE, fx-9750G+, fx-9750GII, fx-9860G, cfx-9850G, FX-1.0+, fx-CG10, fx-CP400
• Consoles, mobile devices and vintage computers owned: Samsung i5510, Nexus 5, Atari 2600, Lynx, SMS, Game Gear, Genesis, Dreamcast, NES, SNES, N64, GCN, Wii, Wii U, GBA, DS, 3DS, PS2, PS3, PS4, PSP, PSVita, XBox 360, XBOne

#### E37

• Full User
• Join Date: Jul 2016
• Location: Lihilzard Empire
• Posts: 216
• Post Rating Ratio: +9/-0
• I own 2 game consoles, a ti-83 and a ti-84!
##### Re: Solver
« Reply #2 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!)
• Consoles, mobile devices and vintage computers owned: Ti83,Ti84!
I've never finished a project, there is always a way to improve!
What's my calc's name? Convert \$37 to decimal. Look up that element in the periodic table. Then take the abbreviation of that element and you have it!
Look! A slime!    <(^.^)>

#### DJ Omnimaga

• Omni founder & CW co-founder
• CodeWalrus Staff
• Super User
• Forum Maintenance
• Original 5
• CodeWalrus Supporter
• Topic Management
• Join Date: Nov 2014
• Posts: 18242
• Post Rating Ratio: +91/-4
• Gender:
##### Re: Solver
« Reply #3 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
• Calculators owned: TI-57, 73, TI-80 (broken), TI-81, TI-82, TI-83, TI-83+ (broken), TI-83+ (broken), TI-83+SE (broken), TI-84+, TI-84+CSE, TI-84+CE, TI-85, TI-86, TI-89T, TI-92, TI-Nspire, TI-Nspire CX (semi-broken), HP 39gII, HP Prime, Casio fx-7000G, fx-7400G+, fx-7700GE, fx-9750G+, fx-9750GII, fx-9860G, cfx-9850G, FX-1.0+, fx-CG10, fx-CP400
• Consoles, mobile devices and vintage computers owned: Samsung i5510, Nexus 5, Atari 2600, Lynx, SMS, Game Gear, Genesis, Dreamcast, NES, SNES, N64, GCN, Wii, Wii U, GBA, DS, 3DS, PS2, PS3, PS4, PSP, PSVita, XBox 360, XBOne