>>>>> "David" == David Ronis <ronis at ronispc.chem.mcgill.ca> writes:
David> I have a eigenvalue problem that I'm using maxima to either solve, or at
David> least (via fortran()) set up code that intializes the matrix I want to
David> diagonalize. In testing the code I've written, I've run into a problem.
David> My matrix is hermitian, but nonetheless eigenvalues returns expressions
David> that contain %i. When I use numerical values, and extract the imagpart,
David> it evaluates to 0, which is good, but, it would be nice if I didn't have
David> to do this.
David> David
David> Here's a sample code:
David> kill(all);
David> load("eigen");
David> R:4;
David> g2:ratsimp(exp(-x**2-y**2)*integrate(exp(-s**2+2*(x
David> +y)*s)*s**2,s,minf,inf));
David> a2[n,m]:=diff(g2,x,n,y,m)/sqrt(%pi*2**(n+m)*(n!)*(m!));
David> h[n,m]:= block(if n = m then n+1/2 else 0 )
David> + ((k-1)/2*diff(g2,x,n,y,m))/sqrt(%pi*2**(n
David> +m)*(n!)*(m!));
David> hh:genmatrix(h,R,R,0,0)$
David> hhh:ev(hh,x=0,y=0,k=2);
David> hermitianmatrix:true;
David> eigenvalues(hhh);
Try radcan(rectform(<result of eigenvalues>)). I get something that
is purely real. Not sure if that's the best way, though.
Ray