Message Boards Message Boards


Blank plot of complex polynomial equation solution?

Posted 4 months ago
13 Replies
0 Total Likes

Dear All,

I have a code for a complex polynomial equation which I'm trying to plot solving its real and imaginary parts separately. While I try to plot it gives me a blank plot. I need your valuable advice which can help me immensely in solving the same.

Please advice me.

The code is as attached herewith.


13 Replies

You forgot to give a numeric value to the variable y.

I have done it now. It is still not plotting. The equations for x1 and y1 are coupled equations.


I get reasonable plots this way:

Plot[{Im[y1] /. {xi -> 1, y -> 1}, Im[y1] /. {xi -> 3, y -> 1}, 
  Im[y1] /. {xi -> 5, y -> 1}}, {k, 0, 10}]
Plot[{Re[x1] /. {xi -> 1, y -> 1}, Re[x1] /. {xi -> 3, y -> 1}, 
  Re[x1] /. {xi -> 5, y -> 1}}, {k, 0, 10}]

I also used the syntax as you have mentioned.

But here I'm getting the "$RecursionLimit::reclim: Recursion depth of 1024 exceeded."

Hence if someone can provide me valuable advice as how to correct this error will be helpful for me.


When you write x1=... and y1=..., they become definitions, not equations. Is this what you meant?

eqs = {x1 == (-p11*(1/xi + I k) - p44*(1/xi + I k)*(I k - 1/xi) + 
       p66*(1/xi^2 + k^2) + 
       y1*(q22*(1/xi + I k) - q33*(1/xi + I k) (I k - 1/xi) - 
          q44*(1/xi^2 + k^2) - q55*(1/xi - I k)))/(p22 + 
       p33*(I k - 1/xi) - p55*(1/xi^2 + k^2)),
   y1 == (-q11*(1/xi - I k) - 
       x1*(q22*(1/xi + I k) - q33*(1/xi + I k)*(I k - 1/xi) - 
          q44*(1/xi^2 + k^2) - q55*(1/xi - I k)))/(p22 + 
       p33*(I k - 1/xi) - p55*(1/xi^2 + k^2))};
{x1sol, y1sol} = {x1, y1} /. First@Solve[eqs, {x1, y1}];
Block[{y = 1},
 Plot[{Im[y1sol] /. {xi -> 1}, Im[y1sol] /. xi -> 3, 
   Im[y1sol] /. xi -> 5}, {k, 0, 10}]]


The above code is not plotting. It runs but does not plot anything.

Actually I want to plot

(a) x1 versus k (b) y1 versus k


Remove the last semicolon in your code. It suppresses the output.


Now it is plotting for both the real and imaginary.

How can I want to rescale the vertical axis? I want my scale to 1 place after decimal.


Posted 4 months ago

What do you mean by

I want my scale to 1 place after decimal.

Provide a specific example.

Hi, Say for example, my scale in vertical axis reads

y = 2x10^-29, 4x10^-29, 6x10^-29 ......

I can rescale the vertical axis as

y=yx10^-30 which will look my scale as y=0.2, 0.4, 0.6 ..............

Also, if I change the input parameters the plot does not show any change whatsoever. Can you please tell why it is not showing any change if input parameters are varied?


Posted 4 months ago

You asked the same question about a year ago here and I provided a solution. Have you tried it for this example?

Yes, I have tried it, but it is not working, it hides the vertical scale.

I want to write it as I have shown above, but how should it be the syntax I'm not getting.

Posted 4 months ago

The y range in the example from last year is different. The same scale factor cannot be used, it has to be modified for the current example.

Block[{y = 1},
 Plot[{Re[x1sol] /. {xi -> 1}, Re[x1sol] /. xi -> 3, Re[x1sol] /. xi -> 5}, {k, 0, 10},
  PlotRange -> All,
  PlotStyle -> {Directive[Blue, Thick], Directive[Red, Dashed, Thick], Directive[Black, Thick, Dotted]},
  Frame -> True,
  FrameStyle -> Directive[Black, Thickness@0.0125], 
  PlotLegends -> 
      LineLegend[{Style["\[Xi] = 1", Bold, 14], Style["\[Xi] = 3", Bold, 14], Style["\[Xi] = 5", Bold, 14]},
      LegendFunction -> None,
      LegendLayout -> "Column"], {Left, Top}],
  FrameLabel -> {"K", "\!\(\*SubscriptBox[\(\[CapitalOmega]\), \(r\)]\)"},
  LabelStyle -> Directive[Black, Bold, 14],
  RotateLabel -> True,
  AspectRatio -> 0.5,
  FrameTicks -> {{Charting`ScaledTicks[{10^-28 # &, #/10^-28 &}], None}, {Automatic, None}}]]

enter image description here

Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
or Discard

Group Abstract Group Abstract