Post Reply 
DB48X - Complex Number Handling
10-21-2023, 03:58 PM
Post: #3
RE: DB48X - Complex Number Handling
(08-31-2023 02:20 PM)TomC Wrote:  Hello:

I've started this new thread, separate from the main DB48X thread as my testing/interests here will be on the Complex Number performance which may not be of general interest to other DB48X testers. If others believe it should be in the main thread, I can put it there.

To me, it is convenient to have a thread dedicated to complex numbers. However, I only noticed it because you pinged me in a PM. I wonder if there is a way to teach MyBB to send me notifications for a given keyword...

Quote:1. When using 'y to the x' function, the result returned is sometimes in polar form. Other times it is displayed in a form that is unintelligible.

It's actually always in polar form. Currently, the result of complex functions is returned in the format that makes the computation easiest. y^x is computed as exp(x*ln(y)). The complex exp(a+ib) is computed as exp(a)*exp(ib), which is in polar form (a;<b). So naturally, the result of power is computed in polar form.

There will be a setting some day that forces results to always be generated in polar or rectangular, but for the moment, the result depends on the computation and sometimes on the input (e.g. multiplication can be done both in rectangular and polar form efficiently).

Also note that using the EEX key (the E next to the letter O) without entering digits first invokes the Cycle command, and for complex numbers, this cycles between polar and rectangular form.

Quote:i to the i power returns a response in polar form.

2+i raised to the 2+i power returns a result I cannot read. (I cannot find a 'Show' function.)

The "Show" function is not implemented yet, but it will be at the same keyboard location as on the DM42. In the meantime, values that do not fit on screen display with a grayed out "..." in the middle. This choice is because very often, the interesting stuff is either at the beginning or the end of an object, so showing a bit of both.

When something does not fit, the most "RPL-ish" way to get it is to hit the "Down" key. That brings the top-level of the stack in the editor, and then you can use the arrows to scroll left and right.

There are other useful options:

- Using the various number display modes in the DISP menu. For example, the (2+i)^(2+i) value displays well using SIG 10 (10 significant digits). Using SIG 20 is good for real numbers, but if you generally use complex numbers, SIG 10 or below will be better. SIG is like a FIX without trailing zeroes.

- You can adjust the font size using the UI menu (from the Modes menu). Using value 2 (smallest font) for Result and Stack will let you see 20 digits for your complex numbers. But you need good eyes.

Quote:(the result is about (-0.504, 3.104) Using the Re and Im functions shows that the calculator returned the correct result.

Actually, if it returned the correct result, it's probably that your calculator was set to compute in radians, see https://github.com/c3d/DB48X-on-DM42/issues/452. This will be fixed in 0.4.8 which is scheduled for tomorrow.

Quote:2. Regarding Complex number output, I would like to select between the following output formats:
a. X + iY
b. (X,Y)
c. R/Theta

I could not find a setting in the Modes menu for this functionality.

As indicated above, the setting to force the result to be either rectangular or polar will appear in a later revision. For now, the output is in the most efficient form based on the computation that was performed, and if that form does not suit you, hit the Cycle key.

I was not planning to have an (X,Y) output. One of the reasons is that it is problematic for European countries that use , as a decimal separator (and, being French, that's my default setting). HP used to "solve" that with ; as a separator when FM, was set, but that means the separator is different based on locale, which makes parsing (1,2) context sensitive: does it mean 1.2 with parentheses around it, or does it mean complex number with re=1 and im=2? I decided to not open this can of worms, and only accept space or ; as separators on input.

DB48X still accepts (1;2) as input for compatibility reasons, but it's hard to enter that from the keyboard (you essentially have to do it in Alpha mode). It can be convenient if you type RPL programs on a PC, where the 'i' character used for complex numbers is not easily found (and the regular 'i' means variable i).

In your idea, would (X,Y) just be a display preference for complex numbers? What benefits do you see to it?
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
DB48X - Complex Number Handling - TomC - 08-31-2023, 02:20 PM
RE: DB48X - Complex Number Handling - TomC - 10-19-2023, 03:33 PM
RE: DB48X - Complex Number Handling - c3d - 10-21-2023, 04:15 PM
RE: DB48X - Complex Number Handling - c3d - 10-21-2023 03:58 PM
RE: DB48X - Complex Number Handling - c3d - 10-22-2023, 11:26 PM
RE: DB48X - Complex Number Handling - TomC - 10-23-2023, 05:21 PM



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