The following warnings occurred:
Warning [2] Undefined array key 140944 - Line: 275 - File: inc/plugins/threaded_mode.php PHP 8.1.2-1ubuntu2.14 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/plugins/threaded_mode.php 275 errorHandler->error_callback
/inc/plugins/threaded_mode.php 23 ThreadedMode::showthread_threaded
/inc/class_plugins.php 142 threaded_mode_showthread_threaded
/showthread.php 918 pluginSystem->run_hooks
Warning [2] Undefined array key 140965 - Line: 275 - File: inc/plugins/threaded_mode.php PHP 8.1.2-1ubuntu2.14 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/plugins/threaded_mode.php 275 errorHandler->error_callback
/inc/plugins/threaded_mode.php 23 ThreadedMode::showthread_threaded
/inc/class_plugins.php 142 threaded_mode_showthread_threaded
/showthread.php 918 pluginSystem->run_hooks
Warning [2] Undefined array key 140967 - Line: 275 - File: inc/plugins/threaded_mode.php PHP 8.1.2-1ubuntu2.14 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/plugins/threaded_mode.php 275 errorHandler->error_callback
/inc/plugins/threaded_mode.php 23 ThreadedMode::showthread_threaded
/inc/class_plugins.php 142 threaded_mode_showthread_threaded
/showthread.php 918 pluginSystem->run_hooks
Warning [2] Undefined array key 140984 - Line: 275 - File: inc/plugins/threaded_mode.php PHP 8.1.2-1ubuntu2.14 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/plugins/threaded_mode.php 275 errorHandler->error_callback
/inc/plugins/threaded_mode.php 23 ThreadedMode::showthread_threaded
/inc/class_plugins.php 142 threaded_mode_showthread_threaded
/showthread.php 918 pluginSystem->run_hooks
Warning [2] Undefined array key 141030 - Line: 275 - File: inc/plugins/threaded_mode.php PHP 8.1.2-1ubuntu2.14 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/plugins/threaded_mode.php 275 errorHandler->error_callback
/inc/plugins/threaded_mode.php 23 ThreadedMode::showthread_threaded
/inc/class_plugins.php 142 threaded_mode_showthread_threaded
/showthread.php 918 pluginSystem->run_hooks
Warning [2] Undefined variable $thread - Line: 295 - File: inc/plugins/threaded_mode.php PHP 8.1.2-1ubuntu2.14 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/plugins/threaded_mode.php 295 errorHandler->error_callback
/inc/plugins/threaded_mode.php 23 ThreadedMode::showthread_threaded
/inc/class_plugins.php 142 threaded_mode_showthread_threaded
/showthread.php 918 pluginSystem->run_hooks
Warning [2] Trying to access array offset on value of type null - Line: 295 - File: inc/plugins/threaded_mode.php PHP 8.1.2-1ubuntu2.14 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/plugins/threaded_mode.php 295 errorHandler->error_callback
/inc/plugins/threaded_mode.php 23 ThreadedMode::showthread_threaded
/inc/class_plugins.php 142 threaded_mode_showthread_threaded
/showthread.php 918 pluginSystem->run_hooks
Warning [2] Undefined variable $fid - Line: 295 - File: inc/plugins/threaded_mode.php PHP 8.1.2-1ubuntu2.14 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/plugins/threaded_mode.php 295 errorHandler->error_callback
/inc/plugins/threaded_mode.php 23 ThreadedMode::showthread_threaded
/inc/class_plugins.php 142 threaded_mode_showthread_threaded
/showthread.php 918 pluginSystem->run_hooks
Warning [2] Undefined array key 140967 - Line: 331 - File: inc/plugins/threaded_mode.php PHP 8.1.2-1ubuntu2.14 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/plugins/threaded_mode.php 331 errorHandler->error_callback
/inc/plugins/threaded_mode.php 332 ThreadedMode::buildtree
/inc/plugins/threaded_mode.php 332 ThreadedMode::buildtree
/inc/plugins/threaded_mode.php 304 ThreadedMode::buildtree
/inc/plugins/threaded_mode.php 23 ThreadedMode::showthread_threaded
/inc/class_plugins.php 142 threaded_mode_showthread_threaded
/showthread.php 918 pluginSystem->run_hooks
Warning [2] Undefined array key 141030 - Line: 331 - File: inc/plugins/threaded_mode.php PHP 8.1.2-1ubuntu2.14 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/plugins/threaded_mode.php 331 errorHandler->error_callback
/inc/plugins/threaded_mode.php 332 ThreadedMode::buildtree
/inc/plugins/threaded_mode.php 332 ThreadedMode::buildtree
/inc/plugins/threaded_mode.php 332 ThreadedMode::buildtree
/inc/plugins/threaded_mode.php 304 ThreadedMode::buildtree
/inc/plugins/threaded_mode.php 23 ThreadedMode::showthread_threaded
/inc/class_plugins.php 142 threaded_mode_showthread_threaded
/showthread.php 918 pluginSystem->run_hooks
Warning [2] Undefined variable $theme - Line: 3 - File: inc/plugins/threaded_mode.php(305) : eval()'d code PHP 8.1.2-1ubuntu2.14 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/plugins/threaded_mode.php(305) : eval()'d code 3 errorHandler->error_callback
/inc/plugins/threaded_mode.php 305 eval
/inc/plugins/threaded_mode.php 23 ThreadedMode::showthread_threaded
/inc/class_plugins.php 142 threaded_mode_showthread_threaded
/showthread.php 918 pluginSystem->run_hooks
Warning [2] Trying to access array offset on value of type null - Line: 3 - File: inc/plugins/threaded_mode.php(305) : eval()'d code PHP 8.1.2-1ubuntu2.14 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/plugins/threaded_mode.php(305) : eval()'d code 3 errorHandler->error_callback
/inc/plugins/threaded_mode.php 305 eval
/inc/plugins/threaded_mode.php 23 ThreadedMode::showthread_threaded
/inc/class_plugins.php 142 threaded_mode_showthread_threaded
/showthread.php 918 pluginSystem->run_hooks
Warning [2] Undefined variable $theme - Line: 3 - File: inc/plugins/threaded_mode.php(305) : eval()'d code PHP 8.1.2-1ubuntu2.14 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/plugins/threaded_mode.php(305) : eval()'d code 3 errorHandler->error_callback
/inc/plugins/threaded_mode.php 305 eval
/inc/plugins/threaded_mode.php 23 ThreadedMode::showthread_threaded
/inc/class_plugins.php 142 threaded_mode_showthread_threaded
/showthread.php 918 pluginSystem->run_hooks
Warning [2] Trying to access array offset on value of type null - Line: 3 - File: inc/plugins/threaded_mode.php(305) : eval()'d code PHP 8.1.2-1ubuntu2.14 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/plugins/threaded_mode.php(305) : eval()'d code 3 errorHandler->error_callback
/inc/plugins/threaded_mode.php 305 eval
/inc/plugins/threaded_mode.php 23 ThreadedMode::showthread_threaded
/inc/class_plugins.php 142 threaded_mode_showthread_threaded
/showthread.php 918 pluginSystem->run_hooks
Warning [2] Undefined variable $lang - Line: 5 - File: inc/plugins/threaded_mode.php(305) : eval()'d code PHP 8.1.2-1ubuntu2.14 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/plugins/threaded_mode.php(305) : eval()'d code 5 errorHandler->error_callback
/inc/plugins/threaded_mode.php 305 eval
/inc/plugins/threaded_mode.php 23 ThreadedMode::showthread_threaded
/inc/class_plugins.php 142 threaded_mode_showthread_threaded
/showthread.php 918 pluginSystem->run_hooks
Warning [2] Attempt to read property "messages_in_thread" on null - Line: 5 - File: inc/plugins/threaded_mode.php(305) : eval()'d code PHP 8.1.2-1ubuntu2.14 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/plugins/threaded_mode.php(305) : eval()'d code 5 errorHandler->error_callback
/inc/plugins/threaded_mode.php 305 eval
/inc/plugins/threaded_mode.php 23 ThreadedMode::showthread_threaded
/inc/class_plugins.php 142 threaded_mode_showthread_threaded
/showthread.php 918 pluginSystem->run_hooks





