Continue to Site

# How to find the real and imaginary roots for a complex polynomial?

Status
Not open for further replies.

#### rahul.6sept

##### Full Member level 5
Hi, I want to find the real and imaginary roots of a complex polynomial. I'm using MATHEMATICA for the same. I'm getting some errors and i'm unable to debug the same.
I want to post it here so that someone can guide me so as to get the roots.
I'm not sure if it is the right platform for Mathematica code related questions, but since I'm doing it for Physics hence I'm putting it here.

Code dot - [expand]1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
*Subscript[\[CapitalOmega], 1][Subscript[\[CapitalOmega], r]_Integer,Subscript[\[CapitalOmega], i_]Integer]:=Subscript[\[CapitalOmega], r]+Subscript[I\[CapitalOmega], i];(Subscript[\[CapitalOmega], 2]^2)[Subscript[\[CapitalOmega], r]_Integer,Subscript[\[CapitalOmega], i_]Integer]:=Subscript[\[CapitalOmega], r]^2 (1+4Subscript[I\[CapitalOmega], i]-2Subscript[I\[CapitalOmega], i] Subscript[\[CapitalOmega], r]-3Subscript[\[CapitalOmega], i]^2+2Subscript[\[CapitalOmega], i]^2 Subscript[\[CapitalOmega], r]);*
*(Subscript[\[CapitalOmega], 3]^3)[Subscript[\[CapitalOmega], r]_Integer,Subscript[\[CapitalOmega], i_]Integer]:=Subscript[\[CapitalOmega], r]^3 (1+6Subscript[I\[CapitalOmega], i]-3Subscript[I\[CapitalOmega], i] Subscript[\[CapitalOmega], r]-9Subscript[\[CapitalOmega], i]^2+6Subscript[\[CapitalOmega], i]^2 Subscript[\[CapitalOmega], r]);*
*(Subscript[\[CapitalOmega], 4]^4)[Subscript[\[CapitalOmega], r]_Integer,Subscript[\[CapitalOmega], i_]Integer]:=Subscript[\[CapitalOmega], r]^4 (1+8Subscript[I\[CapitalOmega], i]-4Subscript[I\[CapitalOmega], i] Subscript[\[CapitalOmega], r]-18Subscript[\[CapitalOmega], i]^2+12Subscript[\[CapitalOmega], i]^2 Subscript[\[CapitalOmega], r]);*
*(Subscript[\[CapitalOmega], 5]^5)[Subscript[\[CapitalOmega], r]_Integer,Subscript[\[CapitalOmega], i_]Integer]:=Subscript[\[CapitalOmega], r]^5 (1+10Subscript[I\[CapitalOmega], i]-5Subscript[I\[CapitalOmega], i] Subscript[\[CapitalOmega], r]-30Subscript[\[CapitalOmega], i]^2+20Subscript[\[CapitalOmega], i]^2 Subscript[\[CapitalOmega], r]);**(Subscript[\[CapitalOmega], 6]^6)[Subscript[\[CapitalOmega], r]_Integer,Subscript[\[CapitalOmega], i_]Integer]:=Subscript[\[CapitalOmega], r]^6 (1+12Subscript[I\[CapitalOmega], i]-6Subscript[I\[CapitalOmega], i] Subscript[\[CapitalOmega], r]-45Subscript[\[CapitalOmega], i]^2+30Subscript[\[CapitalOmega], i]^2 Subscript[\[CapitalOmega], r]);*
*(Subscript[\[CapitalOmega], 7]^7)[Subscript[\[CapitalOmega], r]_Integer,Subscript[\[CapitalOmega], i_]Integer]:=Subscript[\[CapitalOmega], r]^7 (1+14Subscript[I\[CapitalOmega], i]-7Subscript[I\[CapitalOmega], i] Subscript[\[CapitalOmega], r]-63Subscript[\[CapitalOmega], i]^2+42Subscript[\[CapitalOmega], i]^2 Subscript[\[CapitalOmega], r]);*
*Subscript[P, 1],Subscript[P, 2],Subscript[P, 3],Subscript[P, 4],Subscript[P, 5],Subscript[A, 10],Subscript[R, 0],Subscript[R, 1],Subscript[R, 2],Subscript[R, 3],Subscript[R, 4],Subscript[R, 5],Subscript[R, 1]^',Subscript[R, 2]^',Subscript[R, 3]^',Subscript[R, 4]^',Subscript[R, 0]^',e ,Subscript[\[Omega], J],Subscript[\[Nu], id],Subscript[\[Omega], d],k,\[Xi]  and \[CapitalDelta]  denotes constant terms *

