I was bored and found a HP-27S
|
06-27-2014, 09:45 AM
Post: #46
|
|||
|
|||
RE: I was bored and found a HP-27S
(06-26-2014 10:41 PM)rprosperi Wrote: But I can tell you from experience that looking at those pieces of Solver art before you've used it a lot is really confusing. Sometimes even after. This is an equivalent program written for Python: Code: for I in range(1, 9): The index parameters I-O are local variables and therefore can't be used directly to display the result. Thus the variables A-H are used to propagate the result. They must be used or they won't show up in the menu. But we're not really interested in the sum of them. It's only for this side-effect that they are used here: Code: Q=A+B+C+D+E+F+G+H+ Instead of a for-loop the \(\Sigma\) function is used. We don't have ABS but we can use SQ (square) instead: Code: Σ(M:1:8:1: Code: for M in range(1, 9): As we can't display all 92 solutions an error (division by zero) is used to stop the program: Code: L(A:I)xL(B:J)xL(C:K)xL(D:L)xL(E:M)xL(F:N)xL(G:O)xL(H:P)/0 While the Python program prints all solutions the solver stops with the 1st one. A counter could be used to stop with the n-th solution. HTH Thomas |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 1 Guest(s)