Post Reply 
Plus42 Equations, Preview Release
05-15-2022, 09:02 PM
Post: #661
RE: Plus42 Equations, Preview Release
(05-15-2022 08:58 PM)Thomas Okken Wrote:  Regarding the permissions issue:
https://thomasokken.com/free42/#android-files

If you aren't able to save the file into that one directory Android still allows apps to access, should be able to use sharing instead: email the file to yourself, then open the attachment, and select Plus42 as the target app. The state file should be imported and you'll be taken to the States window, where the state will be among the list of states you can switch to.
Thank you, I managed to load the state file after a while by opening it in a third party file manager directly from plus42. Unfortunately the whole process is quite clunky. For some reason android would not allow me to associate p42 file ending with the app.
Find all posts by this user
Quote this message in a reply
05-15-2022, 10:32 PM (This post was last modified: 05-15-2022 11:04 PM by Thomas Okken.)
Post: #662
RE: Plus42 Equations, Preview Release
It's supposed to offer to share the file with Plus42 when you open a *.p42 that's attached to an email, or as a file in a file manager, or even as a url on a web server. The file sharing API in Android is a mess, though, so I'm not surprised it's still not working right everywhere. I spent weeks researching this and I still didn't manage to get it to work right in all cases... Any remaining complaints should be directed at Google. (Unless there is a clean and effective way to establish a file extension mapping in Android, but at this point, I'll believe it when I see it, I've already tried everything I could find in the official Android docs and on Stack Overflow.)
Visit this user's website Find all posts by this user
Quote this message in a reply
05-16-2022, 03:46 AM
Post: #663
RE: Plus42 Equations, Preview Release
(05-15-2022 10:32 PM)Thomas Okken Wrote:  It's supposed to offer to share the file with Plus42 when you open a *.p42 that's attached to an email, or as a file in a file manager, or even as a url on a web server. The file sharing API in Android is a mess, though, so I'm not surprised it's still not working right everywhere. I spent weeks researching this and I still didn't manage to get it to work right in all cases... Any remaining complaints should be directed at Google. (Unless there is a clean and effective way to establish a file extension mapping in Android, but at this point, I'll believe it when I see it, I've already tried everything I could find in the official Android docs and on Stack Overflow.)

Oh I am not blaming you for this. It is obviously an Android issue. iOS works fine with this and opens the state file without any issues.
Find all posts by this user
Quote this message in a reply
05-16-2022, 01:28 PM (This post was last modified: 05-16-2022 01:32 PM by Eddie W. Shore.)
Post: #664
RE: Plus42 Equations, Preview Release
Love the Plus42 and all the enhancements.

I think I am getting how the FOR function works.

Example:

HP 39gII/Prime Code:
A:=0;
FOR K FROM 1 TO 4 DO (STEP 1)
A:=A+K;
END;

Translate this to the Plus42:
S=FOR(L(A:0):G(I)≤4:L(I:G(I)+1):L(A:G(A)+G(I)))

Result: S = 10

S=: set the result to the variable S
INIT: L(A:0); set A = 0
COND: G(I)≤4; test if I≤4; if so continue, if not, end the loop
NEXT: L(I:G(I)+1); this happens at the end of the loop, this is like the general STEP incr/decr command
EXPR: L(A:G(A)+G(I))

The use of the Get function allows the variable to used automatically and not be displayed in the CALC menu.

Something that threw me off is that the order of NEXT and EXPR, which the EXPR (which I think there could be more than one EXPR statements), I am used to NEXT either at the end of the FOR loop or implied (end of indentation in Python, for example).
Visit this user's website Find all posts by this user
Quote this message in a reply
05-16-2022, 08:47 PM
Post: #665
RE: Plus42 Equations, Preview Release
I really like Plus42, thanks for all your work Thomas!

But I think I found a little bug in the TVM Solver.
I tried to solve the following problem:
“If I put 100 € in a stock that grows 10 % per year, after how many years can I sell it for 200 €?”

