3
$\begingroup$

I am getting an error converting energy unit Pa*m^3 (Pascal * Meters^3) to J (Joules).

pi = Quantity[2.00*10^5, "Pascals"];
Vi = Quantity[4.00*10^-6, ("Meters")^3];
Vf = Quantity[8.00*10^-6, ("Meters")^3];
gamma = 1.4;
W = pi*Vi^(gamma)*Integrate[V^(-gamma), {V, Vi, Vf}]

Answer: 0.484283 m^3*Pa

When I try to convert to Joules:

UnitConvert[W, "Joules"]

I get an error message: Meters^3 Pascals and Joules are incompatible units. Also, I noticed the unit m^3 is actually m^2.999999.

$\endgroup$
0

2 Answers 2

6
$\begingroup$

The error message says:

(Meters)^3. Pascals and Joules are incompatible units, Notice the decimal point at the end of 3. Using Rationalize fixes it.

pi = Quantity[2.00*10^5, "Pascals"];
Vi = Quantity[4.00*10^-6, "Meters"^3];
Vf = Quantity[8.00*10^-6, ("Meters")^3];
gamma = 1.4;
W = pi*Vi^(gamma)*Integrate[V^(-gamma), {V, Vi, Vf}] // Rationalize

UnitConvert[W, "Joules"]

Quantity[0.484283, "Joules"]

$\endgroup$
0
2
$\begingroup$

Use an exact (rational) exponent γ:

pi = Quantity[2.00*10^5, "Pascals"];
Vi = Quantity[4.00*10^-6, ("Meters")^3];
Vf = Quantity[8.00*10^-6, ("Meters")^3];
gamma = 14/10;

W = pi*Vi^(gamma)*Integrate[V^(-gamma), {V, Vi, Vf}]
(*    Quantity[0.484283, ("Meters")^3 "Pascals"]    *)

UnitConvert[W, "Joules"]
(*    Quantity[0.484283, "Joules"]    *)
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.