# Plotting mixing entropy [closed]

Hello I am attempting to write a code for plotting mixing entropy. My graph will not show up. Please give guidance of how to fix my problem.

R = 8.145; n = 1 + ξ;
Subscript[O, 3] = (1 – 2 ξ)/( 1 + ξ);
Subscript[O, 2] = (3 ξ)/(1 + ξ);
M[S_ξ _] := (-n R ((Subscript[O, 3] log Subscript[O, 3]) +
(Subscript[O, 2] log Subscript[O, 2])));

Plot[{M[S, .1], M[S, .2], M[S, .3], M[S, .4], M[S, .5], M[S, .6], M[S, .7], M[S, .8]},
{ξ, 0, 1}]

=================

=================

2

=================

I disagree with belisarius about there being “Too many errors in your code to point them out”. So here goes.

Subscripted variables are fine for formatting symbolic mathematics in publications but not too good for doing computations. So I will start by rewriting your definitions in a form more amenable to computation.

R = 8.145;
n = 1 + ξ;
O3 = (1 – 2 ξ)/n;
O2 = (3 ξ)/n;

Nothing depends on S, so there is no reason to introduce it into M.

M[ξ_] = -(n R (O3 Log[O3] + O2 Log[O2])) // Simplify;

Note that the logarithm function is written Log[…] in Mathematica.

Because I want M to be reduced to its simplest form for efficient evaluation, I perform simplification of your expression for M. Because I want the simplification to be done only once, I use Set ( = ) not SetDelayed ( := ). This gives a nice, compact definition for M.

Definition[M]

M[ξ_] = -8.145*((1 – 2*ξ)*Log[(1 – 2*ξ)/(1 + ξ)] + 3*ξ*Log[(3*ξ)/(1 + ξ)])

Befor plotting, I ask Mathematica to tell me what it knows about the domain of M.

FunctionDomain[M[ξ], ξ]

0 < ξ < 1/2 So there is no need to plot beyond 1/2. Plot[M[ξ], {ξ, 0, .5}] Too many errors in your code to point them out R = 8.145; o[3, ξ_] := (1 - 2 ξ)/(1 + ξ); o[2, ξ_] := 3 ξ/(1 + ξ) M[ξ_] := -(1 + ξ) R (o[3, ξ ] Log@o[3, ξ ] + o[2, ξ ] Log@o[2, ξ ]); Plot[M[ξ], {ξ, 0, 1}]