So, I keyed in:
P/YR = 1
I%YR = 10
PV = -100
PMT = 0
FV = 200
and pressed N …

My HP 17bII+ gives me 7.27
Plus42 says “Invalid Data”
Find all posts by this user
Quote this message in a reply
05-16-2022, 10:36 PM (This post was last modified: 05-16-2022 11:12 PM by Thomas Okken.)
Post: #666
RE: Plus42 Equations, Preview Release
(05-16-2022 01:28 PM)Eddie W. Shore Wrote:  S=FOR(L(A:0):G(I)≤4:L(I:G(I)+1):L(A:G(A)+G(I)))

This is missing the initialization of I. You could use SEQ to combine it with the initialization of A:

S=FOR(SEQ(L(A:0):L(I:0)):G(I)≤4:L(I:G(I)+1):L(A:G(A)+G(I)))

(05-16-2022 01:28 PM)Eddie W. Shore Wrote:  Something that threw me off is that the order of NEXT and EXPR, which the EXPR (which I think there could be more than one EXPR statements), I am used to NEXT either at the end of the FOR loop or implied (end of indentation in Python, for example).

The Plus42 FOR is modeled after the one in C:

    FOR(INIT:COND:NEXT:EXPR:...)

corresponds to

    for (init; cond; next) {
        expr;
        ...
    }


Note that NEXT is different from the expressions making up the loop body EXPR:..., in that NEXT is executed even if the loop body is cut short by CONTINUE.
Visit this user's website Find all posts by this user
Quote this message in a reply
05-16-2022, 10:50 PM
Post: #667
RE: Plus42 Equations, Preview Release
(05-16-2022 08:47 PM)SteffenM Wrote:  I really like Plus42, thanks for all your work Thomas!

But I think I found a little bug in the TVM Solver.
I tried to solve the following problem:
“If I put 100 € in a stock that grows 10 % per year, after how many years can I sell it for 200 €?”

So, I keyed in:
P/YR = 1
I%YR = 10
PV = -100
PMT = 0
FV = 200
and pressed N …

My HP 17bII+ gives me 7.27
Plus42 says “Invalid Data”

Ouch. There is a check for PMT=0, which should cause Invalid Data if I is also zero, but instead, it complains about PMT=0 even when I is nonzero, which of course is wrong. I'll fix this tomorrow.
Visit this user's website Find all posts by this user
Quote this message in a reply
05-17-2022, 04:00 AM (This post was last modified: 05-17-2022 04:02 AM by Eddie W. Shore.)
Post: #668
RE: Plus42 Equations, Preview Release
(05-16-2022 10:36 PM)Thomas Okken Wrote:  
(05-16-2022 01:28 PM)Eddie W. Shore Wrote:  S=FOR(L(A:0):G(I)≤4:L(I:G(I)+1):L(A:G(A)+G(I)))

This is missing the initialization of I. You could use SEQ to combine it with the initialization of A:

S=FOR(SEQ(L(A:0):L(I:0)):G(I)≤4:L(I:G(I)+1):L(A:G(A)+G(I)))

(05-16-2022 01:28 PM)Eddie W. Shore Wrote:  Something that threw me off is that the order of NEXT and EXPR, which the EXPR (which I think there could be more than one EXPR statements), I am used to NEXT either at the end of the FOR loop or implied (end of indentation in Python, for example).

The Plus42 FOR is modeled after the one in C:

    FOR(INIT:COND:NEXT:EXPR:...)

corresponds to

    for (init; cond; next) {
        expr;
        ...
    }


Note that NEXT is different from the expressions making up the loop body EXPR:..., in that NEXT is executed even if the loop body is cut short by CONTINUE.

I forgot the initialization of I.
Visit this user's website Find all posts by this user
Quote this message in a reply
05-17-2022, 01:08 PM (This post was last modified: 05-17-2022 01:19 PM by tgray.)
Post: #669
RE: Plus42 Equations, Preview Release
I must be dense, but... how do you use equations in a program? I can't seem to figure it out.

