Math P
Math P is Physics math, by Mike J Hebblethwaite: a maths for the physical world, counted in base ten. Nothing in it disappears: stuff moves. Its 0 is a start point, never an amount. It has no pi, no cos, no sin and no tan: a turn is walked, step by step. Its language is Papa (P for Physics, as Delta is Math D’s).
- Base ten, the way people count today.
- 0 is the start point: where an engine starts, where a walk round a circle begins. A 0 never means “nothing there”.
- Nothing disappears. What leaves one place arrives at another, and the sums always add up.
- No pi, no cos, no sin, no tan. A turn is walked, not looked up.
- Like Math D in everything else. Translate between the two at any time.
- On and off are states, never numbers. A switch that is off is still something: its contacts are apart, and the current waits at the gap. A computer gets its bits 0 and 1 only at its own edge.
Papa, the language
A Papa program is a plain text file ending .papa. Each line does one thing, in order;
// starts a note. Numbers are base ten, to two places at most. After every line the books are
checked: everything put in must still be somewhere. A 0 as an amount, a minus, or moving what is not there is
refused, with its line number.
Things and amounts
thing water 10 litres // a thing, its amount, and a unit word if you like
thing jar ~ grams // starts with only ~ (too small to measure)
say water // water: 10.00 litres
say "hello"
books // everything put in, and where it is now
Moving and splitting
move 2.5 from water to cup
move all from water to cup // water keeps ~
split cake into a b c // even shares; what will not share stays as ~
split bread into d e by 2 1 // given shares
Switches and checks
switch lamp on
check lamp is on // check lamp is on: yes
check jug more than cup // also: less than, same as
Walks, ifs and doings
walk 3 { // steps 1, 2, 3 from the start point 0
say step
if cup more than 0.5 {
say "over half full"
}
}
make pour { // keeps the lines
move 1 from jug to cup
}
do pour // does them
Neighbours, ticks, room, leaks and the shrug
next water air share 1 // 1 percent of the difference moves a tick
tick 5 // time moves on: from more to less, every move shown
fits cup 1 // full takes nothing more: the rest overflows, or spills
leak tank 0.05 // it leaks that much a tick
shrug 20 from motor // gone somewhere not known yet: caught, kept in the books
find 20 from shrug to air // found
Circles
circle(radius 10) // the walk round a circle from 0: how far round?
circle(round 62.81) // the walk finds the radius whose way round is 62.81
Each step moves the walker across by a ten-thousandth of how high it stands, then up by a ten-thousandth of how far across it now is. Radius 10 comes round in 62,873 steps, having walked 62.81.
Running it
Papa’s tools are written in Delta (d-math, cloned beside physics-math). Build them as its HELP.md says, then:
runner/papa examples/kettle.papa // the reader: line by line
runner/papa-build examples/kettle.papa // the compiler, papac, then Delta: a machine program
build/kettle
A compiled program says the same words as the reader: every test and example is run both ways.