Contact
CoCalc Logo Icon
StoreFeaturesDocsShareSupport News AboutSign UpSign In
| Download
Views: 45897
Kernel: Python 3

%demo, the Interactive showcase

import vcsn

In this notebook we present the usage of %demo. The %demo syntax takes an expression or an automaton and applies an algorithm (named by its second argument) on it.

%demo help
Usage: %demo variable algorithm variable either an expression or an automaton. algorithm one that is valid for the variable: [eliminate_state, automaton] Type %demo --help or %demo? to display this message. Example: e = vcsn.B.expression('(ab?){2}') a = e.standard().lift() %demo a eliminate_state

Once it is done it shows an interactive box where the user can play.

For the next examples we define an expression e, for instance a+bb:

e = vcsn.B.expression('a+b{2}'); e

a+bba + b \, b

Automaton

%demo e automaton

Eliminate State

Let define 3 lifted automata a, b and c.

a = e.thompson() ** 2; a = a.lift()
b = e.standard() ** 2; b = b.lift()
c = e.zpc() ** 2; c = c.lift()

Now we call the interactive demonstration of eliminate_state algorithm.

Play with the slider to show each step of the algorithm process.

%demo a eliminate_state
%demo b eliminate_state
%demo c eliminate_state