Using powers in calculations?
Show older comments
Good day,
Som insight why there are two different evaluations for “basically” the same calculus…
u=symunit;
V1 = .15*u.m^3;
p1 = 2*u.bar;
V2 = .02*u.m^3;
gma=1.4;
p2=p1*V1^gma/V2^gma
Output for this coud p2 =((2*(0.1500*[m]^3)^1.4000)/(0.0200*[m]^3)^1.4000)*[bar].
And for…
u=symunit;
V1 = .15*u.m^3;
p1 = 2*u.bar;
V2 = .02*u.m^3;
gma=1.4;
p2=p1*(V1/V2)^gma
Is this one - p2 =33.5827*[bar]
How the program is calculating powers? What's the difference between these two cases?
Answers (1)
Steven Lord
on 2 Sep 2020
They give the same results, just in different forms.
u=symunit;
V1 = .15*u.m^3;
p1 = 2*u.bar;
t1 = (12+273)*u.K;
V2 = .02*u.m^3;
gma=1.4;
p2=p1*V1^gma/V2^gma
p3=p1*(V1/V2)^gma
Now check:
isAlways(p2 == p3) % true
simplify(p2)
simplify(p3) % these two simplify calls give the same result
The bottle of soda sitting next to me says it contains 2 liters, 2 quarts 3.6 fluid ounces, or 67.6 fluid ounces. That's three different ways to describe the same amount of soda.
3 Comments
Andrew
on 2 Sep 2020
Steven Lord
on 2 Sep 2020
My guess is that the symunit functionality in Symbolic Math Toolbox is unwilling to work with fractional dimensions unless you explicitly tell it to simplify the result. (cubic meters)^(1.4) is meters^(4.2) -- what does that represent?
When you divide cubic meters by cubic meters before raising the result to the 1.4 power, you're raising a unitless quantity to that power.
Andrew
on 2 Sep 2020
Categories
Find more on Ordinary Differential Equations in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!