MakarovSuites
English
EnglishDeutschРусскийУкраїнськаFrançaisEspañolItalianoPolski
Contact & licences

Math

L-systems

A grammar of a few rules, grown into a plant: rewrite, walk, rewrite deeper.

L-systems — Actual application image
Actual application image

What happens

Lindenmayer wrote plants as strings: an axiom, a few rules that replace each symbol, and a turtle that reads the result - F draws a step, + and − turn, & and ^ pitch, brackets remember where a branch began. Rewrite once and you have a sprig; rewrite five times and a bush. Here the turtle's stroke is revealed in order, so the plant grows from trunk to leaves, the Hilbert curve threads its cube stroke by stroke, the dragon unfolds - and when the stroke is done, the string is rewritten once more and it grows again. The counts are what the grammar produced: the Koch curve has 4^n segments and length (4/3)^n, the dragon 2^n and never repeats one, the 3D Hilbert curve exactly 8^n − 1 through every point of a 2^n cube. Nothing is drawn that the string did not say.

Equations used in the module
Equations
rewrite:  every symbol becomes its rule, n times   (F → F+F−−F+F gives 4^n segments)
turtle:  F draws a unit forward, + − yaw, & ^ pitch, \ / roll, [ ] push and pop the state
Koch:  length (4/3)^n, dimension log 4 / log 3 = 1.2619
Hilbert 3D:  one stroke of 8^n − 1 segments through all 8^n points of a 2^n cube
plant F → F[+F]F[−F][F]:  5^n segments; the bracket count is always balanced

Related experiments

Back to catalogue
Grover's search — Actual application image

Math

Grover's search

Explore amplitude amplification in an unstructured search. A phase oracle changes the sign of the marked amplitude without changing probabilities in the computational basis. The diffusion step turns relative phase into a higher success probability. Too many iterations reduce that probability again.

Gates, phase and what a basis is for — Actual application image

Math

Gates, phase and what a basis is for

Four small circuits with one turnable phase in them, read in the Z, X or Y basis. The phase is a real, located property of the state - the Bloch vector walks the equator with it - and in the wrong basis it is completely invisible: over a whole turn the largest change in any outcome probability is 1e-16. Put a second Hadamard at the end and the same phase decides the answer with certainty. That is interference, and it is the whole difference between a quantum computer and a coin.

Teleportation, and what the two classical bits are for — Actual application image

Math

Teleportation, and what the two classical bits are for

Alice's station holds a message qubit and half of a shared pair; Bob's holds the other half. Walk the protocol step by step - CNOT, H, measurement - and send the two bits down an ordinary channel. Stop them before they arrive and try to guess them; then pick Bob's correction and compare what he holds with the message. Until the bits arrive Bob's qubit is I/2 whatever was sent, and after measuring Alice keeps no copy.