T1:=(Re[z]+I Im[z])/.z->(1+I);
T2:=Re[z]^2 (1+4 I Im[z]-2I Im[z]Re[z]-3 Im[z]^2+2 Im[z]^2 Re[z])/.z->(1+I);
T3:=Re[z]^3 (1+6 I Im[z]-3I Im[z]Re[z]-9  Im[z]^2+6 Im[z]^2 Re[z])/.z->(1+I);
T4:=Re[z]^4 (1+8 I Im[z]-4I Im[z]Re[z]-18  Im[z]^2+12 Im[z]^2 Re[z])/.z->(1+I);
T5:=Re[z]^5 (1+10I Im[z]-5I Im[z]Re[z]-30  Im[z]^2+20 Im[z]^2 Re[z])/.z->(1+I);
T6:=Re[z]^6 (1+12I Im[z]-6I Im[z]Re[z]-63  Im[z]^2+42 Im[z]^2 Re[z])/.z->(1+I);
T7:=Re[z]^7 (1+14 I Im[z]-63 Im[z]^2-7 I Im[z] Re[z]+42 Im[z]^2 Re[z])/.z->(1+I);

Reduce[Subscript[P, 1](Subscript[P, 2]((Subscript[P, 5]-Subscript[A, 10])(Subscript[R, 1]T1+Subscript[R, 2]T2+Subscript[R, 3]T3-Subscript[R, 4]T4-Subscript[R, 5]T5+Subscript[R, 0])Subscript[\[Nu], id]+I(Subscript[P, 5]-Subscript[A, 10])(Subscript[R, 1]^' T1+Subscript[R, 2]^' T2+Subscript[R, 3]^' T3-Subscript[R, 4]^' T4+Subscript[R, 0]^')Subscript[\[Nu], id]+(Subscript[R, 1]T2+Subscript[R, 2]T3+Subscript[R, 3]T4-Subscript[R, 4]T5-Subscript[R, 5]T6+Subscript[R, 0]T1)Subscript[\[Nu], id] Subscript[\[Omega], J]/\[Xi]+I(Subscript[R, 1]^' T2+Subscript[R, 2]^' T3+Subscript[R, 3]^' T4-Subscript[R, 4]^' T5+Subscript[R, 0]^' T1)Subscript[\[Nu], id] Subscript[\[Omega], J]/\[Xi]+(Subscript[R, 1]T3+Subscript[R, 2]T4+Subscript[R, 3]T5-Subscript[R, 4]T6-Subscript[R, 5]T7+Subscript[R, 0]T2)Subscript[\[Omega], J] Subscript[\[Omega], d]k+I(Subscript[R, 1]^' T3+Subscript[R, 2]^' T4+Subscript[R, 3]^' T5-Subscript[R, 4]^' T6+Subscript[R, 0]^' T2)Subscript[\[Omega], J] Subscript[\[Omega], d]k+I(Subscript[R, 1]T2+Subscript[R, 2]T3+Subscript[R, 3]T4-Subscript[R, 4]T5-Subscript[R, 5]T6+Subscript[R, 0]T1)Subscript[P, 6]-(Subscript[R, 1]^' T2+Subscript[R, 2]^' T3+Subscript[R, 3]^' T4-Subscript[R, 4]^' T5+Subscript[R, 0]^' T1)Subscript[P, 6]+I(Subscript[R, 1]T3+Subscript[R, 2]T4+Subscript[R, 3]T5-Subscript[R, 4]T6-Subscript[R, 5]T7+Subscript[R, 0]T2)Subscript[\[Omega], J] Subscript[\[Omega], d]/\[Xi]-(Subscript[R, 1]^' T3+Subscript[R, 2]^' T4+Subscript[R, 3]^' T5-Subscript[R, 4]^' T6+Subscript[R, 0]^' T2)Subscript[\[Omega], J] Subscript[\[Omega], d]/\[Xi])+Subscript[P, 3]e((Subscript[R, 1]T3+Subscript[R, 2]T4+Subscript[R, 3]T5-Subscript[R, 4]T6-Subscript[R, 5]T7+Subscript[R, 0]T2)Subscript[\[Omega], J] Subscript[\[Omega], d]+I(Subscript[R, 1]^' T3+Subscript[R, 2]^' T4+Subscript[R, 3]^' T5-Subscript[R, 4]^' T6+Subscript[R, 0]^' T2)Subscript[\[Omega], J] Subscript[\[Omega], d]-I(Subscript[R, 1]T2+Subscript[R, 2]T3+Subscript[R, 3]T4-Subscript[R, 4]T5-Subscript[R, 5]T6+Subscript[R, 0]T1)Subscript[P, 7]+Subscript[P, 7](Subscript[R, 1]^' T2+Subscript[R, 2]^' T3+Subscript[R, 3]^' T4-Subscript[R, 4]^' T5+Subscript[R, 0]^' T1)-Subscript[A, 10](Subscript[R, 1]T1+Subscript[R, 2]T2+Subscript[R, 3]T3-Subscript[R, 4]T4-Subscript[R, 5]T5+Subscript[R, 0])Subscript[\[Nu], id]-I(Subscript[R, 1]^' T1+Subscript[R, 2]^' T2+Subscript[R, 3]^' T3-Subscript[R, 4]^' T4+Subscript[R, 0]^')Subscript[A, 10] Subscript[\[Nu], id])-(e(Subscript[R, 1]T1+Subscript[R, 2]T2+Subscript[R, 3]T3-Subscript[R, 4]T4-Subscript[R, 5]T5+Subscript[R, 0])Subscript[\[Nu], id]+I(Subscript[R, 1]^' T1+Subscript[R, 2]^' T2+Subscript[R, 3]^' T3-Subscript[R, 4]^' T4+Subscript[R, 0]^')Subscript[e\[Nu], id]+I(Subscript[R, 1]T2+Subscript[R, 2]T3+Subscript[R, 3]T4-Subscript[R, 4]T5-Subscript[R, 5]T6+Subscript[R, 0]T1)Subscript[e\[Omega], d]-(Subscript[R, 1]^' T2+Subscript[R, 2]^' T3+Subscript[R, 3]^' T4-Subscript[R, 4]^' T5+Subscript[R, 0]^' T1)Subscript[e\[Omega], d]))(1/\[Xi]^2+k^2)+Subscript[P, 4]((Subscript[R, 1]T1+Subscript[R, 2]T2+Subscript[R, 3]T3-Subscript[R, 4]T4-Subscript[R, 5]T5+Subscript[R, 0])Subscript[\[Nu], id]^2+I(Subscript[R, 1]^' T1+Subscript[R, 2]^' T2+Subscript[R, 3]^' T3-Subscript[R, 4]^' T4+Subscript[R, 0]^')Subscript[\[Nu], id]^2+(Subscript[R, 1]T3+Subscript[R, 2]T4+Subscript[R, 3]T5-Subscript[R, 4]T6-Subscript[R, 5]T7+Subscript[R, 0]T2)Subscript[\[Omega], d]^2+I(Subscript[R, 1]^' T3+Subscript[R, 2]^' T4+Subscript[R, 3]^' T5-Subscript[R, 4]^' T6+Subscript[R, 0]^' T2)Subscript[\[Omega], d]^2)+\[CapitalDelta](Subscript[A, 1] Subscript[B, 3](1/\[Xi]+Ik)Subscript[\[Nu], id]^2+Subscript[T2A, 1] Subscript[B, 3](1/\[Xi]+Ik)Subscript[\[Omega], d]^2+Subscript[T1A, 2] Subscript[A, 7] Subscript[\[Lambda], J](k^2+1/\[Xi]^2)(1/\[Xi]-k)Subscript[\[Omega], J] Subscript[\[Nu], id]^2+Subscript[T3A, 2] Subscript[A, 7] Subscript[\[Lambda], J](k^2+1/\[Xi]^2)(1/\[Xi]-k)Subscript[\[Omega], J] Subscript[\[Omega], d]^2-Subscript[A, 2] Subscript[A, 7] Subscript[\[Lambda], J](k^2+1/\[Xi]^2)(1/\[Xi]-k)Subscript[\[Nu], id]^2-Subscript[T2A, 2] Subscript[A, 7] Subscript[\[Lambda], J](k^2+1/\[Xi]^2)(1/\[Xi]-k)Subscript[\[Omega], d]^2)==0]//Simplify

