Question: Units in manual calculation of expression vs using subs.

I was just using Maple to do a simple calculation but the units came out all complicated. 

The expression in question is work done by a van der Waals gas. The units should come out to Joules per mol. 

When I do the calculation manually (second expression below) I do get that result, albeit in more basic units than Joules.

In the first expression, in which I am using subs to sub in values with units into the expression, the final expression is very complicated. Why?

with(Units:-Simple)

simplify(subs({R = 8.314*Unit('J'/('K'*'mol')), T = 298*Unit('K'), V__1 = Unit('L'/'mol'), V__2 = 50*Unit('L'/'mol'), a = 2.283*Unit('L'^2*'bar'/'mol'^2), b = 0.4278e-1*Unit('L'/'mol')}, -R*T*ln((V__2-b)/(V__1-b))+a*(1/V__1-1/V__2)))

(-9798.522418*Units:-Unit(J/(K*mol))*Units:-Unit(K)*Units:-Unit(L/mol)+2.23734*Units:-Unit(L^2*bar/mol^2))/Units:-Unit(L/mol)

(1)

How do we simplify the units above so they become the same as the units in the same (manual) calculation below?

-(8.314*Unit('J'/('K'*'mol'))*298)*Unit('K')*ln((50*Unit('L'/'mol')-0.4278e-1*Unit('L'/'mol'))/(Unit('L'/'mol')-0.4278e-1*Unit('L'/'mol')))+2.283*Unit('L'^2*'bar'/'mol'^2)/Unit('L'/'mol')

-9570.222418*Units:-Unit(m^2*kg/(s^2*mol))

(2)

NULL

Download Units_-_Subs.mw

Please Wait...