# Eigenvalues/vectors of jacobian matrix as complex numbers

Hello,

I'm trying to find the eigenvalues and eigenvectors of a jacobian matrix expressed as complex numbers (complex double field?), not an expression (like 1/2 * sqrt(...)...).

sorry for the silly question...

EDIT: Some more info; I'm studying a dynamical system at an equilibrium point. I would like to get an expression for the eigenvectors and values assosiated with the center eigenspace of a "hopf bifurcation". Here is the code in question:

var('alpha1, alpha2, beta1, beta2, mu1, mu2, phi1, phi2, c1, c2, k1, k2, t ') ;
# suggested parameter values:

alpha1 = 0.7; alpha2 = 0.3
beta1 = 0.003; beta2 = 0.0015
mu1 = 0.6; mu2 = 0.4
phi1 = 2.3; phi2 = 4
c1 = 400000; c2 = 100
k1 = 0.0033100000000000;
k2 = 0.000988067680992286;

# The vector field and its jacobian matrix:
f(P, M, L, G,k2) = [phi1*M*(1-M/c1) - (alpha1 + beta1)* P  - k1*P*G, alpha1*P - mu1*M, phi2*G*(1-G/c2) - (alpha2 + beta2)* L  + k2*P*G, alpha2*L - mu2*G];
J = jacobian(f, (P, M, L, G));

# Equilibrium solution:
M4 =((alpha1*alpha2 + alpha1*beta2)*c1*c2*k1*mu1*mu2 + (alpha1^2*alpha2*c1*phi1 - (alpha1*alpha2*c1*c2*k1 + (alpha1^2*alpha2 + alpha1*alpha2*beta1)*c1)*mu1)*phi2)/(alpha2*c1*c2*k1*k2*mu1^2 + alpha1^2*alpha2*phi1*phi2);

P4 = ((alpha2 + beta2)*c1*c2*k1*mu1^2*mu2 + (alpha1*alpha2*c1*mu1*phi1 - (alpha2*c1*c2*k1 + (alpha1*alpha2 + alpha2*beta1)*c1)*mu1^2)*phi2)/(alpha2*c1*c2*k1*k2*mu1^2 + alpha1^2*alpha2*phi1*phi2);

L4 = -((alpha1*alpha2 + alpha2*beta1)*c1*c2*k2*mu1^2*mu2 - alpha1^2*alpha2*c2*mu2*phi1*phi2 - (alpha1*alpha2*c1*c2*k2*mu1*mu2 - (alpha1^2*alpha2 +alpha1^2*beta2)*c2*mu2^2)*phi1)/(alpha2^2*c1*c2*k1*k2*mu1^2 + alpha1^2*alpha2^2*phi1*phi2);

G4 = -((alpha1*alpha2 + alpha2*beta1)*c1*c2*k2*mu1^2 - alpha1^2*alpha2*c2*phi1*phi2 -(alpha1*alpha2*c1*c2*k2*mu1 - (alpha1^2*alpha2 + alpha1^2*beta2)*c2*mu2)*phi1)/(alpha2*c1*c2*k1*k2*mu1^2 + alpha1^2*alpha2*phi1*phi2);

# Now I evaluate it at the fixed point:
J4 = J(P=P4, G=G4, M=M4, L=L4)
J4 = J4(k2=k2)


Now if I do something like;

J4.eigenvalues()


I get an lengthy radical expression. And when computing the eigenvectors:

D, P = J4.eigenmatrix_left()


I get an error...

Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "_sage_input_129.py", line 10, in <module>
exec compile(u'open("___code___.py","w").write("# -*- coding: utf-8 -*-\\n" + _support_.preparse_worksheet_cell(base64.b64decode("RCwgUCA9IEo0LmVpZ2VubWF0cml4X2xlZnQoKQ=="),globals())+"\\n"); execfile(os.path.abspath("___code___.py"))
File "", line 1, in <module>

File "/tmp/tmpYDeAbA/___code___.py", line 2, in <module>
exec compile(u'D, P = J4.eigenmatrix_left()
File "", line 1, in <module>

File "sage/matrix/matrix2.pyx", line 5617, in sage.matrix.matrix2.Matrix.eigenmatrix_left (build/cythonized/sage/matrix/matrix2.c:39965)
IndexError: list index out of range

edit retag close merge delete

@VillageIdiot: could you provide an example of input and output. This will let others provide relevant answers that can best address the issue you are hitting.

Sort by » oldest newest most voted

As @slelievre suggested, you should provide a concrete example, so that we can provide a more adapted answer.

Note that if M is you matrix, you can change the ring on which it is defined as follows (CDF stands for Complex Double Field):

sage: N = M.change_ring(CDF)


Then, you can ask for the eigenvalues and eigenvectors of N.

more

Awesome!! I don't know what it was, but this did the trick. The eigenvalues and vectors are computed in a heartbeat with no error messages.
{"ft_lang_label":"__label__en","ft_lang_prob":0.5222495,"math_prob":0.9900046,"size":3012,"snap":"2020-45-2020-50","text_gpt3_token_len":1199,"char_repetition_ratio":0.17952128,"word_repetition_ratio":0.01923077,"special_character_ratio":0.40836653,"punctuation_ratio":0.18564743,"nsfw_num_words":0,"has_unicode_error":false,"math_prob_llama3":0.99757963,"pos_list":[0],"im_url_duplicate_count":[null],"WARC_HEADER":"{\"WARC-Type\":\"response\",\"WARC-Date\":\"2020-12-01T02:24:04Z\",\"WARC-Record-ID\":\"<urn:uuid:cbd72364-6c79-4a5d-ad74-7d8b3a40fa4c>\",\"Content-Length\":\"62641\",\"Content-Type\":\"application/http; msgtype=response\",\"WARC-Warcinfo-ID\":\"<urn:uuid:c789b09f-23be-4314-be24-7cdc10458587>\",\"WARC-Concurrent-To\":\"<urn:uuid:1ec24862-2478-4fab-866a-666f38239601>\",\"WARC-IP-Address\":\"140.254.118.68\",\"WARC-Target-URI\":\"https://ask.sagemath.org/question/33049/eigenvaluesvectors-of-jacobian-matrix-as-complex-numbers/\",\"WARC-Payload-Digest\":\"sha1:RF3VJ4AJ4ELJGQUJ3HCGJ5OUDQ36ZWJG\",\"WARC-Block-Digest\":\"sha1:SVKOMYGBLWRYHDINVI7XIZ5FOKB2NH6I\",\"WARC-Identified-Payload-Type\":\"application/xhtml+xml\",\"warc_filename\":\"/cc_download/warc_2020/CC-MAIN-2020-50/CC-MAIN-2020-50_segments_1606141542358.71_warc_CC-MAIN-20201201013119-20201201043119-00185.warc.gz\"}"}