Last edited by a moderator:

#### KlausST

##### Super Moderator
Staff member
Hi,

No test conditions,
No error description..

I can't imagine how someone can help.

Klaus

#### rahul.6sept

##### Full Member level 5
Errors as shown are:

(1) Syntax::tsntxi: "<<1>>,Subscript[P, 2],Subscript[P, 3],Subscript[P, 4],Subscript[P, 5],Subscript[A, 10],Subscript[R, 0],Subscript[R, 1],Subscript[R, 2],Subscript[R, 3],Subscript[R, 4],Subscript[R, 5],Subscript[R, 1]^',Subscript[R, 2]^',Subscript[R, 3]^',Subscript[R, 4]^',Subscript[R, 0]^',e,Subscript[\[Omega], J],Subscript[\[Nu], id],Subscript[\[Omega], d],k,\[Xi] and \[CapitalDelta] denotes constant terms*T1:=(Re[z]+I Im[z])/.z->(1+I);" is incomplete; more input is needed.

(2) Syntax::sntxi: Incomplete expression; more input is needed .

#### wwfeldman

lines 12 and 13 show up differently - it looks like you missed a space, so it isn't recognizing the format as in a few earlier lines and in line 14.
1 + 4 I space between 4 and I
1 + 6 I space between 6 and I
...
1 + 10I no space between 10 and I

Mathematica is an excellent system
but the user interface does not point out syntax errors

Last edited:

Status
Not open for further replies.