# Doesn't want to plot!

Posted 10 years ago
7422 Views
|
4 Replies
|
5 Total Likes
|
 hi guys,tell me why doesn't it want to plot ?ClearAll["Global'*"];k = 8.617332478*10^-5; (*eV K^-1*)solution = {};For[T = 250, T <= 280, AppendTo[solution, Solve[2/3*4.6 == Integrate[\[Epsilon]^(1/2)/Exp[(\[Epsilon] - \[Mu][T])/(k*T)],{\[Epsilon], 0,Infinity}], \[Mu][T]]], T++]ListPlot[solution]
4 Replies
Sort By:
Posted 10 years ago
 I post this answer to illustrate alternatives to  For loops; As David Keith has answered:the object returned by Solve is a list of rulesin this parrticular case, \mu (T) can be simplifiedin the following I have avoided capital letter variables (to avoid potential conflicts from internal symbols) and I have just eliminated special characters for simplicityk = 8.617332478*10^-5;fun[temp_] :=  m /. First[Quiet@Solve[2/3*4.6 ==Integrate[eps^(1/2)/Exp[(eps - m)/(k*temp)], {eps, 0, Infinity}], m]]ListPlot[Table[{t, fun[t]}, {t, 250, 280, 1}]]Visualizing: orPlot[fun[t], {t, 250, 280}](a little slow on my machine): The same effect could have been played by simply adding Joined->True to the ListPlot.
Posted 10 years ago
 In your code, Solve produces a rule, not a value. In the code below I modified this to extract the rule, apply it to obtain a value, and append to solution the pair {T,value}, so Listplot would have values for the independent variable. Two side notes:  mu(T) is a symbol, the bracket-T-bracket is not necessary.  Also, it is best to use symbol names that begin with small case because Mathematica built-in symbols begin with capitals. T is actually OK, but as an example, E is the natural log base.Best regards,David ClearAll["Global'*"]; k = 8.617332478*10^-5;(*eV K^-1*)  solution = {};  For[T = 250, T <= 280,    AppendTo[solution, {T, \[Mu][T] /.       Solve[2/3*4.6 ==          Integrate[\[Epsilon]^(1/2)/          Exp[(\[Epsilon] - \[Mu][T])/(k*T)], {\[Epsilon], 0,           Infinity}], \[Mu][T]][[1, 1]]}   ],  T++];ListPlot[solution] Posted 10 years ago
 thanks guys. as far as I've got the previous one solved, I managed to get another problem (similiar though).Seems like it's almost the same thing, but it doesn't want to plot ;) !!! aaa!!  ClearAll["Global'*"] ClearAll[a, b, \[Alpha], \[Phi], r, odp]; b = 0.98; odp = {}; a = 1; \[Phi] = 30 Degree; r = 0.02; \[Chi][\[Alpha]_] := -(1/4) a Sin[      2 \[Alpha]] Sin[\[Phi]] (Cos[\[Phi]] + (Sin^2)[\[Phi]]) r +    Sqrt/2 a (Cos^2)[\[Alpha]] (Sin^2)[\[Phi]/     2] (r (Sin^2)[\[Phi]] + (Cos^2)[\[Phi]]) -    Sqrt/4 a b Cos[\[Phi]] (     Sin^2)[\[Phi]] (1 - 1/2 (Cos^2)[\[Alpha]]) +    1/4 a Sin[2 \[Alpha]] Sin[2 \[Phi]] (Sin^2)[\[Phi]/2];For[\[Alpha] = 0, \[Alpha] <= 2 \[Pi],   AppendTo[odp, {\[Alpha], \[Chi][\[Alpha]]}], \[Alpha] = \[Alpha] +     1 Degree];ListPlot[odp]what's wrong with that now?
Posted 10 years ago
 I think mathematica does not understand you trig nomenclature, so it is not resolving to the numerical value required by ListPlot.In:= (Sin^2)[1.]Out= (Sin^2)[1.]In:= Sin[1.]^2Out= 0.708073