A likely follow on to my question is how do you use EVAL, EVALN, EQNVAR, and EQNMNU?

EDIT: Ok, so I see you have to parse equations in the stack before you can eval them. And I see you can import equations into a program in the EQN list. Still wondering about EVALN, EQNVAR, and EQNMNU though...
Find all posts by this user
Quote this message in a reply
05-17-2022, 02:19 PM
Post: #670
RE: Plus42 Equations, Preview Release
(05-17-2022 01:08 PM)tgray Wrote:  Still wondering about EVALN, EQNVAR, and EQNMNU though...

Those functions work with equation objects. For example, let's say you have an equation stored in a variable named "EQ"; say, XSTR "A*X^2+B*X+C" PARSE STO "EQ".
And you have a program like LBL "PG" MVAR "X" MVAR "A" MVAR "B" MVAR "C" RCL "X" X^2 RCL* "A" RCL "X" RCL* "B" + RCL+ "C" END.

Then:
EVALN "EQ" is equivalent to XEQ "PG"
EQNVAR "EQ" is equivalent to PGMVAR "PG"
EQNMENU "EQ" is equivalent to VARMENU "PG"
EQNMNU1 "EQ" is equivalent to VARMNU1 "PG"

Note that an equation object stored in a variable named "EQ" is not the same as an equation in EQN mode that is named EQ. Those two things live in completely separate name spaces.
Visit this user's website Find all posts by this user
Quote this message in a reply
05-17-2022, 02:30 PM
Post: #671
RE: Plus42 Equations, Preview Release
(05-17-2022 02:19 PM)Thomas Okken Wrote:  Note that an equation object stored in a variable named "EQ" is not the same as an equation in EQN mode that is named EQ. Those two things live in completely separate name spaces.

I had not noted that. Thank you.
Find all posts by this user
Quote this message in a reply
05-17-2022, 05:26 PM
Post: #672
RE: Plus42 Equations, Preview Release
It is possible to access named equations from EQN mode in RPN programs, using the GETEQN function. For example, to evaluate the equation named ABC, you'd do XSTR "ABC" GETEQN EVAL.

The original purpose of GETEQN is to allow the equation compiler to generate code for equation-to-equation calls, but just because a function was created for use in generated code, doesn't mean it can't be used in human-written user code as well...
Visit this user's website Find all posts by this user
Quote this message in a reply
05-17-2022, 06:18 PM
Post: #673
RE: Plus42 Equations, Preview Release
FWIW, the 'off' button keeps reenabling itself on my iPhone. I literally just deleted the 'state' file in the Files app, reloaded my save state and skin. The off button was disabled until I quit Plus42. Immediately upon reloading, I was able to quit the app with Shift-Exit. I just tested it again without reloaded my prior state and skin and the same thing happened.

I really wish there was a way to permanently disable this function (on desktop too). With so much functionally hidden behind shifted keys and levels of nested menus, it is very easy for me to accidentally hit Exit while shifted and close down the program inadvertently.
Find all posts by this user
Quote this message in a reply
05-17-2022, 07:04 PM
Post: #674
RE: Plus42 Equations, Preview Release
(05-17-2022 06:18 PM)tgray Wrote:  FWIW, the 'off' button keeps reenabling itself on my iPhone. I literally just deleted the 'state' file in the Files app, reloaded my save state and skin. The off button was disabled until I quit Plus42. Immediately upon reloading, I was able to quit the app with Shift-Exit. I just tested it again without reloaded my prior state and skin and the same thing happened.

Confirmed, I'm seeing the same thing on my iPhone. That's a bug; I'll fix it in the next release.
Visit this user's website Find all posts by this user
Quote this message in a reply
05-17-2022, 08:59 PM
Post: #675
RE: Plus42 Equations, Preview Release
(05-17-2022 07:04 PM)Thomas Okken Wrote:  
(05-17-2022 06:18 PM)tgray Wrote:  FWIW, the 'off' button keeps reenabling itself on my iPhone. I literally just deleted the 'state' file in the Files app, reloaded my save state and skin. The off button was disabled until I quit Plus42. Immediately upon reloading, I was able to quit the app with Shift-Exit. I just tested it again without reloaded my prior state and skin and the same thing happened.

