Hey, Gary,

Without seeing your code it's hard to know what is right/wrong about what you're doing. I haven't gotten facile with the Complex package yet, and there are some pitfalls there, so I tend to work on the real number line. That changes your two equations in two (complex) unknowns to four equations in four unknowns. Fortunately it doesn't take long to invert a 4x4 matrix.

This may be your problem -- the matrix inversion routines (that I know of)) all work with real numbers. Complex numbers are implemented as an additional dim of size 2 that runs across {real| imaginary} axis. The matrix inversion routines are probably threading over that dimension, giving you separate inverses of the real 2x2 matrix and the imaginary 2x2 matrix. (That threading ambiguity is the main pitfall in PDL::Complex number handling - routines that are complex-number aware work great, but most such routines are not!).

Another matrix pitfall to watch for: PDL matrices are indexed in (column, row) order, rather than (row, column); this means that they render correctly under print(), but that the indices hook up the opposite way you might expect if you're used to linear algebra with index notation. Thus, if you "print $a" and "print $b" then "print $a x $b" should give you the same answer as if you just multiply the two matrices by hand on paper, in that order. (Contrast, say, IDL, which made the opposite choice -- the matrices are indexed in (row, column) order but render incorrectly when printed). That particular wart is due to conflicting conventions: just about everyone likes to interpret coordinate n-tuples as happening in (x,y,z,...) order, but the mathematical (row, column) order for matrices places the first two in (y,x) order.

Best,
Craig


On Mar 31, 2007, at 5:59 PM, [EMAIL PROTECTED] wrote:

I'm trying to use PDL to trying to solve two simultaneous equations in two unknowns (in which the equations and unknowns contain complex numbers). The problem definition is fully explained at http://www.perlmonks.org/?node=605900

When I attempt to solve for the unknowns by using the PDL inverse matrix, I get some very bizarre results.

PDL offers promise relative to future work, but I'm on the beginning of the learning curve. I would be grateful for any help / explanation what I'm doing wrong.

Thanks, Gary



See what's free at AOL.com.
_______________________________________________
Perldl mailing list
[email protected]
http://mailman.jach.hawaii.edu/mailman/listinfo/perldl

_______________________________________________
Perldl mailing list
[email protected]
http://mailman.jach.hawaii.edu/mailman/listinfo/perldl

Reply via email to