← Projects

Maths Toolkit

A MicroPython CAS and scientific calculator for the Casio fx-CG100. Covers OCR B (MEI) A-Level Maths and Further Maths.

Python
Star on GitHub Everything below is served from here: main at b09d6cd, taken 9 August 2026
Download for the calculator
MicroPython files · maths-toolkit-cg100.zip · 171 kB · b09d6cd sha256 32c81b30cc6907219d69274e63b13becf83a5b20d4248a50a1e6754f621d48a5

Copy the files to the calculator over USB and run maths.py from its Python app.

Not affiliated with or endorsed by Casio. Whether a program may be on your calculator in an exam is your exam board's rule and your responsibility, not this page's. Use at your own risk.

How to install
Connect the calculator

Plug the fx-CG100 into the computer with its USB cable and choose USB Flash on the calculator when it asks. It appears as a removable drive.

Copy the files

Unzip the download and copy every .py file to the root of that drive, not into a folder. There are 27 of them, and they all have to sit at the top level or the imports fail.

Eject and run

Eject the drive, unplug the cable, open the Python app on the calculator, choose maths.py and run it.

Finding your way round

The home menu holds Calculate, Calculus and Algebra, A-Level Maths and Further Maths. The back key goes up a level. Angle mode, and whether working is shown, are both on the home menu.

Exams

Exam mode on the fx-CG100 blocks stored programs. Check your exam board's calculator rules before an exam and clear or lock the calculator as they require.

LicenceMIT
Stars0
Files54
Code1.1 MB
Python 88.0%Markdown 11.8%Other 0.1%YAML 0.1%

Maths Toolkit for the Casio fx-CG100

A calculator app in stock MicroPython 1.9.4 using the built-in casioplot. Three parts: an expression calculator, a computer algebra system, and 263 tools mapped to OCR B (MEI) A-Level Maths (H640) and Further Maths (H645).

tests smoke runtime license

Install

Copy to the root of the calculator's storage:

  • maths.py, casui.py, casutil.py
  • caslex.py, caseng.py, casrender.py, cascalc.py, caspoly.py
  • pure640.py, purecalc.py, stat640.py, mech640.py, proof.py,

vcplx.py, matrix.py, vectors.py, polyroots.py, series.py, hyper.py, polar.py, diffeq.py, fmmech.py, fmstat.py, numeric.py, algos.py, xpure.py, fpt.py

Do not copy casioplot.py. It is a PC stub; the calculator has the real module built in and the stub would shadow it. Also skip tests.py, stress.py, devlint.py and casioshot.py, which are desktop-only.

Run maths.py.

Keys

