Expression Evaluator with Unit Handler Functions
MJ@AnalysisChamp.com 4/29/2009 - 1/21/2023
AnalysisChamp.com Complex Unit Converter
AnalysisChamp.com Home
Calculate expressions with units properly handled. Enter the expression value as a formula and input units as a formula. Also enter the desired output units. The expression evaluator will calculate the value, define the conversion factors for the units and verify that the desired output units are proper.
This site can process all MS VBScript functions. See
Microsoft MSDN VBScript Reference and
Microsoft Derived Functions
for specific information.
The names for all units are provided in
AnalysisChamp.com/EEx/AllUnitNames.htm and a shorter list of
more common unit names is located in
AnalysisChamp.com/EEx/FavUnitNames.htm.
Note: Apple Users may find that the double quotes required for string entry cause errors. This is because they do not alway us the ASCII standard chr(34) but instead use others that provide left and right distinctions. A function is provided to obtain proper quotes by selecting [parenthesis & quotes ...] just below the expression entry text box.
MJ@AnalysisChamp.com
4/28/2009 - 1/21/23
Examples are given using short function callout versions
(turn word wrap off before copying strings and pasting into expression evaluator)
Each expression string can be copied from the web page by selecting the text and pressing ctrl^C then inserting into the evaluation field and pressing ctrl^V.
The precision of returned values is not more accurate than 6 significant digits.
Example 00 - Enter parenthese and/or double quotes for Calculations
-[Parentheses & Quotes]-[Enter Example 00]
Some devices do not have the "double quote" in their keyboards and this will bring them to the a text box for use by copy-paste in any function or expression.
------
sc(.)
Example 01 - Temperature Calculations
[Enter Example 01]
What is the absolute temperature, degrees Kelvin, at 32 degrees farenheight (F)?
------
cv(32,"DEGF","DEGK")
= 273.15
Example 02.01 - Length Conversions
[Enter Example 02.01]
What is the length, in feet, of 200 rods?
------
cv(200,"ROD","FT")
= 3300 ft
Example 02.02 - Circle Perimeter
[Enter Example 02.02]
What is the length, in feet, of the perimeter of a circle 12 inches in diameter?
------
cv(12,"PI*IN","FT")
= 3.1415863 ft
Example 02.03 - Circle Area
[Enter Example 02.03]
What is the area, in square feet, of a circle whose diameter is 24 inches?
------
cv(1/4*24^2,"PI*IN^2","FT^2")
= 3.1415863 ft^2
Example 03 - Speed, Torque and Power Calculations
[Enter Example 03]
What is the torque, in pound-feet, of a shaft driving a 10 horsepower load at 3600 revolutions per minute?
Power = torque * speed so torque = power / speed
------
cv(10/3600,"HP/RPM","FT*LBF")
= 14.6 ft*lbf
Example 04 - Gas Law Calculations
[Enter Example 04A]
[Enter Example 04B]
[Enter Example 04C]
What is the volume per mole of an ideal gas (like air) at 0 degC (273.15 degK) and atmoshperic pressure?
p*V = n*R*T so V/n = R*T/p
------
Two methods may be used. Temperature is a biased measurement unit. In this case, if the temperature in degrees Centigrade was used directly it would give erroneous results. First, convert temperature into DEGK...
cv(0,"DEGC","DEGK") = 273.15, then:
cv(1*273.15/1,"(RGC)*(DEGK)/(ATM)","L/MOL")
= 22.4 L/Mole
A second approach involves inserting Base Unit conversion functions into the analysis string...
cv(bv(1,"RGC")*bv(0,"DEGC")/bv(1,"ATM"),"("&bu("RGC")&")*("&bu("DEGC")&")/("&bu("ATM")&")","L/MOL")
= 22.4 L/Mole
... The temperature is properly calculated with this approach in a single expression.
Example 05 - Air Density Calculations
What is the density of air, in pounds per cubic foot, at 15 degC (288 degK) and
atmospheric pressure of 30.10 inches-mercury?
[Enter Example 05]
p*V = n*R*T and mass = moles * grams per mole (gpm) so n/V = p/(R*T) and density = n*gpm/V = p * gpm / (R*T)
------
As in example 4, the temperature needs to be in an absolute measurement system for proper evaluation...
cv(30.1*28.8/(1*288),"IN[HG]*(GM/MOL)/(RGC*DEGK)" , "LBM/FT^3")
= .0763 lbm/ft^3
Alternatevly, the use of Base Value functions inserted into the expression string provides proper results...
cv(bv(30.1,"IN[HG]")*bv(28.8,"GM/MOL")/(bv(1,"RGC")*bv(15,"DEGC")),"("&bu("IN[HG]")&")*("&bu("GM/MOL")&")/(("&bu("RGC")&")*("&bu("DEGC")&"))" , "LBM/FT^3")
= .0763 lbm/ft^3
Example 06 - Propeller Tip Speed Calculations
What is the tip speed, mach at standard sea level atmosphere, of a 72 inch diameter propeller spinning at 2400 RPM?
[Enter Example 06]
V = diameter / 2 * rotational speed
------
cv(72/2*2400,"(IN)*(RPM)","MACH[S]")
= .675 mach
Example 07 - Hydraulic Power Calculations
What is the hydraulic pressure of a 200 horsepower system with 400 gallons per minute flow rate?
[Enter Example 07]
power = pressure * flow rate so pressure = power / flow rate
------
cv(200/400,"(HP)/(GAL/MIN)","PSI")
= 857 psi
Example 08 - Dynamic Pressure Calculation
What is the dynamic pressure, in pascals, of an air-stream at 150 knots? Air density is .0775 pounds per cubic foot.
[Enter Example 08]
q = 1/2 * rho * V^2
------
cv(1/2*.0775*150^2,"(LBM/FT^3)*(KNOT)^2","PA")
= 3696 Pa
Example 09 - Shaft Load with Sheave
What is the side load on a shaft, in Newtons, with a 200 cm diameter sheave if it carries 30 kW power at 55 Hz?
[Enter Example 09]
F = p/(n*r)
------
cv(30/(55*200/2),"(KW)/((HZ)*(CM))","N")
= 86.8 Newton
Example 10 - Radiated Power
What is the ideal radiated power per unit area of a body at 3000 degrees R in watts?
[Enter Example 10]
q = sigma * T^4
------
The temperature is expressed in absolute units and can be used without a primary conversion (see Example 5):
cv(1*3000^4,"(SIGMA)*(DEGR)^4","W/M^2")
= 4.38E5 W/M^2
Example 11.1 - Chemical Equivalent - Pounds(mass) to Moles
How many pounds of caffeine does a 1.35 mole sample weigh? The chemical formula for caffeine is C8-H10-N4-O2.
[Enter Example 11.1]
The formula weight of caffeine is 8*12.01115 + 10*1.00797 + 4*14.0067 + 2*15.9994
------
Addition and subtraction of units must be done carefully because they cannot be mixed within a sum or difference calculation. Checks on the units for each term in such a calculation must be made.
cv(1.35*(8*12.01115+10*1.00797+4*14.0067+2*15.9994),"(MOL)*(GM/MOL)","LBM")
= .578 lbm
Example 11.2 - Chemical Equivalent - Pounds(mass) to Moles
How many pounds of caffeine does a 1.35 mole sample weigh? The chemical formula for caffeine is C8H10N4O2.
[Enter Example 11.2]
The formula weight of caffeine, using the "MolWt" function with lookup capability, is calculated.
------
No need to add units simplifies the calculation shown above.
cv(1.35*MolWt("C8H10N4O2"),"(MOL)*(GM/MOL)","LBM")
= .578 lbm
Example 11.3 - Chemical Formula Weight -
What is the chemical formula weight of water [H2O]?
[Enter Example 11.3]
The molecular weight of water, using the "MolWt" function with lookup capability, is calculated.
------
The MolWt function takes any chemical formula, looks up the element weights and multiplies by the number in molecule, and returns the total weight.
MolWt("H2O")
= 18.01528 AMU
Example 11.4 - Chemical Formula Number (number of protons or electrons) -
How many electron / proton pairs exist in water [H2O]?
[Enter Example 11.4]
Water, chemical formula H2O, consists of two hydrogen (atomic number =1) and one oxygen (atomic number = 8). This identifies that each element of the compound contributes that many proton-electron pairs. The quantity for the compound is found using the "MolNum" function, with lookup capability.
------
The MolNum function takes any chemical formula, looks up the element numbers and multiplies by the number in molecule, and returns the total number. This is equivalent to the number of proton - electron pairs in the molecule.
MolNum("H2O")
= 10 ITEMS
Example 12 - Area of a Circle
[Enter Example 12]
What is the area of a circle, in square feet, if it has a diameter of 2 meter?
Area = pi/4 * Diameter^2
cv(1/4*2^2,"PI*M^2","FT^2")
= 33.8157 ft^2
Example 13 - Temperature of One Billion Standard Cubic Feet of Ideal Gas at one Atmosphere Pressure
What is the temperature, in degrees Farenheight, of 1 billion standard cubic feet of an ideal gas at one atmosphere pressure?
[Enter Example 13A]
Ideal gas law:
p*V = m * RGC * T; solving for T:
T = (m * RGC)/(p * V)
where:
T = temperature, m = quantity (billion standard cubic feet), RGC = universal gas constant, p = pressure and V = volume.
------
The temperature can be returned in biased units (DEGC or DEGF) because the result is converted after evaluation.
cv((1E9*1)/(1*1),"((FT^3)*(ATM))/((BCF)*(RGC))","DEGF")
= 60 degF
The expression can be checked using the base units as follows:
[Enter Example 13B]
cv((bv(1E9,"FT^3")*bv(1,"ATM"))/(bv(1,"BCF")*bv(1,"RGC")),"(("&bu("FT^3")&")*("&bu("ATM")&"))/(("&bu("BCF")&")*("&bu("RGC")&"))","DEGF")
= 60 degF
Example 14 - Molecular weights with English and Metric Units
What is the weight, in pico*grains, of a 1/4 inch long string of carbon atoms if each averages 1.5E-08 centimeters in diameter?
[Enter Example 14]
Carbon has an atomic weight of 12.01115 grams per mole.
total weight = total length * Weight/Atom * number of Atoms/length
where the weight/atom = formula weight / Avogadro's number
------
cv(.25*(12.01115/1)*(1/1.50E-8),"IN*((GM/MOL)/NA)*(1/CM)","PICO*GRAIN")
= .013 pico*grain
Example 15 - Percent Chemical Composition of a Compound
What is the percent composition of chlorine in FeCl3? Iron (Fe) weighs 55.847 grams per mole and chlorine (Cl) weighs 35.453 grams per mole based on atomic weight.
[Enter Example 15]
Molecule Weight = Fe*1+Cl*3 = (1*(55.847)+3*(35.453)) MOL*(GM/MOL)
Chlorine weight per molecule = (35.453)*3
Cl Percentage = (chlorine weight per molecule)/(molecule weight)
------
cv(3*35.453/(1*55.847+3*35.453),"(GM/MOL)/(GM/MOL)","CENTI")
= 65.6 percent (centi)
Example 16 - Centrifugal Force
What is the centrifugal force of a mass of 3.31 lbm rotating at 3000 revolutions per minute (rpm) at a radius of 18 inches?
[Enter Example 16]
Centrifugal Force = mass * radius * rotation speed ^ 2
------
cv(3.31*18*3000^2,"(LBM)*(IN)*(RPM)^2","LBF")
= 15230 lbf
Example 17 - Linear Interpolator
What is the interpolated estimate for y where y=f(x) at x=.20 when y1=2.5 at x1=0.10 and y2=7.5 at x2=0.30?
[Enter Example 17]
The linear interpolation formula is: y = (x-x1)*(y2-y1)/(x2-x1)+y1
------
(.20-.10)*(7.5-2.5)/(.30-.10)+2.5
= 5.0
Example 18 - Heat Conduction thru Wall
How much energy (in watts) is transferred through a concrete wall 8 feet tall x 12 feet wide x 8 inches thick when the temperature difference is 25 degrees F? The coefficient of thermal conductivity for concrete is .5 BTU*ft/(hr*ft^2*degR)
[Enter Example 18]
Heat flow Rate = (Coefficient of Thermal Conductivity * Area * Temperature difference)/thickness
------
cv((.5*(8*12)*25)/8,"((BTU*ft/(hr*ft^2*degR))*(ft*ft)*degR)/in","W")
= 527.5 W
Example 19.01 - Future value given Present worth calculation (F/P)
[Enter Example 19.01]
What is the future value of $200,000.00, if the annual interest rate is 6.5 % and the number of periods is 30 years?
FV = FVperPV(PV, Interest, Periods)
------
FVperPV(200000, 6.5/100, 30)
= 1,322,873.23
Example 19.02 - Present worth given Future value calculation (P/F)
[Enter Example 19.02]
What is the Present worth of $200,000.00 at 30 years from now if the annual interest rate is 6.5 %?
PV = PVperFV(FV, Interest, Periods)
------
PVperFV(200000, 6.5/100, 30)
= 30,237.21
Example 19.03 - Uniform payment amount for given Future value calculation (A/F)
[Enter Example 19.03]
What is the periodic payment amount for a future value of $200,000.00 at 30 years from now if the annual interest rate is 6.5 %?
Amount = AmtperFV(FV, Interest, Periods)
------
AmtperFV(200000, 6.5/100, 30)
= 2,315.49
Example 19.04 - Uniform payment amount for given Present worth calculation (A/P)
[Enter Example 19.04]
What is the periodic payment amount for a Present worth of $200,000.00 for 30 years if the annual interest rate is 6.5 %?
Amount = AmtperPV(PV, Interest, Periods)
------
AmtperPV(200000, 6.5/100, 30)
= 15,315.49
Example 19.05 - Future value of given Uniform payment amount calculation (F/A)
[Enter Example 19.05]
What is the Future value of periodic payments of $150.00 for 30 years if the annual interest rate is 6.5 %?
FV = FVperAmt(Amt, Interest, Periods)
------
FVperAmt(150, 6.5/100, 30)
= 12,956.23
Example 19.06 - Present worth of given Uniform payment amount calculation (P/A)
[Enter Example 19.06]
What is the Present worth of future periodic payments of $150.00 for 30 years if the annual interest rate is 6.5 %?
PV = PVperAmt(Amt, Interest, Periods)
------
PVperAmt(150, 6.5/100, 30)
= 1,958.80
Example 19.07 - Present worth of given Gradient payment amount calculation (P/G)
[Enter Example 19.07]
What is the Present worth of future Gradient payments increasing $25.00 per period for 30 years if the annual interest rate is 6.5 %? The initial (1st) payment is $0.00, the 2nd payment is $25.00, the 3rd payment is $50.00 and so on.
PV = PVperGrad(Grad, Interest, Periods)
------
PVperGrad(25.00, 6.5/100, 30)
= 3,278.11
Example 19.08 - Equivalent uniform payment amount for a given Gradient payment amount calculation (A/G)
[Enter Example 19.08]
What is the equivalent uniform periodic payment of a Gradient payment series that increases $25.00 per period for 30 years if the annual interest rate is 6.5 %? The initial (1st) gradient payment is $0.00, the 2nd payment is $25.00, the 3rd payment is $50.00 and so on.
Amt = AmtperGrad(Grad, Interest, Periods)
------
AmtperGrad(25.00, 6.5/100, 30)
= 251.03
Example 19.09 - Return on Investment (ROI) for given present and future value and time period calculation (ROI)
[Enter Example 19.09]
What is the return on investment (annual percent) for a property purchased 2009 at $155000 and sold 2017 for $253500? The sales cost is 10%.
ROI = GoalSeekVar(.90*253500,0.0,25.0,.01, _
"FVperPV(155000,var/100,(2017-2009))")
------
GoalSeekVar(.90*253500,0.0,25.0,.01, _
"FVperPV(155000,var/100,(2017-2009))")
= 4.96
Example 19.10 - Return on Investment (ROI) for given present and future value and time period calculation (ROI)
[Enter Example 19.10]
ROI = ROI(PV, FV, Periods, iMin, iMax, iStep)
-------
ROI(155000,.90*253500,(2017-2009),0.0,25.0,.01)
= 4.96
Example 20.01 - Convert the decimal number 255 to it's hexadecimal string using VBScript HEX() function
[Enter Example 20.01]
What is the hexadecimal value of 255?
The VBScript "HEX()" function converts a decimal number into it's hexadecimal string. For further info on the HEX() function see MSDN HEX function reference
------
HEX(255)
= FF