Skip to content
Varlig Guide
Varlig home

Study and science

Check homework and lab work with units that carry through every step, run statistics on your results and solve equations that are awkward to rearrange by hand. When the units in an answer come out wrong, you know to look again at the formula.

Physics with units

Give every quantity its unit and let Varlig keep track. Kilometres per hour, metres per second squared and kilograms combine into the right unit for each answer.

calc
# A car braking hard from 108 km/h
speed = 108 km/h in m/s gives 30 m/s
deceleration = 6 m/s²
braking distance = speed^2 / (2 * deceleration) gives 75 m
stopping time = speed / deceleration gives 5 s
mass = 1200 kg
kinetic energy = 0.5 * mass * speed^2 in kJ gives 540 kJ
braking force = mass * deceleration gives 7,200 N
braking force * braking distance in kJ gives 540 kJ

Converting the speed to metres per second first keeps every later answer in SI units, and a force times a distance comes out as work, so the last two lines confirm that the brakes remove all the kinetic energy. If you multiply where the formula should divide, the answer shows a tangled unit such as (m/s)²·m/s² instead of metres, a quick sign to check your working. See Arithmetic with units and Powers and roots.

Constants and textbook units

Data books write units with dots, slashes, brackets and superscripts. Type them as they’re printed and the formula works out in the unit it should.

calc
# Heating half a litre of water by 20 degrees
4186 J/kg/°C * 0.5 kg * 20 °C gives 41,860 J
# The gravitational constant, as the data book prints it
G = 6.674e-11 N·m²/kg² gives 6.674e-11 N·m²/kg²
G * 5.972e24 kg * 80 kg / (6371 km)^2 gives 785.5625626253 N
1 N in kg*m/s^2 gives 1 kg·m/s²
1 kg·m²/s² in J gives 1 J
# The speed of sound at sea level
Mach 1 in km/h gives 1,225.044 km/h

*, · and ⋅ all multiply, ^2 and ² both square, and a bracketed denominator groups everything inside it. Base units that spell out a named unit take its name, so the weight of an 80 kg person comes out in newtons; ask for kg*m/s^2 back and you get exactly that. A heat capacity written J/kgK, with the kelvin run on, reads as J/(kg·K) too. See Units from a textbook or datasheet.

Concentrations and solutions

Chemistry and biology quote the same amount as a percentage, a molarity or parts per million. Varlig converts between them, and treats a fraction of water as a concentration.

calc
# 0.00243 mol made up to 25.0 cm³
0.00243 mol / 25.0 cm³ gives 0.0972 mol/L
# Saline at 0.9%
0.9% in g/L gives 9 g/L
# Chlorine at 2 ppm
2 ppm in % gives 0.0002%
1 ppm in mg/L gives 1 mg/L
# Dosing a 200 L tank to 20 ppm
20 ppm * 200 L in g gives 4 g
# Sea water, about 35 parts per thousand
35 ppt of 150 kg gives 5.25 kg

A small amount measured into cubic centimetres reads per litre, which is the unit a molarity is quoted in. Parts per million of water weigh as the water does, so a dose in ppm times a volume gives grams. ppt is parts per thousand, as salinity is written. See Parts per thousand, million and billion.

Statistics on lab results

Put repeated measurements in a list to get the mean, the spread and how far you are from the accepted value.

calc
# Pendulum measurements of g
readings = [9.74 m/s², 9.86 m/s², 9.79 m/s², 9.83 m/s², 9.88 m/s²]
measured = average(readings) gives 9.82 m/s²
spread = stddev(readings)
spread to 2 sf gives 0.056 m/s²
Standard error: spread / sqrt(count(readings)) to 2 sf gives 0.025 m/s²
accepted = 9.81 m/s²
Difference: (measured - accepted) / accepted as % to 2 dp gives 0.1%

average and stddev keep the units of your readings. stddev is the sample standard deviation, the usual choice for repeated measurements. A label before the colon says what each line is, and to 2 sf rounds any line to significant figures, whether it’s a name, a formula or a function’s answer. Write the abbreviation however your subject does: sf, SF, s.f., sig fig and sig. figs all work. A zero that is one of the figures you asked for stays on, so 31.0357 m to 3 sf is 31.0 m rather than 31 m, and the answer shows the precision you actually have. to 2 dp rounds to decimal places instead, and drops trailing zeros. See Summary statistics, Spread and Significant figures.

Solving equations

Give solve an equation, the unknown and a range to search. For simultaneous linear equations, use solve_system.

calc
# Roots of x^2 + 3x - 10 = 0
solve(x^2 + 3x - 10 = 0, x, 0, 5) gives 2
solve(x^2 + 3x - 10 = 0, x, -10, 0) gives -5
# A stone dropped from 45 m: when does it land?
solve(4.9t^2 = 45, t, 0, 10) to 2 dp gives 3.03
# 2x + 3y = 13 and x - y = -1
solve_system([[2, 3], [1, -1]], [13, -1]) gives [2, 3]

solve finds one root between the two limits, so choose limits either side of the root you want. Write the equation the way it looks on paper: 4.9t^2 squares t before multiplying. solve_system takes the coefficients row by row and gives x and y in order. See Find one numerical root and Solve a linear system.

Quick maths checks

Check a formula against a direct calculation, or confirm a derivative or an integral before you hand in your work.

calc
# Sum of the first 20 squares, two ways
sum(k^2, k, 1, 20) gives 2,870
20 * 21 * 41 / 6 gives 2,870
# Slope of x^3 - 4x at x = 2
derivative(x^3 - 4*x, x, 2) gives 8
# Area under x^2 from 0 to 3
integrate(x^2, x, 0, 3) gives 9
# Ways to choose 3 people from 10
10 choose 3 gives 120
# Ways to line up 5 people
5! gives 120
sind(30) gives 0.5

When the direct sum and the formula agree, you can trust the formula for bigger numbers. derivative with a point gives the slope there, and integrate gives the area between two limits. See Finite sums and products, Numerical differentiation and Definite integration.

Make it your own

  • Turn test marks out of 40 into percentages in one line: [34, 29, 38] / 40 * 100.
  • Pace the revision: 40 hours at 4 hours a week gives 10 weeks, and 2 hours in 15 min splits a session into 8 blocks.
  • Read a share straight off the figures: 5 kg of 20 kg is 25% and 20 min of 1 hour is 33.3333333333%.
  • Work in degrees without switching anything: cos(30 deg) gives 0.8660254038, and 1/4 turn in degrees gives 90°.
  • Differentiate a formula with constants in it, such as differentiate(a*x^2 + b*x, x), without giving a and b a value first. See Symbolic differentiation.
  • Check a circuit: 12 V * 2 A gives 24 W, and 5000 mAh / 500 mA shows a battery lasts 10 hours.
  • Find how fast a stone dropped from 45 m lands: sqrt(2 * 9.81 m/s² * 45 m) to 3 sf gives 29.7 m/s.
  • Turn a period into a frequency: 1 / 0.02 s in Hz gives 50 Hz, and 60 rpm in Hz gives 1 Hz, because both count the same turns.
  • Work out a U-value from a thickness and a conductivity: 0.27 m / (0.04 W/mK) gives 6.75 m²·K/W, and 1 / (6.75 m²·K/W) turns it back into 0.1481481481 W/(m²·K).
  • Save a formula you use often as a function: ke(mass, speed) = 0.5 * mass * speed^2, then ke(1200 kg, 30 m/s) in kJ. See Your own functions.