Post Reply 
Example of MISO solver for WP 34s
05-22-2018, 05:40 PM (This post was last modified: 05-22-2018 05:41 PM by Dieter.)
Post: #2
RE: Example of MISO solver for WP 34s
(05-22-2018 09:29 AM)gomefun2 Wrote:  I will show an example of how to program a MISO (multiple input single output) solver mapped to a single button press for an equation.

I'll be glad to look at the program and see how it can be improved, but...
sorry, in my humble opinion this is completely unreadable.

There is no need to comment each and every line. If there is a line with a "+" it is not required to explain this is an addition, or if there is a "1" noone needs to know that this puts a "1" into X. This is obvious, so please comment only the essential things. For instance you could add the equation that is solved here.

Maybe you can provide a new listing, completely uncommented, and with a fixed-width font. Try the "code" box in the message editor. Maybe you can also add line numbers so that everyone who wants to comment on a specific piece of code can do so by referring to the respective line number. Here's a tip: type the program in Excel, add the line numbers in the column left of the code and then copy the result.

I hope you do not mind these suggestions, but the way it is now the program is extremely hard to oversee and understand. The pure listing – along with a few explanations after (!) the code – would be very helpful.

Edit: Ok, Ok, I did it myself:

Code:
001  LBL A
002  CLα
003  1
004  STO 00
005  α's'
006  XEQ'VAR'
007  α'Pe'
008  XEQ'VAR'
009  α'Pwf'
010  XEQ'VAR'
011  α'q'
012  XEQ'VAR'
013  α'Bo'
014  XEQ'VAR'
015  α'u'
016  XEQ'VAR'
017  α'k'
018  XEQ'VAR'
019  α'h'
020  XEQ'VAR'
021  α're'
022  XEQ'VAR'
023  α'rw'
024  XEQ'VAR'
025  RCL 99
026  STO 00
027  SLV'SSR'
028  RTN
029  LBL 'SSR'
030  STO->00
031  RCL 07
032  RCL 08
033  *
034  RCL 02
035  RCL 03
036  -
037  *
038  #002
039  SDR 001
040  #141
041  +
042  RCL 06
043  *
044  RCL 05
045  *
046  RCL 09
047  RCL 10
048  /
049  LN
050  RCL 01
051  +
052  *
053  /
054  RCL 04
055  -
056  RTN
057  LBL'VAR'
058  α'?'
059  RCL->00
060  PROMPT
061  STO->00
062  x<0?
063  XEQ'UNK'
064  INC 00
065  CLα
066  RTN
067  LBL'UNK'
068  RCL 00
069  STO 99
070  RTN

By the way: SLV works as a test. If no solution is found the next line is skipped! This way you can add your own error handler.
And SLV expects two initial guesses in X and Y. How does your program handle this?

Dieter
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: Example of MISO solver for WP 34s - Dieter - 05-22-2018 05:40 PM



User(s) browsing this thread: 3 Guest(s)