This reference manual goes through the basic features and capabilities of PQcalc. Additional illustration of how to use the program is available through the help button on the user interface. Clicking on one of the examples preloads commands into the input field, and clicking the go button shows the results of the commands. For detailed information about the way the program works, the source code is also available as a resource. This reference manual itself is structured roughly in the order in which calculations are setup, run and interpreted, followed by special topics relevant for teaching with the tool. Each page in the manual consists of a narrative, followed by a table showcasing commands input by the user on the left and program output on the right that illustrate a group of features discussed in the narrative.
t1 = 45.00 s  \(t_{1} = 45.00\ \mathrm{s}\) 
t2 = 45.0 s  \(t_{2} = 45.0\ \mathrm{s}\) 
t3 = 45 s  \(t_{3} = 45\ \mathrm{s}\) 
v = 3.4 m/s  \(v = 3.4\ \frac{\mathrm{m}}{\mathrm{s}}\) 
v = 3.4 m s^1  \(v = 3.4\ \frac{\mathrm{m}}{\mathrm{s}}\) 
R = 8.314 J/(mol K)  \(R = 8.314\ \frac{\mathrm{J}}{\mathrm{K}\ \mathrm{mol}}\) 
R = 8.314 J mol^1 K^1  \(R = 8.314\ \frac{\mathrm{J}}{\mathrm{K}\ \mathrm{mol}}\) 
Names for quantities have to start with a letter, and can't contain spaces (see exceptions below). Otherwise, you can choose any combination of letters, numbers and special characters to name quantities. There are some conventions to format names with subscripts and chemistry markup.
Subscripts are preceded by an underscore, as in v_t. If the name starts with a single letter followed by digits, such as v0, the number is written as subscript (i.e. you don't have to write v_0). Multiple underscores result in multiple subscripts separated by commas in the markedup version. Examples are in the top half of the table.
To show chemical formulae and equations with a minimum of typing, enclose them in brackets. If the name starts with a bracket, they will be retained in the formatted version (this is a convention to write concentrations). If the brackets occur later in a name, they are dropped, and what is inside them is formatted as subscript, with chemical formulae and equations typeset by the mhchem package of LateX (link). Spaces are allowed within the brackets. Examples are in the bottom half of the table.
v_t = 0  \(v_{\mathrm{t}} = 0\) 
v0 = 0  \(v_{0} = 0\) 
v_x_y = 0  \(v_{\mathrm{x},\mathrm{y}} = 0\) 
[Ca^2+] = 0  \([\ce{Ca^2+}] = 0\) 
m[H2O] = 0  \(m_{\ce{H2O}} = 0\) 
K[2NO2 <=> N2O4] = 1  \(K_{\ce{2NO2 <=> N2O4}} = 1\) 
t_total = 3 min + 5. s 
\(t_{\mathrm{total}} = 3\ \mathrm{min} + 5.\ \mathrm{s}\)
\(\ \ \ =3.08\ \mathrm{min}\) 
t_total using s 
\(t_{\mathrm{total}} = 3.08\ \mathrm{min}\)
\(\ \ \ =185.\ \mathrm{s}\) 
v = 50. m / t_total 
\(v = \dfrac{50.\ \mathrm{m}}{t_{\mathrm{total}}}\)
\(\ \ \ =\dfrac{50.\ \mathrm{m}}{185.\ \mathrm{s}}\) \(\ \ \ =0.270\ \frac{\mathrm{m}}{\mathrm{s}}\) 
t_shorter = 100. s  \(t_{\mathrm{shorter}} = 100.\ \mathrm{s}\) 
d_shorter = v * t_shorter 
\(d_{\mathrm{shorter}} = v \cdot t_{\mathrm{shorter}}\)
\(\ \ \ =0.270\ \frac{\mathrm{m}}{\mathrm{s}} \cdot 100.\ \mathrm{s}\) \(\ \ \ =27.0\ \mathrm{m}\) 
# This is a comment  This is a comment 
# Spaces in comments are retained  Spaces in comments are retained 
# The quantity _v_0 refers to the initial velocity  The quantity \(v_{\mathrm{0}}\) refers to the initial velocity 
# The formula of water is [H2O]  The formula of water is \(\ce{H2O}\) 
! 2H2 + O2 > 2H2O  \(\ce{\ 2H2 + O2 > 2H2O }\) 
t_a = 0.05 s t_b = 52.100 s dist = 4.52 m 
\(t_{\mathrm{a}} = 0.05\ \mathrm{s}\)
\(t_{\mathrm{b}} = 52.100\ \mathrm{s}\) \(\mathrm{dist} = 4.52\ \mathrm{m}\) 
t_diff = t_b  t_a 
\(t_{\mathrm{diff}} = t_{\mathrm{b}}  t_{\mathrm{a}}\)
\(\ \ \ =52.100\ \mathrm{s}  0.05\ \mathrm{s}\) \(\ \ \ =52.05\ \mathrm{s}\) 
t_ratio = t_a / t_b 
\(t_{\mathrm{ratio}} = \dfrac{t_{\mathrm{a}}}{t_{\mathrm{b}}}\)
\(\ \ \ =\dfrac{0.05\ \mathrm{s}}{52.100\ \mathrm{s}}\) \(\ \ \ =1\times 10^{3}\) 
v = dist / (t_a + t_b) 
\(v = \dfrac{\mathrm{dist}}{t_{\mathrm{a}} + t_{\mathrm{b}}}\)
\(\ \ \ =\dfrac{4.52\ \mathrm{m}}{0.05\ \mathrm{s} + 52.100\ \mathrm{s}}\) \(\ \ \ =\dfrac{4.52\ \mathrm{m}}{52.150\ \mathrm{s}}\) \(\ \ \ =0.0867\ \frac{\mathrm{m}}{\mathrm{s}}\) 
PQcalc supports a limited set of functions. They were chosen to cover the basic needs of a General Chemistry course. It is trivial to add other functions, especially if they are already available in python's math package. The following functions accept a dimensionless argument and result in a dimensionless value:
v = dist/t_a + t_b 
dist/t_a + t_b
Calculation failed: Units in sum not compatible
\(\mathrm{problem} = \dfrac{\mathrm{dist}}{t_{\mathrm{a}}} + t_{\mathrm{b}}\) \(\ \ \ =\dfrac{4.52\ \mathrm{m}}{0.05\ \mathrm{s}} + 52.100\ \mathrm{s}\) \(\ \ \ =90.\ \frac{\mathrm{m}}{\mathrm{s}} + 52.100\ \mathrm{s}\) 
log_fails = log(dist) 
log(dist)
Calculation failed: Can't take log() of quantity with units
\(\mathrm{problem} = \mathrm{log}(\mathrm{dist})\) \(\ \ \ =\mathrm{log}(4.52\ \mathrm{m})\) 
sqrt_ok = sqrt(t_a * t_b) 
\(\mathrm{sqrt}_{\mathrm{ok}} = \sqrt{t_{\mathrm{a}} \cdot t_{\mathrm{b}}}\)
\(\ \ \ =\sqrt{0.05\ \mathrm{s} \cdot 52.100\ \mathrm{s}}\) \(\ \ \ =\sqrt{2.61\ \mathrm{s}^{2}}\) \(\ \ \ =1.6\ \mathrm{s}\) 
sqrt_warning = sqrt(t_a) 
\(\mathrm{sqrt}_{\mathrm{warning}} = \sqrt{t_{\mathrm{a}}}\)
\(\ \ \ =\sqrt{0.05\ \mathrm{s}}\) \(\ \ \ =0.22\ \mathrm{s}^{1/2}\) Warning: Units have noninteger exponents 1/2

ΔP = 5.0 atm  760 mmHg 
\(\mathrm{ΔP} = 5.0\ \mathrm{atm}  760\ \mathrm{mmHg}\)
\(\ \ \ =4.0\ \mathrm{atm}\) 
ΔP using mmHg 
\(\mathrm{ΔP} = 4.0\ \mathrm{atm}\)
\(\ \ \ =3.0\times 10^{3}\ \mathrm{mmHg}\) 
ΔP using m kg 
\(\mathrm{ΔP} = 3.0\times 10^{3}\ \mathrm{mmHg}\)
\(\ \ \ =4.1\times 10^{5}\ \frac{\mathrm{kg}}{\mathrm{m}\ \mathrm{s}^{2}}\) 
ΔP using Pa 
\(\mathrm{ΔP} = 4.1\times 10^{5}\ \frac{\mathrm{kg}}{\mathrm{m}\ \mathrm{s}^{2}}\)
\(\ \ \ =4.1\times 10^{5}\ \mathrm{Pa}\) 
psi = 14.69594877551 atm ΔP in psi 
\(\mathrm{psi} = 14.69594877551\ \mathrm{atm}\)
\(\mathrm{ΔP} = \dfrac{\mathrm{ΔP}}{\mathrm{psi}}\mathrm{\ \mathrm{psi}}\) \(\ \ \ =\dfrac{ΔP}{14.69594877551\ \mathrm{atm}}\mathrm{\ \mathrm{psi}}\) \(\ \ \ =\dfrac{4.1\times 10^{5}\ \mathrm{Pa}}{14.69594877551\ \mathrm{atm}}\mathrm{\ \mathrm{psi}}\) \(\ \ \ =0.272\mathrm{\ \mathrm{psi}}\) 
P2 = ΔP * 2 
\(P_{2} = \mathrm{ΔP} \cdot 2\)
\(\ \ \ =4.1\times 10^{5}\ \mathrm{Pa} \cdot 2\) \(\ \ \ =8.1\times 10^{5}\ \mathrm{Pa}\) 
The __tutor__ and __checkunits__ switches are for the beginning student. __tutor__ mirrors the student input as plain text in the output before showing the formatted output. This gives the student a direct comparison of plain text input and interpretation, and is good practice of when parentheses are needed in the linear plain text input. The __checkunits__ switch causes PQcalc to infer the dimensions of quantities from the first letter of the chosen name. For example, t0 is expected to have dimensions of time, while T0 is expected to have dimensions of temperature. If the units given to the quantities do not meet these expectations, a warning message is issued.
The switches __skip__, __showuncert__ and __fracunits__ are for advanced students. Turning on __skip__ suppresses showing the intermediate steps in the arithmetic. This may be advantageous for multistep calculations to save screen space and allow a better overview of the entire argument leading to the desired result. Turning on __showuncert__ switches to a slightly more sophisticated treatment of error propagation, where the uncertainty in the least significant digit is given explicitly. For example, a result would be given as a = 4.531(5) instead of a = 4.531. It is possible to enter numbers in this format as well, if uncertainties are known to this level of detail (e.g. if average value and standard error of the average are known based on multiple measurements of a quantity). Turning on __fracunits__ suppresses a warning message when units have fractional exponents, e.g. when calculating a rate constant reaction of a reaction with reaction order one half.
To automatically turn on switches for a group of students, you can set switches in the link to the PQcalc site. The switches stay turned on for the remainder of the session unless turned of explicitly by setting them to zero, or by pressing the reset button. For example, running PQcalc through the following link would turn on features for beginning students: ktheis.pythonanywhere.com/custom?switch=tutor*checkunits.
__tutor__ = 1 m[MgSO4] = 34.563 g 
>>> m[MgSO4] = 34.563 g\(m_{\ce{MgSO4}} = 34.563\ \mathrm{g}\) 
__checkunits__ = 1 m[NaCl] = 3.4 mol 
\(m_{\ce{NaCl}} = 3.4\ \mathrm{mol}\)
Warning: \(m_{\ce{NaCl}}\) looks like a mass, but units are strange

#normal behaviour, no switches m_total = m[MgSO4] + m_beaker 
\(m_{\mathrm{total}} = m_{\ce{MgSO4}} + m_{\mathrm{beaker}}\)
\(\ \ \ =34.563\ \mathrm{g} + 128.3\ \mathrm{g}\) \(\ \ \ =162.9\ \mathrm{g}\) 
__skip__ = 1 m_total = m[MgSO4] + m_beaker 
\(m_{\mathrm{total}} = m_{\ce{MgSO4}} + m_{\mathrm{beaker}}\)
\(\ \ \ =162.9\ \mathrm{g}\) 
__showuncert__ = 1 m_total = m[MgSO4] + 256.6(2) g 
\(m_{\mathrm{total}} = m_{\ce{MgSO4}} + 256.6(2)\ \mathrm{g}\)
\(\ \ \ =34.563(1)\ \mathrm{g} + 256.6(2)\ \mathrm{g}\) \(\ \ \ =291.2(2)\ \mathrm{g}\) 
t_Trip = 4.3 h d_Trip = 231. km 
\(t_{\mathrm{Trip}} = 4.30\ \mathrm{h}\)
\(d_{\mathrm{Trip}} = 231.\ \mathrm{km}\) 
__hideunits__ = 1 v_Trip = d_Trip / t_Trip 
\(v_{\mathrm{Trip}} = \dfrac{d_{\mathrm{Trip}}}{t_{\mathrm{Trip}}}\)
\(\ \ \ =\dfrac{231.\phantom{\frac{km mol}{kg mol}}}{4.30\phantom{\frac{km mol}{kg mol}}}\) \(\ \ \ =53.7\phantom{\frac{km mol}{kg mol}}\) 
__hidenumbers__ = 1 v_Trip = d_Trip / t_Trip 
\(v_{\mathrm{Trip}} = \dfrac{d_{\mathrm{Trip}}}{t_{\mathrm{Trip}}}\)
\(\ \ \ =\dfrac{231.\ \mathrm{km}}{4.30\ \mathrm{h}}\) \(\ \ \ =\_\_\_\_\_\_\_\_\_\_\_\_\ \frac{\mathrm{km}}{\mathrm{h}}\) 
Internally, PQcalc stores numbers in a format that is limited both in terms of the largest number and the precision of the numbers. The largest number is about \(2 \times 10^{308}\), and if numbers are larger than that, it will result in an error. The smallest positive number is about \(2 \times 10^{16}\), and if you try to make an even smaller number, it will turn into zero. Because of the way numbers are stored, they have a maximum of 16 significant figures, so if more digits are displayed, they carry no information. Most calculations are not affected by these numerical limitations, although very small or very large numbers might be encountered when doing subatomic or astronomical calculations in SI units, the units PQcalc uses internally.
PQcalc works exclusively with scalar real quantities. Thus, it does not support imaginary and complex numbers. It also does not support vectors, matrices or tensors. While it would be trivial to expand the program to deal with these, it would complicate the user interface substantially. It also does not include statistics functions or ways of dealing with large sets of measurements simultaneously. When students have reached a level where this degree of complexity is required to solve problems, it might make sense to switch to a fullfledged math or statistics software package such as matlab, mathematica, R or sage.
Internally, PQcalc assigns every quantity an uncertainty. Quantities defined by their value (e.g. m = 2.4 g) are assigned an uncertainty based on the last digit given, i.e. 0.1 g in the example. For values that lack decimal points (such as n = 1 mol), the uncertainty is set to zero. It is also possible to enter uncertainty using a parentheses format (e.g. m = 2.423(7) g), which in the example would be interpreted as an uncertainty of 0.007 g.
For derived quantities, uncertainties are propagated using a model that assumes gaussian distributions of errors. If there are two quantities q1 and q2 with values v1 and v2 and uncertainties d1 and d2, the uncertainty d3 of the quantity q3 given by the possible binary operations q3 = (q1 op q2) is estimated as:
The source files necessary for installing PQcalc are available on GitHub under ktheis/pqcalc:
To run a server on the internet, you either can use a provider (such as pythonanywhere.com) or run your own host. Again, you will have to have Python 2.7 and web.py installed (with some changes in the server.py file, you could also use a web framework other than web.py). The details of how to start and monitor the web site will depend on the specific circumstances, and it would probably be best to work together with someone who has experience in running a web application.