HP 35s:Sys. of Lin. Eq. with Complex numbers



#13

HP-35s
I am trying to use the built in linear equation solver using complex numbers. However, after entering all the complex coefficients HP 35s displays a result of "NO SOLUTION."
Why is this happening? Am I doing something wrong? Section 9-7 of the HP 35s manual states: "You can type complex numbers in equations...Equations containing complex numbers can be solved and integrated."
Does anybody know how to solve a system of equations with complex coefficients using the built in linear solve equation? Or maybe a program that can. Any help is greatly appreciated.
Thank You

Edited: 5 May 2008, 10:17 p.m. after one or more responses were posted


#14

My Matrix Multi-tool for the HP 35s program can solve systems of simultaneous equations with complex coefficients (up to 18 equations in 18 unknowns).

Stefan


#15

Thank You Stefan, I will try this program tommorow

#16

Hi, Stefan:

    (Not directly related to this thread) I've followed the link you included above and visited your site. I find it very nice, congratulations and thanks for your efforts in providing a new worthwhile site and contents to the calc community.

    Now, I want to comment on a couple of things you state there, namely:

 

(Re the TI SR-52, the underlining is mine) "This calculator had 224 steps of program memory, 20 registers, and a magnetic card reader. It was only slightly less powerful than the HP-67. "

    Absolutely nope. It was much less powerful than the HP-67, not "only slightly". I did own an HP-67 the instant they were released, wrote many, many highly complex programs for it (many of them I did submit to the HP User's Library), and also had the opportunity of being lent an SR-52 for a month or so. The difference in capabilities was tremendous, there was no way most of my best programs could fit there. I would estimate the SR-52 to be no more than 30%-40% as powerful as the HP-67, if at all.
 

"My teacher (who also taught computer science), was all in favour of the idea, and even said I could use the program during a test. He figured if I was smart enough to program it [...] I obviously knew the algorithm inside out and backwards."

    Same here. My math, finance, and statistics teachers thought likewise and I was permitted to use my HP-25 (first) and my HP-67 (later) in all exams. I specially remember one exam centered on elliptic functions. All my classmates had to look for elliptic sines and cosines and their inverses in awkward, 4-digit tables while my HP-25 would compute them to 8-10 digits in a fraction of the time. The net result was not only uncanny accuracy, but saving more than 30 minutes from some
    90 minutes allotted time, even after thoroughly checking it all before standing up and leaving.

Best regards from V.


#17

Hi Valentin:

Yes, I think you're right. I've replied in more detail in the thread started by Marcus.

Stefan

#18

Jamie --

I'll try an example of a complex-valued linear system from the HP-15C manual tomorrow on the HP-35s, but I wouldn't be surprised if the HP-35s manual has misled you.

True, a variable in an equation or program may contain a complex value, but I'd believe that SOLVE and INTEG act upon only the real-valued portion of the calculated expression, due to limitations of computing power.

Extra algorithmic sophistication would be required in order to find the complex-valued solutions of complex-valued linear systems -- it would entail solving a real-valued system of twice the dimension, after first recognizing that the system is complex-valued.

Of course, it's also possible that your complex-valued system is not linearly independent, and therefore has no solution. However, if my presumption is correct that complex-valued linear-system solution is not supported, you'll need Stefan's program or similar to attain such a capability.

-- KS


Edited: 8 May 2008, 12:57 a.m. after one or more responses were posted


#19

Hi, Karl:

Karl posted:

    [...] I'd believe that SOLVE and INTEG act upon only the real-valued portion of the calculated expression [...]."

      No, there are some equations involving complex values where the built-in SOLVE succeeds in returning a complex root, so your statement doesn't always apply. Alas, this won't work in general which is the reason why I wrote a general-purpose, real/complex solver program for the HP-35S using a way better algorithm than plain-vanilla Newton's method and achieving convergence speeds comparable to the built-in SOLVER.

      You can download the full article (and program) in PDF format from the "Articles" section at my calc web site, it makes for good reading and has a number of interesting examples and techniques.

     

    "[...] it would entail solving a
    real-valued system of twice the dimension, after first recognizing that the system is complex-valued. [...]"

      If by "twice the dimension" you mean that a 5x5 complex system would mandatorily require solving a 10x10 real one, that's not so, you can get by with smaller systems by using algorithms dealing with other than the tired [[A -B][B A]] scheme. In a pinch, you could even try iterative ones, which would demand no greater than the original dimensions.

Best regards from V.

#20

Wonderful article! And useful!

-- Antonio


#21

Best regards from V.

#22

Thank you V, I can't wait to try your program.

Edited: 6 May 2008, 12:04 p.m.


#23

Hi, Jamie:

    Thanks for your interest but be aware that my program solves a single arbitrary equation in a single variable, whether the coefficients and/or roots are real or complex, but it isn't meant to solve a system of linear equations, which is what I understand you're after.

    That task will be explicitly addressed in another Datafile article that my best friend Fernando del Rey is just finishing right now and which does include an HP35s program to do exactly what you want, i.e., solving NxN systems of real- or complex-valued linear equations for arbitrary N limited only by available RAM.

    If I'm not wrong it's due next issue so you won't have to wait very long, about a month or so if all goes well.

Best regards from V.
#24

Hi, Valentin --

Quote:
KS: [...] I'd believe that SOLVE and INTEG act upon only the real-valued portion of the calculated expression [...]."

VA: No, there are some equations involving complex values where the built-in SOLVE succeeds in returning a complex root, so your statement doesn't always apply. Alas, this won't work in general...


Since you stated it, I'm sure that it's true. However, it would seem almost accidental, as the HP-35s lacks the processing speed (not as fast as Pioneers) to solve for complex-valued roots of user-defined equations. Furthermore, the predecessor RPN-based models did not offer this capability, so some new code would have had to be developed.

The slow HP-15C allows programs that utilize and produce complex-valued numbers to serve as integrands and mathematical functions for SOLVE. However, only the real part of the output is utilized by SOLVE/INTEG. In many cases, though, this is sufficient for practical applications.

Quote:
"KS: [...] it would entail solving a real-valued system of twice the dimension, after first recognizing that the system is complex-valued. [...]"

VA: If by "twice the dimension" you mean that a 5x5 complex system would mandatorily require solving a 10x10 real one, that's not so, you can get by with smaller systems by using algorithms dealing with other than the tired [[A -B][B A]] scheme.


I surmise that the same 5x5 system could be utilized if complex math were supported, but the number of operations should be comparable. "Tired" the real transformation might be, but it is straightforward, easily reversible, and should be generally reliable (except perhaps if the complex numbers somehow transform to an ill-conditioned matrix). It simply provides an explicit decomposition of the complex-valued arithmetic to its real-valued steps, allowing the same algorithms to be used, thus making it a natural approach for the HP-15C.

Here's an illustration for anyone who might not understand the purpose of the HP-15C matrix transformations for complex numbers. For instance, why is the left-side multiplicand transformed to a square matrix, but not the right-side multiplicand?

Py,x ("convert to partioned")
Cy,x ("convert to complex")
AP->A~ (MATRIX 2)
A~->AP (MATRIX 3)

{a, b, c, d} are real-valued; they could be scalars, or matrices with {a, b} and {c, d} of suitably-matching dimensions.

(a+jb)*(c+jd) (two complex-valued multiplicands)

[a b]*[c d] (entered as matrices in "complex" form)

[ a] [ c] ("partitioned" form)
[ b] * [ d]

[ a -b]*[ c] (transformed to square real-valued matrix)
[ b a] [ d]

[ac - bd] ("partitioned" matrix product)
[bc + ad]

[(ac-bd) (bc+ad)] ("complex" form of matrix product)

(ac-bd)+j(bc+ad) (complex-valued result)

These manual procedures make logical sense to those who know their linear algebra well, but are probably not very intuitive to those who don't. Given the limitations of the hardware, however, I'd say that the developers of the HP-15C did a near-ideal job.

-- KS


Edited: 9 May 2008, 3:03 a.m.


Possibly Related Threads...
Thread Author Replies Views Last Post
  HP Prime: complex numbers in CAS. Alberto Candel 1 185 12-06-2013, 02:36 PM
Last Post: parisse
  [HP Prime] Plots containing complex numbers bug? Chris Pem10 7 385 12-05-2013, 07:40 AM
Last Post: cyrille de Brébisson
  Complex Number Entry on Prime Jeff O. 19 770 11-16-2013, 12:34 PM
Last Post: Jeff O.
  plotting diff eq's Richard Berler 2 194 10-28-2013, 11:46 PM
Last Post: Eddie W. Shore
  3rd order ODE diff eq Richard Berler 0 121 10-23-2013, 09:53 PM
Last Post: Richard Berler
  comparing numbers on the WP 34S Kiyoshi Akima 7 404 10-19-2013, 09:28 AM
Last Post: walter b
  HP Prime: Operations with Large Numbers Eddie W. Shore 0 103 10-19-2013, 12:24 AM
Last Post: Eddie W. Shore
  HP Prime complex results Javier Goizueta 0 125 10-06-2013, 12:59 PM
Last Post: Javier Goizueta
  HP Prime Solving Nonlinear System of Equations for Complex Results Helge Gabert 11 556 09-30-2013, 03:44 AM
Last Post: From Hong Kong
  HHC 2013 room numbers David Hayden 2 183 09-20-2013, 05:34 PM
Last Post: sjthomas

Forum Jump: