ICE-WAT

Mixing of ice and water is one of the typical tasks of thermodynamics. You enter the weight and temperatures of both substances and program will return the composition and temperature of the final mixture.

Source code (315 B)


CLRT
PRINT"ICE -T
B=334E3
C=4200
D=2100
E=
INPUT X
CLRT
PRINT"ICE -M
X=X-E
INPUT Y
CLRT
PRINT"WATER-T
INPUT Z
CLRT
PRINT"WATER-M
Z=Z-E
INPUT θ
A=Y-B-1(CZθ+DYX
V=θ+Y-A
L=.1(A+V+ABS A-ABS V
CLRT
PRINT"ICE
PRINT L
T=E+(VC-DA+DABS A-CABS V)*B/2CD(Y+θ
V=L-ABS A+ABS V
WAIT
CLRT
PRINT"WATER
PRINT V
WAIT
CLRT
PRINT"TEMPERATURE
PRINT T