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. 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). |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 2 Guest(s)