HP-35S: Decomposing a complex number



#6

Well, I don't know if this has already been treated here (I've done some googling, but nothing seems to match), so I present here my way of doing what's in the title for numbers either in the form 'a+ib' or 'r-theta'. Of course, anyone of you may have a better and shorter way, but my scope is not to do some kind of race with anyone, just to help those who face the HP-35S faults.

Reading the program by Valentin Albillo about a 35S solver much more powerful than the built-in one (Valentin's one works on real and complex numbers as well and sorry, but I can't find the thread anymore), I grabbed his powerful algorithm to retrieve the real value of any number (either real or complex).
Extending its action, I built these short routines to do the same both for reals and imaginary parts, depending on the chosen algorithm. Basing on this assumption, I guess this should be called "Valentin's way", not just "Antonio's way".

Note: all routines are for RPN Mode and are all independent of the angle settings (RAD/GRAD/DEG).

get Real value

--------------

R001 LBL R
R002 ENTER
R003 ARG
R004 COS
R005 x<>y
R006 ABS
R007 *
R008 RTN

get Imaginary value

-------------------

I001 LBL I
I002 ENTER
I003 ARG
I004 SIN
I005 x<>y
I006 ABS
I007 *
I008 RTN

Test

----

I performed the following tests, and here's what I got:

