Section 18.2 Diffusion through a Stagnant Gas Film ,
From a mass balance, we will find equation 18.2-3 and thus that NAz is constant; ie. NAz(z)=NAz(z1)
>  restart;
>  WAz:=z->S*NAz(z); Mass transport of A at position z. S is the cross-sectional area.
>  eq:=WAz(z)-WAz(z+dz); Mass balance
>  deq1:=limit(eq/(S*dz),dz=0)=0;
>  s:=dsolve({deq1,NAz(z1)=NAz1},NAz(z));
>  assign(s);
>  deq:=NAz(z)=-c*DAB*D(xA)(z)+xA(z)*NAz(z); eq 18.0-1 with NBz=0
>  s:=dsolve({deq,xA(z1)=xA1,xA(z2)=xA2},xA(z)); Solving the DE and trying to insert both BCs. Since it is a first order equation, this does not work.
>  s:=dsolve({deq,xA(z1)=xA1},xA(z)); Solving the DE with only the first BC.
>  assign(s); Assign and unapply will make a function out of xA
>  xA:=unapply(xA(z),z);
>  eq:=xA(z2)=xA2; The BC @ z2
>  NAz1:=solve(eq,NAz1); Now we can find NAz at z1 (and for all z)
>  xA1:=1-xB1; That looks like eq. 18.2-14, but we can do a little more
>  xA2:=1-xB2;
>  NAz1; This looks just like eq. 18.2-14 except the numerator and denominator of the ln function are reversed and the sign is changed. We need to tell Maple that xb1 and xb2 are positive reals to switch the log term.
[Maple Math]
>  simplify(NAz1-c*DAB*log(xB2/xB1)/(z2-z1),assume=positive); This completes our derivation of eq. 18.2-14.
>  xA(z); Here is the way xA(z) now looks
>  xBav:=int(1-xA(z),z=z1...z2)/(z2-z1); Let's get the average value of xB in the diffusing region.
>  xBav:=simplify(%,assume=positive);
This is called the log mean value of xB.
>  xBln:=%;
[Maple Math]
>  NAzmaybe:=c*DAB*(xA1-xA2)/((z2-z1)*xBln); eq. 18.2-15
>  NAzmaybe-NAz1; Does this agree with what we got before?
>  simplify(%,assume=positive); We can see it does.
[Maple Math]