I was trying to write some problems to find eigenvalues and eigenvectors of a matrix and want to produce one with complex conjugate answers. To stay consistent with what I have done before, I'd like the answer for the eigenvector as a a vector. However, it appears that there is no mixing of complex numbers (via the Complex context) and vectors (via the Vector context), since you can only have one context.
I noticed how others have asked questions in the problem library, however, I think asking the students to write the complex number as in its real and imaginary parts 1) tips your hand that you are search for such numbers and 2) is not natural. It should just be a vector.
Is there any thoughts on this or is a ComplexVector context needed?
Peter
Dear Peter,
I have written some problems like the ones you want. They're in the National Problem Library in the FortLewis/DiffEq/3-Linear-systems/08-Complex-eigenvalues/ directory. For example, see
FortLewis/DiffEq/3-Linear-systems/08-Complex-eigenvalues/KJ-4-6-04-multians.pg
Best Regards,
Paul Pearson
I have written some problems like the ones you want. They're in the National Problem Library in the FortLewis/DiffEq/3-Linear-systems/08-Complex-eigenvalues/ directory. For example, see
FortLewis/DiffEq/3-Linear-systems/08-Complex-eigenvalues/KJ-4-6-04-multians.pg
Best Regards,
Paul Pearson
The main problem in this case is that the "<" of the Vector context isn't available in Complex context, so you can't create vectors. (And you can't use ijk format, since i is the complex i not the vector i). So to get what you want, you just have to define "<" to do the right thing:
Context("Complex"); Context()->parens->add("<" => {close => ">", type => "Vector"});
Then you can use expressions like
$v = Compute("<1+i,2-3i>");
to get a vector of complex values. Note that things like "norm", "unit", cross product, and dot product from the vector context will not be defined, but if you want those, too, they can be added as well.