Dear all,
First of all thank you for all your answers. I managed to solve the
problem using allroots as you pointed out. However I don't have
eigenvectors now. Here are a few responses on your comments
> Of course, lapack has a version for complex matrixes, but no one has hooked
> that up for maxima.? It's not difficult to do, but will take a little bit of
> time.? I cannot do that until later next week at the earliest.
That would really make my day and I think it would be useful for other
users. I suppose I can use lapack directly without using maxima, but
the reason for using maxima in the first place, is that before doing
numerical solutions, there's a decent bit of algebra involved.
>> As an additional thing, in an earlier stage of my work (which proved
>> wrong), I was able to reduce the characteristic polynomial to a 4th
>> order equation. Wikipedia says, analytical solutions are possible
>>
>> (http://en.wikipedia.org/wiki/Quartic_function#Summary_of_Ferrari.27s_method)
>> through something known as the Ferrari's method. However, when I tried
>> using 'solve' with this quartic polynomial, maxima just couldn't do
>> it. After many minutes, maxima simply crashed...(it was disconnected
>> from WxMaxima)
>
> solve should be able to produce the roots.? It could be a bug.? Can you send
> the quartic that solve couldn't solve?
>
>>
>> I have to say that the coefficients of the polynomial were quite
>> lengthy, but I feel it should have worked...Naturally when I try a
>> general quartic polynomial like listed in the wikipedia article,
>> things work fine, though I get warned the expression is too long to
>> display. What are the limitations here?...it really is just a lot of
>> algebra...
>
> That's a display problem.? You can do display2d:false, or grind(<result>).
> But it will be very messy.? But if you're eventually going to want numerical
> results, presumably all of the variables in your quartic will be replaced by
> numbers.? It may be better to replace them with numbers in the quartic
> before you try to solve the quartic.
I believe you are right. It's a display problem. Both the terminal
interface of maxima and WxMaxima failed to display the incredibly
bulky expression. I don't really care about this anymore.
Despite solving the problem with allroots, I had to resort to a rather
convoluted process to plot these eigenvalues as function of a
parameter. Let me try to explain:
/*** Characteristic equation for finding the eigenvalues ***/
char_eq(k,gpar,gperp,t,d,C,x) := ''( expand( charpoly(
perturb_mat(k,gpar,gperp,t,d,C,x) , z ) ) )$
auto_val(k,gpar,gperp,t,d,C,y) := allroots( char_eq( k , gpar , gperp
, t , d , C , float( xtp(y,C,d,t) ) ) , z );
Thus, auto_val is an array of all eigenvalues (5, because perturb_mat
is 5x5) as a function of the parameters in question.
Now, my next step was to plot, say the first eigenvalue as a function
of d keeping the other parameters fixed. So I tried the following:
plot2d( realpart( rhs( auto_val( 3.0 , 6.0 , 3.0 , 0 , d , 3.0 , 30.0
)[1] ) ) , [d, -20.0 , 20.0] );
This immediately failed. The error message:
allroots: expected a polynomial in one variable; found variables [ d , z ]
Is there a way to circumvent this limitation? so that allroots gets
the numerical value of d it expects?
My rather messy workaround involved creating an array for the d values
and then creating another one with the outputs from auto_val. Then
putting these into text files and using gnuplot externally to plot the
results. I also did this intentionally to have the numerical results
stored somewhere without having to re-run my maxima code.
Thanks
Andres