# How to display All Graph In one Graph

here is my code. for alpha and beta the value is always the same.i just change the value of rho.is it possible all these set value of rho is displayed in one graph? the purpose of this is i want to see the difference of the graph for different values of rho.

Tmp = 0.1316;

a[T_, M_, P_,  ρ_] := D[P^3 + P (-1 + T) + 2 M^2 P  ρ, P];
b[T_, M_, P_,  ρ_] := D[P^3 + P (-1 + T) + 2 M^2 P  ρ, M];
c[T_, M_, P_, α_,  β_,  ρ_] :=
D[M (T - Tmp) Tmp α^2  β +
M^3 Tmp^2 α^2  β + 2 M P^2  ρ, P];
d[T_, M_, P_, α_,  β_,  ρ_] :=
D[M (T - Tmp) Tmp α^2  β +
M^3 Tmp^2 α^2  β + 2 M P^2  ρ, M];
D1[T_, M_, P_, α_,  β_,  ρ_] :=
a[T, M, P,  ρ]*d[T, M, P, α,  β,  ρ] -
b[T, M, P,  ρ]*c[T, M, P, α,  β,  ρ];
D1[T, M, P, α,  β,  ρ]

P[T_, α_,  β_,  ρ_] :=
Sqrt[( α^2  β - 1. T α^2  β +
T α^2  β  ρ -
1. Tmp α^2  β  ρ)/( α^2  β -
1.  ρ^2)];
M[T_, α_,  β_,  ρ_] :=
Sqrt[(-1. T α^2  β + Tmp α^2  β - (
1.  ρ ( α^2  β - 1. T α^2  β +
T α^2  β  ρ -
1. Tmp α^2  β  ρ))/( α^2  β -
1.  ρ^2))/( α^2  β)];

TM[ α_,  β_,  ρ_] :=
Table[{T, M[T, α,  β,  ρ]}, {T, 0, 2, 0.0001}];
TP[ α_,  β_,  ρ_] :=
Table[{T, P[T, α,  β,  ρ]}, {T, 0, 2, 0.0001}];
LTP[ α_,  β_,  ρ_] :=
ListPlot[TP[ α,  β,  ρ],
PlotStyle -> {Purple, PointSize[0.005]}];
LTM[ α_,  β_,  ρ_] :=
ListPlot[TM[ α,  β,  ρ],
PlotStyle -> {Magenta, PointSize[0.005]}];

Manipulate[
Show[LTP[ α,  β,  ρ], LTM[ α,  β,  ρ],
AxesLabel -> {"T", "M/P"},
PlotRange -> {{0, x}, {0, y}},
PlotLabel -> "M/P againts temperature", ImageSize -> Large]
, { α, {0.5, 1, 1.5, 2}}, { β, {0.5, 1, 1.5,
2}}, { ρ, {0.0, -0.01, -0.05, -0.1, -0.5}}, {x, 0.01, 2,
0.01}, {y, 0.01, 2, 0.01}]

• Just make a Table[] and Show[] it? – thedude Mar 12 '16 at 11:10
• Note that your definitions of a, b, c, d, D1 are not used in your Manipulate expression so you may safely omit them from your posted code. That will simplify your question and reduce the effort required to help you. – MarcoB Mar 12 '16 at 15:35

Table is your friend here.

Your Manipulate is very, very slow as written; it would certainly benefit at least from the addition of ContinuousAction -> False (see docs) to prevent update during movement of controls.

More generally, however, you will be much better off to use Plot directly with your expressions for P and M, rather than constructing tables of ListPlot with very granular resolution.

Here is a rewrite of your code which includes all values of ρ at once, and yet evaluates essentially instantaneously for all values of the parameters.

A few changes:

• you had a weird coefficient of 1. in front of Tmp and ρ in your original expressions for P and M. Since Tmp is already at machine precision, multiplying by 1. didn't really change anything there. Removing these factors didn't change the results but cleaned up your code.
• P and M are simple expressions whose definitions do not need to be recalculated every time they are evaluated; they are just placeholders for their corresponding expressions, so you can use Set (=) rather than SetDelayed (:=) in their definition.
• You initial values of x and y led to an empty plot; I indicated an initial value of $1$ for both of them in the Manipulate expression so you at least see a reasonable output when first executing it.

Here is the new code:

Tmp = 0.1316;
P[T_, α_, β_, ρ_] = Sqrt[(α^2 β - T α^2 β + T α^2 β ρ - Tmp α^2 β ρ)/(α^2 β - ρ^2)];
M[T_, α_, β_, ρ_] = Sqrt[(T α^2 β + Tmp α^2 β - (ρ (α^2 β - T α^2 β + T α^2 β ρ - Tmp α^2 β ρ))/(α^2 β - ρ^2))/(α^2 β)];

Manipulate[
Plot[{
Table[M[T, α, β, ρ], {ρ, {0.0, -0.01, -0.05, -0.1, -0.5}}],
Table[P[T, α, β, ρ], {ρ, {0.0, -0.01, -0.05, -0.1, -0.5}}]
},
{T, 0, 2},
AxesLabel -> {"T", "M/P"},
PlotRange -> {{0, x}, {0, y}},
PlotLabel -> "M/P againts temperature",
ImageSize -> Large,
PlotStyle -> {Magenta, Purple}
],
{α, {0.5, 1, 1.5, 2}},
{β, {0.5, 1, 1.5, 2}},
{{x, 1}, 0.01, 2, 0.01},
{{y, 1}, 0.01, 2, 0.01}
] • thank you @MarcoB . I learn something new today from you by comparing your code with mine. anyway 'rho' is electrocoupling of magnetoelectric for my project. now i can interperate the graph. – Nabil Mar 13 '16 at 14:13
• @Nabil you are very welcome! – MarcoB Mar 13 '16 at 14:16