summaryrefslogtreecommitdiff
path: root/647/CH9/EX9.18/Example9_18.sce
blob: 66c6a0b23aa3203fa7c40256a1a57758b43ce036 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
clear;
clc;

// Example: 9.18
// Page: 364

printf("Example: 9.18 - Page: 364\n\n");

// Solution

//*****Data******//
n1 = 0.7;// [moles of helium]
n2 = 0.3;// [moles of argon]
R = 8.314;// [J/mol K]
T = 273 + 25;// [K]
//******************//

n = n1 + n2;// [total moles]
x1 = n1/n;// [mole fraction of helium]
x2 = n2/n;// [mole fraction of argon]
deltaG_mix = n*R*T*(x1*log(x1) + x2*log(x2));// [J]
printf("The free energy change of mixing is %.2f J\n",deltaG_mix);

// Since the gases are ideal:
deltaH_mix = 0;// [J]
printf("The enthalpy change of mixing is %d J\n",deltaH_mix);