Confirmed, I'm seeing the same thing on my iPhone. That's a bug; I'll fix it in the next release.

Awesome!
Find all posts by this user
Quote this message in a reply
05-17-2022, 09:07 PM
Post: #676
RE: Plus42 Equations, Preview Release
FYI - [Shift] [Off] exits the app on Android too, prefer the app stay on, like Free42, unless I've missed an option.

--Bob Prosperi
Find all posts by this user
Quote this message in a reply
05-17-2022, 09:30 PM
Post: #677
RE: Plus42 Equations, Preview Release
OFF exits the app on all platforms, it's been that way since 2004. Well, OK, except on PalmOS, where OFF would turn off the device. The beauty of a single-tasking OS that actually gave that kind of control to apps!

The only reason the iOS version doesn't enable this OFF behavior by default, and requires a back door to enable it, is because apps exiting on their own initiative is verboten per Apple UI guidelines.

I don't see the problem, though. If you don't like the behavior of OFF, then just don't use it?
Visit this user's website Find all posts by this user
Quote this message in a reply
05-17-2022, 11:42 PM
Post: #678
RE: Plus42 Equations, Preview Release
I’m sure it’s just a me problem, but I’m constantly exiting the app by accident, particularly when trying new things out. Shift and exit are used quite a lot…
Find all posts by this user
Quote this message in a reply
05-18-2022, 02:04 AM
Post: #679
RE: Plus42 Equations, Preview Release
(05-17-2022 09:30 PM)Thomas Okken Wrote:  OFF exits the app on all platforms, it's been that way since 2004. Well, OK, except on PalmOS, where OFF would turn off the device. The beauty of a single-tasking OS that actually gave that kind of control to apps!

The only reason the iOS version doesn't enable this OFF behavior by default, and requires a back door to enable it, is because apps exiting on their own initiative is verboten per Apple UI guidelines.

I don't see the problem, though. If you don't like the behavior of OFF, then just don't use it?

OFF does not exit the app on Android, at least not on my Pixel 6 Pro. I prefer it that way, but it's not a big deal, however since Free42 does one thing and Plus42 another thing, and Plus42 is new, I assumed that was the one with the bug.

Apple UI guidelines don't allow apps to exit on their own - LOL. Why let a program quit when an Apple OS can be in control - simply not allowed to let an opportunity to be in control pass by.... If Palm OS allowing such control is beautiful, then iOS is... er.... well, not beautiful, at least to my eye.

--Bob Prosperi
Find all posts by this user
Quote this message in a reply
05-18-2022, 08:22 AM
Post: #680
RE: Plus42 Equations, Preview Release
I could make it a configurable option on Android as well as iOS, of course. And at least I should look into why it isn't working in Plus42 on Android, that's weird because why would that be different?

Then again, the accidental OFF auto-enable in Plus42 on iOS turns out to be a bug that it inherited from Free42, but which doesn't cause this behavior in Free42 while it does in Plus42. Weird.

Regarding the iOS prohibition on apps exiting on their own: I do get it, because that kind of behavior looks exactly the same as a crash, and apps have a particular lifecycle that the OS should be in control of. It's pretty much the same as on Android, actually. That they go so far as to reject apps that don't conform to their UI standard... well, Apple have been pretty specific about uniform, predictable user interfaces, going back to MacOS 1.0. Having given themselves veto power in the App Store, I'm not surprised they use it to enforce those standards. And I never use OFF to exit on my phone, even though I use it all the time in the desktop versions... it just doesn't fit it the flow on mobile, I guess.
Visit this user's website Find all posts by this user
Quote this message in a reply
Post Reply 




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