Untitled

mail@pastecode.io avatar
unknown
javascript
2 years ago
599 B
2
Indexable
Never
// calculate initial and final pressures
var R = 8.314; // ideal gas constant
var m = 8; // mass of helium
var M = 4; // molar mass of helium
var n = m / M; // number of moles
var T1 = 158 + 273; // initial temperature
var T2 = 808 + 273; // final temperature
var V1 = 3; // initial volume
var V2 = 0.5; // final volume
var P1 = n * R * T1 / V1; // initial pressure
var P2 = n * R * T2 / V2; // final pressure

// calculate increase in useful work potential
var w = P1 * V1 - P2 * V2; // work done
var DeltaU = Math.abs(w); // increase in useful work potential

console.log(DeltaU); // output: 4980