## What it does

How is PhySyCalc different from other calculators? It allows you to include unit symbols in your calculations, obtaining the answer in the desired unit without those extra unit conversion steps. On top of this great simplification, PhySyCalc knows every fundamental physical constant. It even knows physical properties for elements and isotopes in the periodic table and how to calculate formula weights. This allows you to get numerical answers in the desired unit in a fraction of the time you'd spend on a conventional calculator. PhySyCalc is quick to learn and easy to use. Can't remember a unit symbol? PhySyCalc helps you find and append commonly used units onto a number. PhySyCalc uses a natural infix notation for calculations. This means you can enter and read through the entire expression in full before calculating the result, helping you quickly identify and fix any input errors.

Not only does PhySyCalc save you time, it saves you from mistakes. A conventional calculator gives you an answer, even if you accidentally multiplied instead of dividing. With PhySyCalc you know right away that you entered the calculation wrong because the result has the wrong units.

As a pedagogical tool PhySyCalc offers students better insights in the concepts of physical quantity, dimensionality, and units. A student using PhySyCalc soon understands the connections between the base SI quantities and all the derived quantities.

PhySyCalc's sole ambition is to be the world's best scientific "pocket" calculator.

## Inspiration

Remember this homework problem?

What pressure in atmospheres does 1.25 g of carbon dioxide exert on the walls of a 235.0 mL container at 25.0 °C?

Of course, you need the ideal gas equation, pV = nRT = (m/MW)•RT. You identify the variables

• m is mass of CO2 = 1.25 g,
• T is temperature in Kelvin = 273.15 K+25.0 K = 298.15 K,
• V is volume = 235.0 mL,
• R is gas constant = 8.314510 J/(K • mol),

and dutifully looked up the atomic weights of carbon and oxygen: 12.0107 g/mol and 15.9994 g/mol. You rearrange the expression to calculate pressure: p = (m/MW)•RT/V. You pull out your calculator and plug in the numbers

(1.25/(12.0107 + 15.9994)) • 8.314510 • 298.15 / 235.0 = 0.4707593614408237

and write down 0.471. Next problem, right? Not so fast: don't you need units on that number? Oh yeah, the question asked for the pressure in atmospheres. So, it's 0.471 atmospheres, right? Guess again! Maybe you should write out the calculation with units:

(1.25 g/(12.0107 g/mol + 15.9994 gmol)) • 8.314510 J/(K • mol) • 298.15 K/ 235.0 mL

Rats! Now you have to do two calculations: the numerical one on the calculator (and get 0.471), and the units calculation by hand on paper.

(g/(g/mol))•J/(K•mol)•mL = J/(mol•mL)

OK, the answer is 0.471 J/(mol•mL). But wait, you need the answer in atmospheres! Maybe you used the wrong gas constant? Gosh, this seems like a lot more work than it needs to be.

I agree! That’s why I wrote PhySyCalc. With PhySyCalc you enter the entire calculation with numbers and units and get the numerical answer with the correct units. How would you enter the problem above in PhySyCalc? Check it out.

Input: 1.25 g / fw[CO2] • R • 298.15 K / 235.0 mL .. atm

Output: 2.956977082245343 atm ~ 3.00 atm.

How nice to use "R" for the gas constant and stop worrying about its units. The "fw" function is also incredibly handy for any formula weight needed in a calculation.

## How I built it

A physical quantity is not just a numerical value, but also includes another essential attribute: a unit. Surprisingly, most scientific software libraries ignore this essential attribute, while others simply relegate it into meta-data, leaving the burden of tracking units and dimensionality to the programmer.

I wrote a software library for the physical sciences called PhySy designed from the ground up with intelligent SI unit and dimensionality types accompanying the numerical value of every physical quantity. This is critically important in today's society where physical quantities must also be transmitted between software packages and across networks to various types of electronic devices without losing any of their essential attributes. While there is enormous diversity in how quantities are used in the physical sciences, there is a core set of requirements needed to handle the majority of these applications, and it is for this majority that PhySy is designed.

For all the details on the design and how the PhySy library API works, check out the developer notes:

http://www.physy.org/Developer-Notes

or, just check out PhySyCalc for iOS, PhySyCalc for MacOS, and RMN for MacOS to see the PhySy library in action.

PhySyCalc uses data provided by the National Institute of Standards and Technology (NIST) but is not endorsed or certified by NIST. Atomic Weights and Isotopic Compositions (SRD 144) and CODATA Fundamental Physical Constants (SRD 121)

## Challenges I ran into

While the SI Brochure is exhaustive in laying out the “rules” of the SI system, there was a challenge in handling derived dimensionless units. For example, both angle and solid angle are derived dimensionless quantities. To distinguish between different types of dimensionless units the software model had to keep track of numerator and denominator dimensionalities. This turns out to be important when comparing non-dimensionless quantities, such as angular frequency and frequency. It’s easy for factors of 2π to get lost or added on the way to a numerical answer, but PhySy is able to keep track of these different types of derived dimensionless units and avoid such errors.

Less of a challenge and more of a quandary was avoiding unit symbol collision. There is essentially no difference between a unit and a fundamental constant. Of course, priority in a symbol collision was given to the unit but I had to make difficult decisions for assigning modified symbols for some constants.

## Accomplishments that I'm proud of

The PhySy library engine that is under the hood of PhySyCalc is also used heavily in my multi-dimensional signal processing app for MacOS called RMN. The beauty of having this library is that no units need to be hard coded into the user interface of any science app. Once units are hard coded into an user interface the user base for that app often shrinks to a much smaller subset of scientists and engineers.

## What I learned

Surprisingly, when I’ve shown PhySyCalc to some science educators their first comment was that students shouldn’t use PhySyCalc on homework or exams because it would be cheating. Seriously! Imagine the same comments being made by slide rule wielding instructors to students asking to use the first pocket calculators in the 1970s.

More physical scientists and engineers need to be partnering with modern app developers in writing scientific software that brings scientific tools to the masses with simple and intuitive interfaces. It’s simply shocking that there is no Science and Engineering category on the Apple App Store.

## What's next for PhySyCalc

First on the list is adding more data on physical quantities for chemical compounds. Imagine any physical quantity from NIST (or the CRC) available from a chemical formula (or CAS registry number) inside your “pocket” scientific calculator, e.g., ksp[Ba(OH)2] for solubility product of Ba(OH)2 or η[H2O] for the viscosity of H2O.

As the PhySy library capabilities grow there will be other scientific and engineering app opportunities, but PhySyCalc’s use case will remain as a simple but powerful scientific and engineering calculator.