Menu
up / downmove, wraps
1-9jump to entry
page up / downmove seven
first / last`\<- and ->\`
OK, EXEchoose
backup one level; leaves the app at the top
Expression entry
left / rightmove caret
start / end of line`\<- and ->\`
uprecall last entry
downclear
DELdelete back
backclear; again on an empty line cancels
ALPHAletters a-z
SHIFTsin^-1, cos^-1, tan^-1, ln, log, pi, =, log to a base
CATALOG!, abs(, nCr(, nPr(, sec(, cosec(, cot(, the hyperbolics and their inverses, sech(, cosech(, coth(, logb(, pi, ans, ,

Settings

Both are on the home menu and last for the session; the calculator cannot write files.

Angle mode: DEGREES / RADIANS. Applies to all trig.

Working: SHOWN / HIDDEN. Output lines are one of three kinds. Answers always show. Working shows only in SHOWN. Caveats always show, in both modes: warnings, domain restrictions, verification results, statements that a tool did not finish. 1213 lines are marked working, 640 caveat. tests.py asserts for all 263 tools that HIDDEN output is a subset of SHOWN and never empty.

Modes

Calculate. Type an expression, see a 2D preview, press OK. ans holds the last result. Exact fractions are shown under the decimal. Non-finite results report "undefined" or "overflow".

Calculus & Algebra. Enter f(x) once, then apply operations without retyping: differentiate, integrate, simplify, expand, factorise, collect, partial fractions, solve, definite integral, evaluate, table, graph. The first seven are symbolic; the rest are numeric and use the angle mode.

A-Level Maths and Further Maths hold the section tools below.

Tools

A-Level Maths

SectionnTools
Pure: algebra & trig16Quadratic solver, Simultaneous eqns, Arithmetic seq/sum, Geometric seq/sum, Binomial expansion, Logarithms, Coord geometry, Circle, Trig tools, Solve a triangle, Arc length & sector, Inequalities, Surds & rationalising, Line meets circle, Sequences & behaviour, Proportion k x, k/x
Pure: functions & calculus17Composite fg(x), Inverse function, Domain & range, Modulus \f(x)\, Graph transformations, Parametric d/dx, Parametric -> Cartesian, Implicit d/dx, Integration by substitution, Separation of variables, Stationary points, Constant of integration, Volume of revolution, Mean value of f, Improper integral, Small-angle approx, Exact trig values
Statistics21Summary stats, Freq table mean/var, Discrete RV E,Var, Binomial B(n,p), Normal P(a<X<b), Inverse Normal, HT binomial prop, HT Normal mean z, PMCC + regression, Probability rules, Tree diagram + Bayes, Sampling methods, Stratified sample, Factorial / nCr, Box plot, Histogram, Cumulative freq, Scatter + regression, Venn diagram, Reduce to linear form, Distribution shape
Mechanics15SUVAT solver, Projectiles, Resultant of forces, Resolve a force, Equilibrium check, Newton II F=ma, Friction F=mu R, Friction horiz plane, Friction incline, Pulley (connected), Moments / reactions, Projectile: find the launch, Variable acceleration, Distance vs displacement, Connected particles
Proof5Induction: a sum, Induction: divisibility, Induction: M^n, Disprove by counterexample, Proof methods reference

Further Maths core

SectionnTools
Complex numbers10Arithmetic z, w, Modulus & argument, Polar / exp form, From polar (r,theta), Power z^n (De Moivre), nth roots of z, Quadratic complex roots, Argand plot, Loci in the Argand plane, de Moivre identities
Matrices15Enter A, Enter B, Show A and B, A + B, A - B, k A, A B, Transpose A, Determinant A, Inverse A, Solve A x = b, Eigenvalues 2x2, 2D transform builder, 3D transform builder, Invariant points/lines
Vectors & 3-D13Magnitude \a\, Dot product a.b, Angle between, Cross product a x b, Unit vector, Scalar projection, Parallel / perp test, Point to line dist, Equation of a line, Line meets plane, Point to plane dist, Angle between planes, Skew lines distance
Roots of polynomials6Vieta quadratic, Vieta cubic, Vieta quartic, Quadratic roots, Numeric roots (x), Shift roots by k
Series & Maclaurin7Sum of r, Sum of r^2, Sum of r^3, Maclaurin of f(x), Approx + error, Method of differences, Reference card
Hyperbolic functions8Evaluate sinh, Evaluate cosh, Evaluate tanh, All three at x, arsinh (inverse), arcosh (inverse), artanh (inverse), Reference card
Polar coordinates5(r,theta) -> (x,y), (x,y) -> (r,theta), Plot polar curve, Preset curves, Polar area
Differential equations6First-order linear (IF), Second-order const-coeff, Particular integral, Coupled dx/dt, dy/dt, SHM recogniser, Damping classifier

Further Maths options

SectionnTools
Mechanics (FM)19Momentum & impulse, Restitution, Oblique impact: wall, Oblique impact: spheres, Work/Energy/Power, Projectile path (cartesian), Projectile on an incline, Circular motion, Hookes law / EPE, Elastic equilibrium/energy, Centre of mass, COM by calculus, COM standard bodies, Slide or topple, Couple, Triangle of forces, Relative motion 2-D, Dimensional analysis, Units & conversion
Statistics (FM)25Discrete RV E/Var, Discrete uniform, Poisson pmf/cdf, Binomial pmf/cdf, Geometric dist, Continuous RV E/Var, cdf, median, quartiles, Mode of a pdf, Piecewise pdf, Normal P(a<X<b), Standardise z, Inverse Normal, aX+bY+c combination, nX vs X1+..+Xn, Normal prob plot, PMCC r + test, Spearman rs + test, Regression y=a+bx, Chi-squared GOF, Chi-sq association, CI for mean (z), t interval / paired, CI for proportion, z-test for mean, Simulation
Numerical Methods20Newton-Raphson, Fixed-point iteration, Fixed-point diagnosis, Relaxation iteration, Cobweb / staircase, Order of convergence, Bisection, Integration (trap/mid/Simp), Integration error table, Richardson extrapolation, Aitken acceleration, Numerical derivative, Derivative error table, Newton forward differences, Euler method, Error abs/relative, Error propagation, Error in f(x), Round to s.f., Chop vs round
Modelling w/ Algorithms15Bubble sort, Insertion sort, Quick sort, Bin: first-fit, Bin: first-fit decr, Graph: degrees/incidence, Dijkstra shortest, Prim MST, Kruskal MST, Max flow / min cut, Cut capacity, Critical path, Simplex (max, <=), Simplex 2-stage (>=, =), LP graph 2-D
Extra Pure16Recurrence relation, Recurrence 1st order, Recurrence 2nd order, Verify a recurrence, Recurrence behaviour, Sets and notation, Group theory, Subgroups & Lagrange, Group isomorphism, 2x2 Eigen/diag, Modular arithmetic, Partial derivatives, Surface stationary pts, Tangent plane / normal, Contours & sections, 3x3 Eigen/diag
Further Pure w/ Tech24Plot f(x) curve, De Moivre z^n, nth roots of z, Euler dy/dx=f(x), Runge-Kutta RK2/RK4, Tangent field, Verify a DE solution, Limit of f(x), Asymptotes incl oblique, Stationary pts & cusps, Family of curves, Envelope of a family, Arc length, gcd & lcm, Prime test, Prime factorise, Euler totient phi(n), a^b mod m, Modular inverse, Fermat & Wilson, Pythagorean triples, Pell x^2-n y^2=1, Linear Diophantine, Base -> bin/hex

Device facts

Measured on hardware with hwcheck.py, 2026-08-09.

Recursion ceiling92 frames. tests.py caps at 38 as a margin.
getkey() idleNone, not 0, over 400 samples. casui.readkey treats anything outside KEYCODES as idle.
Screen384 x 192
math members24 of 43 present. atan2 yes; factorial, asinh, acosh, atanh, log2, trunc, degrees, radians, isnan, isinf, isfinite, copysign no. devlint.MATH_OK is pinned to the measured set.
Section modulesAll 19 fit in RAM at once. casui still loads on demand.
Key codesrow*10 + col, 48 readable. [ON] and [AC] have no code.
getkey() costAbout 0 ms held, 8.3 ms idle (TI-Planet). Polling loops need no delay.

Source: fx-CG100/fx-1AU GRAPH Software User's Guide v2.10, pages 141-143.

Screen layout is checked by casioshot.py, which renders any screen to PNG on a PC using the toolkit's own char_w metric and flags overruns of the 384 px width. It draws with a desktop font at matched advances, so it catches overflow, not letterforms.

Constraints

Stock MicroPython 1.9.4. No f-strings, walrus, type annotations, async or yield from. ASCII only. Only math, random and casioplot are importable. No file writes. Recursion is on expression nesting, never input length. devlint.py enforces all of this.

Structure

File
maths.pylauncher
casui.pykeys, menus, input editor, result screens, settings
casrender.py2D typesetter; owns the font metric
caslex.pytokeniser and iterative parser
caseng.pysimplify, differentiate, evaluate, print
cascalc.pyintegrate, solve, definite integral
caspoly.pyexact rational polynomial algebra
casutil.pyshared prompts, formatting, charts
19 section modulesTOOLS list of (label, function) plus run()

Expressions are tuples: ('n', 2), ('v', 'x'), ('+', a, b), ('sin', a). The parser is iterative shunting-yard. Rationals are (numerator, denominator) pairs.

Development

Runs unmodified under desktop CPython; casioplot.py stubs the graphics.

python3 tests.py       # 7108 checks
python3 stress.py      # 443 checks, drives every tool
python3 devlint.py     # MicroPython compliance, 32 files

tests.py auto-discovers tests_*.py, each exposing SECTIONS = [(label, fn)] where fn takes the harness object.

Adding a tool: add it to the module's TOOLS, add assertions to tests.py, add help text to casui.HELP, add it to the table above. Tests enforce the first and the last.

Not covered

SPEC_AUDIT.md checks all 730 H640 and H645 content statements against the code. Nine have nothing behind them.

CodeStatementReason
D14Clean data: missing values, errors, outliersNot a calculator task
SH5Hypothesis test for an average using the Wilcoxon signed rank testNeeds an exact critical-value table that could not be verified to the standard the PMCC and Spearman tables were held to
L5Recognise when a linear programming problem requires an integer solutionNot a calculator task
L6Formulate a range of network problems as linear programming problemsNot a calculator task
N13Explore network algorithms through their LP formulationsNot a calculator task, for the same reason as L6
L11Use a visualisation of a three-dimensional linear programming problemOut of scope for the hardware
L16Handle variables which may be negativeNot built
c2Use software to produce a tangent to a curve at a variable pointOut of scope for the hardware
T10Solve other Diophantine equationsPartly, and open-ended as stated

Probes

hwcheck.py, keyprobe.py, calib_screen.py, fontmetrics.py and fontmetrics2.py are one-off hardware probes, not part of the app.

License

MIT.