Post Reply 
Best way to convert complex numbers, rect, polar, euler
09-21-2018, 03:09 PM (This post was last modified: 09-21-2018 03:20 PM by Anders.)
Post: #15
RE: Best way to convert complex numbers, rect, polar, euler
(09-21-2018 07:56 AM)CyberAngel Wrote:  
(09-21-2018 07:38 AM)Anders Wrote:  You are kind of proving my larger point that the implementation of the complex number formats standard and functions is screwy.
Certain formats and functions/buttons works in some modes and in others not.
This is confusing the user constantly...

1. There is a [∡] button and it works as it should in Home but not in CAS (super frustrating - forcing people to implement their own conversion functions - see various attempts in the http://www.hpmuseum.org/forum/forum-15.html ).
2. Some complex number formats work in RPN but not in CAS or textbook (home), e.g. 2i4 is interpreted different.

It short it’s a mess.

An engineer (EE, CE in particular), who needs to constantly move back and forth between polar and cartesian coordinates (and calc/pre calc high school student too for that matter), should be able to expect the calculator to accept the same number formats and operate the same regardless of he/she is using RPN, textbook format (home) or CAS.


Wouldn't it be great if we could standardize across all three, e.g. 4i3, 3∡(pi/2) works everywhere - simple notation that saves key strokes.
You can then do things like (4i3) * (3∡(pi/2)) in Textbook (Home) and CAS
or in RPN:
4i3 <enter>
3∡(pi/2) <enter>
* <enter>
and the expected results

"operate the same regardless of he/she is using RPN, textbook format (home) or CAS."

Impossible with the RPN. It *IS* different by it's very nature.

Possible, but not feasible with [Home] vs [CAS],
which still needs a lot of work.

The CAS is never going to change.
It is used in various other platforms
and the sole genius developer has a certain consistent philosophy behind it.
He has already made many special exceptions just for us.
Lucky enough this unmentioned professor still fixes bugs
and even answers questions in this very forum - in English (and French).

Therefore the Home needs to adapt to be more like CAS (or CAS+).
Using CAS("Expression") or CAS.casfunction() you already have extras,
but ... I'm afraid that you're right... it is different.
<sigh>
I suggest you stick to Home for your [∡] problems and learn that environment well.
VPN

Obviously RPN is different. I've used HP calculators for years so I am pretty familiar with that concept (67, 42S 28S 48GX, 50g etc). Yes I used phrase "the same" loosely here but was hoping people would get what I mean.

Ok I'll try again:
There is no reason why 4i2 and 3∡1.4 could not be made to work in the 3 modes.

Nor is there reason why the ∡ button could not be made to work the "same" way (except considering the inherent differences in RPN vs Text book mode).

The way you solve this is buy shielding the underlying CAS or Home functionality (Textbook or RPN mode) with a UI parser that parsers the key strokes as the user types them, convert the key strokes into tokens and organized the tokens in to an abstract syntax tree.

The correct syntax for complex numbers and how i, ∡ buttons work in different contexts are described as regular expressions and with BNF notation. A simple lexical scanner and a LALR type parser can then be used to generate the AST.

Once user hit's enter the parser passes the tree in the form that CAS or Home expects it. No core code need to change in CAS except actual interface to CAS (UI).

Now, I am assuming the HP Prime have UI parser(s) already that front ends Home and CAS (how else do they do it today?). Therefore, all you need to do is update them/it per above. Could be as simple as adding/updating the existing grammar/formal language (catalog of valid regular expressions and BNF rules).
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: Best way to convert complex numbers, rect, polar, euler - Anders - 09-21-2018 03:09 PM



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