2i7   XEQ I    ->  7
2i7 XEQ R -> 2
-2i7 XEQ I -> 7
-2i7 XEQ R -> -2
2i-7 XEQ I -> -7
2i-7 XEQ R -> 2
-2i-7 XEQ I -> -7
-2i-7 XEQ R -> -2

Usage

-----

To decompose a complex number do:

ENTER   XEQ I   x<>y   XEQ R
to have the Real part on the display
ENTER   XEQ R   x<>y   XEQ I
to have the Imaginary part on the display

Hope this will help someone.

-- Antonio


#7

Hi Antonio,

this deficiency of the 35S was a big headache when I was more active last year. The absence of a function as elegant as the SHIFT COMPLEX key sequence of the 42S is a disappointment in a calculator that is otherwise not bad at maintaining some semblance of the legacy of keystroke programmables.

My preference is to link your two routines together into one. I add the extra ENTER at the beginning and put the X<>Y right in the middle in place of the RTN and LBL I. I put mine under LBL D, for Decompose a Complex. XEQ D is similar to the COMPLEX command on the 42S, with the exception that on the 35S the rectangular coordinates are always returned irrespective of mode, whereas with the 42S an complex number in polar form will be decomposed to modulus and argument. In any case the routine is pretty disruptive to the stack. If I have something important in Y, Z, and T, and then put a complex in X and decompose it, only the contents of the former Y register will survive, duplicated in Z and T.

Personally, I find it more of a nuisance to create a complex from reals placed on the stack. It is simple but cumbersome--e.g. , in RPN and Rect mode x ENTER y ENTER 0 i 1 * + will return x + iy in the display, but what a bother to do every time, even programatically! And if I want to return a polar complex number from modulus and argument while in Polar mode, it seems even more of a nuisance--I am still trying to come up with a good way to do it.

I obviously missed Valentin's post about improving the 35S solver. I would like to see that. The much maligned 33S actually seemed better and faster in this regard. I have a program that computes the inverse normal distribution score associated with a given probability and it requires repeated solves. The built in solver wouldn't even work with my program, so I resorted to writing a short Newton Raphson solver just for the particular problem, given that the function in question had a well known and easily computed derivative. Works well.

Thanks for contributing your wisdom on the 35S. I do really like mine, and I even have an unused one still unwrapped, but these little deficiencies do get my goat sometimes. Like the cos(89.999) bug ;)

Les


#8

Well, you're right. My attempt was more like a study about how to solve the HP-35S faults, rather than a pure and useful routine. In effect, turning the two listings into a unique one may be more useful and less memory-consuming, but in any case I wonder why the engineers behind the HP-35S project didn't manage this.

I will look for the HP-35S solver by Valentin when I can (if anyone is not faster than me) and put the link.

Thanks for your kind words!

-- Antonio


Edited: 22 Sept 2008, 2:23 a.m.

#9

Les,

I'm not sure of this is the article by Valentin you are looking for, but here's the link to his excellent Complex Roots Solver for the 35s:

http://membres.lycos.fr/albillo/calc/pdf/DatafileVA031.pdf

I really miss Valentin's articles in Datafile, and also his posts on this Forum where we haven't heard from him for a while.

Regards,
Fernando


#10

Thanks Fernando,

this is just the article I meant, only... I was looking at the wrong site...

Thanks again.

-- Antonio


Possibly Related Threads…
Thread Author Replies Views Last Post
  HP Prime: complex numbers in CAS. Alberto Candel 1 1,856 12-06-2013, 02:36 PM
Last Post: parisse
  [HP Prime] Plots containing complex numbers bug? Chris Pem10 7 3,547 12-05-2013, 07:40 AM
Last Post: cyrille de Brébisson
  A fast Bernoulli Number method for the HP Prime Namir 16 5,360 11-22-2013, 04:46 PM
Last Post: Namir
  Complex Number Entry on Prime Jeff O. 19 5,023 11-16-2013, 12:34 PM
Last Post: Jeff O.
  [HP Prime] Calculating Prandtl Number with Units (bug found in USIMPLIFY) Timothy Roche 1 1,325 11-13-2013, 04:07 PM
Last Post: cyrille de Brébisson
  HP Prime: Converting number to Sci notation and back BruceTTT 1 1,479 11-12-2013, 02:11 AM
Last Post: Phil Wipf
  HP PRIME: Fixed 4 number format 0.001000 Joseph Ec 18 5,157 11-07-2013, 11:51 AM
Last Post: Geoff Quickfall
  HP Prime: Number of external Variables Davi Ribeiro de Oliveira 0 979 11-01-2013, 08:10 PM
Last Post: Davi Ribeiro de Oliveira
  HP Prime complex results Javier Goizueta 0 955 10-06-2013, 12:59 PM
Last Post: Javier Goizueta
  HP Prime Solving Nonlinear System of Equations for Complex Results Helge Gabert 11 4,073 09-30-2013, 03:44 AM
Last Post: From Hong Kong

Forum Jump: