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

expression.shortest(num = None, len = None)

Return a (finite) approximation of the series denoted by the expression.

This is equivalent to calling expression.derived_term().shortest. See its documentation for more details.

See also:

Examples

Boolean Expressions

import vcsn e = vcsn.B.expression('[ab]*a[ab]') e.shortest()

aa\mathit{aa}

e.shortest(4)

aaabaaaaab\mathit{aa} \oplus \mathit{ab} \oplus \mathit{aaa} \oplus \mathit{aab}

e.shortest(len=4)

aaabaaaaabbaababaaaaaaababaaababbaaabaabbbaabbab\mathit{aa} \oplus \mathit{ab} \oplus \mathit{aaa} \oplus \mathit{aab} \oplus \mathit{baa} \oplus \mathit{bab} \oplus \mathit{aaaa} \oplus \mathit{aaab} \oplus \mathit{abaa} \oplus \mathit{abab} \oplus \mathit{baaa} \oplus \mathit{baab} \oplus \mathit{bbaa} \oplus \mathit{bbab}

e.shortest(num=10, len=4)

aaabaaaaabbaababaaaaaaababaaabab\mathit{aa} \oplus \mathit{ab} \oplus \mathit{aaa} \oplus \mathit{aab} \oplus \mathit{baa} \oplus \mathit{bab} \oplus \mathit{aaaa} \oplus \mathit{aaab} \oplus \mathit{abaa} \oplus \mathit{abab}

e.shortest(num=10, len=3)

aaabaaaaabbaabab\mathit{aa} \oplus \mathit{ab} \oplus \mathit{aaa} \oplus \mathit{aab} \oplus \mathit{baa} \oplus \mathit{bab}

Weighted Expressions

e = vcsn.Z.expression('(<2>a)*') e.shortest(len=3)

ε2a4aa8aaa\varepsilon \oplus \left\langle 2\right\rangle \mathit{a} \oplus \left\langle 4\right\rangle \mathit{aa} \oplus \left\langle 8\right\rangle \mathit{aaa}

e.shortest(num=10)

ε2a4aa8aaa16aaaa32aaaaa64aaaaaa128aaaaaaa256aaaaaaaa512aaaaaaaaa\varepsilon \oplus \left\langle 2\right\rangle \mathit{a} \oplus \left\langle 4\right\rangle \mathit{aa} \oplus \left\langle 8\right\rangle \mathit{aaa} \oplus \left\langle 16\right\rangle \mathit{aaaa} \oplus \left\langle 32\right\rangle \mathit{aaaaa} \oplus \left\langle 64\right\rangle \mathit{aaaaaa} \oplus \left\langle 128\right\rangle \mathit{aaaaaaa} \oplus \left\langle 256\right\rangle \mathit{aaaaaaaa} \oplus \left\langle 512\right\rangle \mathit{aaaaaaaaa}