For some reason the result of Plot of the following function:

Clear[x]; Clear[a]; Clear[b];

g = Solve[{0,1}==a v1 + b v2,{a,b}];
alpha = First[a /. g];
beta = First[b /. g];
d[x_, h_, n_]:= alpha l1^n v1 + beta l2^n v2 /. k-> (2 Log[x])/h
Plot[Last[d[x,4,8]], {x,6.78,8}, PlotStyle->Orange]

is this

enter image description here

How can I remove those blank spaces to see the plot of a continuous function?

  • $\begingroup$ Welcome to Mathematica.SE! I suggest that: 1) You take the introductory Tour now! 2) When you see good questions and answers, vote them up by clicking the gray triangles, because the credibility of the system is based on the reputation gained by users sharing their knowledge. Also, please remember to accept the answer, if any, that solves your problem, by clicking the checkmark sign! 3) As you receive help, try to give it too, by answering questions in your area of expertise. $\endgroup$ – bbgodfrey Feb 19 '15 at 15:03
  • $\begingroup$ The plot displays a nice continuous curve in my machine. Try starting a fresh Mathematica session. ¡Suerte! $\endgroup$ – Dr. belisarius Feb 19 '15 at 15:15
  • $\begingroup$ I started a new session and the problem remains the same, but now I know it is a particular problem of mine. ¡Gracias! $\endgroup$ – Antoñito Feb 19 '15 at 15:25
  • 1
    $\begingroup$ The problem are imaginary residuals. You need to Chop your function, then everything is fine. $\endgroup$ – Yves Klett Feb 19 '15 at 15:39
  • 1
    $\begingroup$ @Mr.Wizard super - will take a look asap. $\endgroup$ – Yves Klett Feb 19 '15 at 19:29

Your function seems to produce values with small imaginary components, which Plot deliberately ignores. If you Chop your results, the function seems to plot just fine:

m = {{(1 + 1/k)/x^2, 1/k}, {-1/k, x^2 (1 - 1/k)}};
{{l1, l2}, {v1, v2}} = Eigensystem[m];
g = Solve[{0, 1} == a v1 + b v2, {a, b}];
alpha = First[a /. g];
beta = First[b /. g];
d[x_, h_, n_] := alpha l1^n v1 + beta l2^n v2 /. k -> (2 Log[x])/h
Plot[Last[d[x, 4, 8]] // Chop, {x, 6.78, 8}, PlotStyle -> Orange]

Mathematica graphics

| improve this answer | |
  • $\begingroup$ Thank you very much. That's it! $\endgroup$ – Antoñito Feb 19 '15 at 15:42

Not the answer you're looking for? Browse other questions tagged or ask your own question.