HP49-HP50 (a, b) into 'a+bi' - Printable Version +- HP Forums (https://www.hpmuseum.org/forum) +-- Forum: HP Calculators (and very old HP Computers) (/forum-3.html) +--- Forum: General Forum (/forum-4.html) +--- Thread: HP49-HP50 (a, b) into 'a+bi' (/thread-19655.html) |
HP49-HP50 (a, b) into 'a+bi' - Gil - 03-13-2023 04:07 PM I want to convert a complex from the (a, b) form into 'a+b*i'. Is there a command linked to a achieve this instead of my cumbersome \<< (5.,6.) C\->R "*i" + "'" ROT + "+" + SWAP + OBJ\-> \>> ? RE: HP49-HP50 (a, b) into 'a+bi' - John Keith - 03-13-2023 04:48 PM The command \->Q in the Convert/Rewrite menu works, but if the parts of z are irrational numbers, it will return a rational approximation. RE: HP49-HP50 (a, b) into 'a+bi' - Gil - 03-13-2023 05:39 PM Great, many thanks. Now with matrix M [[ 11 12 ] [ 21 22 ]] in the stack, we have two ways to replace its element 22 by (2,2): A) Transform M into a complex matrix M (1,0) * {2 2} (2,2) PUT or B) Leave M real & transform (2,2) into algebraic '(2,2)' M {2 2} (2,2) —>Q PUT Your given solution B is cleaner (simpler) or more appropriate. Regards, Gil RE: HP49-HP50 (a, b) into 'a+bi' - BruceH - 03-18-2023 10:04 PM (03-13-2023 04:07 PM)Gil Wrote: I want to convert a complex Sorry - bit late in replying. How about: Code: « → c 'RE(c) + IM(c)*i' » 'C' STO Then, if you have (3,4) on the stack you just run C to get '3+4*i'. If you need to do this frequently then put C into the custom menu. RE: HP49-HP50 (a, b) into 'a+bi' - Gil - 03-18-2023 10:42 PM Nice — provided , of course, you set previously flag -27. The same applies to —>Q (shorter than your suggested solution, but the latter needs RAD mode). My solution with string \<< (5.,6.) C\->R "*i" + "'" ROT + "+" + SWAP + OBJ\-> \>>, valid in any configuration, but not at all nice. NB Try (-5 - 6) with the above solutions: you will never get the simple '-5-6*i', but, instead, '-(5+6*i)' or '-5.+-6.*i'. Apparently, there is no way in the algebraic results to get, instead of the unnecessary 'a+-b', the simple (more straightforward) 'a-b'. RE: HP49-HP50 (a, b) into 'a+bi' - Joe Horn - 03-19-2023 04:34 AM (03-18-2023 10:42 PM)Gil Wrote: NB (-5.,-6.) →Q DISTRIB --> '-5-6*i' RE: HP49-HP50 (a, b) into 'a+bi' - Gil - 03-19-2023 03:26 PM Again — as usual, it worked. Thanks to the HP Forum master(s). Regards, Gil RE: HP49-HP50 (a, b) into 'a+bi' - Gil - 03-20-2023 01:17 AM About Bruce small program « → c 'RE(c) + IM(c)*i' » 'C' STO Beside flag -27 for a+bi, you have to be - in exact mode (-105 CF) - & in complex mode (-103 SF), so that your program could be « PUSH -27 SF -103 SF 105 CF→ c 'RE(c) + IM(c)*i' POP » 'C' STO About John Keith suggestion: (5.6 7.9) —>Q returns, logically, '(56+79*i)/10' (and not the simpler '5.6+7.9*i'). RE: HP49-HP50 (a, b) into 'a+bi' - John Keith - 03-20-2023 05:39 PM (03-20-2023 01:17 AM)Gil Wrote: About John Keith suggestion: That is because →Q converts approximate numbers into exact rational numbers. '5.6+7.9*i' may seem simpler but the HP49/50 typically represent approximate numbers in the form (5.6, 7.9) while representing exact complex numbers in the form '3*4+i'. RE: HP49-HP50 (a, b) into 'a+bi' - Gjermund Skailand - 03-20-2023 08:24 PM I take this opportunity to mention a nice feature of the HP50g Note ->Q and ->QPi is using the number of digits shown when converting to rationals, or simple symbolics. Try A) Exact mode Mode, number format std 2. 5. SQRT * -->NUM ->QPi result in 2 SQRT(5) (symbolic) 2. 5. SQRT * -->NUM ->Q result in 930249/208010 B) Mode number format fix 3 2. 5. SQRT * -->NUM ->QPi result in 76/17 2. 5. SQRT * -->NUM ->Q result in 161/36 br Gjermund RE: HP49-HP50 (a, b) into 'a+bi' - Gil - 03-20-2023 09:12 PM Nice indeed, this Qpi, working with pi and sqrt, though I have not used very often. Thanks for the hint and other comments. Really, this HP49-HP50 is a huge calculator, with directories, Var-menus, free choice of variables with the exception perhaps regarding the graphing part, not so easy to manage. RE: HP49-HP50 (a, b) into 'a+bi' - John Keith - 03-21-2023 02:23 PM (03-20-2023 08:24 PM)Gjermund Skailand Wrote: 2. 5. SQRT * -->NUM ->QPi result in 2 SQRT(5) (symbolic) That's interesting, I never realized that →QPi returned results different than →Q for values that did not involve pi. RE: HP49-HP50 (a, b) into 'a+bi' - Gil - 03-21-2023 02:36 PM But it does not always work as might be expected: '173*sqrt (123) ' —>NUM 1918.66281561 1) And 1918.66281561 —>Qpi '1826567/952' no SQRT appears. 2) And 1826567/952' —>NUM 1918.66281513≈1918.66281561 |