ASKSAGE: Sage Q&A Forum - RSS feedhttps://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Wed, 26 Apr 2023 14:00:43 +0200Getting Dyck path pictures from Dyck wordshttps://ask.sagemath.org/question/67905/getting-dyck-path-pictures-from-dyck-words/I have a list of Dyck words in sage that correspond to Dyck paths, for example:
L=[[1, 0, 1, 0, 1, 1, 0, 1, 0, 0], [1, 0, 1, 1, 0, 1, 0, 1, 0, 0], [1, 0, 1, 1, 1, 0, 0, 1, 0, 0], [1, 1, 0, 0, 1, 1, 0, 1, 0, 0], [1, 1, 0, 1, 0, 0, 1, 0, 1, 0], [1, 1, 0, 1, 0, 0, 1, 1, 0, 0], [1, 1, 0, 1, 0, 1, 0, 0, 1, 0], [1, 1, 0, 1, 0, 1, 1, 0, 0, 0], [1, 1, 0, 1, 1, 0, 0, 0, 1, 0], [1, 1, 0, 1, 1, 1, 0, 0, 0, 0], [1, 1, 1, 0, 0, 1, 0, 1, 0, 0], [1, 1, 1, 1, 0, 0, 0, 1, 0, 0], [1, 1, 1, 1, 0, 1, 0, 0, 0, 0]]
My question is how can I tell sage to print the Dyck paths as a picture for each of those Dyck words in a readable fashion that might help me to find patterns in such a list of Dyck words.
Thanks for any help.klaaaWed, 26 Apr 2023 14:00:43 +0200https://ask.sagemath.org/question/67905/Counting lattice path with Sagehttps://ask.sagemath.org/question/55175/counting-lattice-path-with-sage/ Quite newbie with Sage but I try to count very standard lattice path with steps (1,0) and (0,1) on a grin (0,0) to (m,n) for positive integers n and m. I want also put constraints like for example "not touching the main. diagonal".
I can program it but maybe there are Sage libraries that can help me?
Thanks for any suggestions
GianfrancooldaniThu, 07 Jan 2021 18:21:18 +0100https://ask.sagemath.org/question/55175/Constructing all NE-lattice paths from $(0,0)$ to $(m,n)$https://ask.sagemath.org/question/46087/constructing-all-ne-lattice-paths-from-00-to-mn/If I consider only [Dyck Paths](http://mathworld.wolfram.com/DyckPath.html), I can do write something like this:
DWS=DyckWords(3).list()
for D in DWS:
print(D.height())
to obtain the height of all Dyck paths of length $3$. However, I would like to do the same thing but using [$NE$-lattice paths](https://en.wikipedia.org/wiki/Lattice_path#North-East_lattice_paths) from $(0,0)$ to $(m,n)$. Is there an easy way to do this in Sage?joakim_uhlinThu, 11 Apr 2019 08:50:27 +0200https://ask.sagemath.org/question/46087/DyckWords: workaround for from_ordered_tree?https://ask.sagemath.org/question/34763/dyckwords-workaround-for-from_ordered_tree/** MuPAD-Combinat knows (according to the docs)
for Dyck words the canonical bijection from
ordered trees with n+1 nodes to Dyck words of size n such that if a tree
t has t_1,...,t_k as childs then f(t) = [1,f(t_1),0,...,1,f(t_k),0].
* fromOrderedTree
– canonical bijection from ordered trees to Dyck words
combinat::dyckWords::fromOrderedTree(ordered tree t)
Returns the Dyck word corresponding to the ordered tree t.
* toOrderedTree
– canonical bijection from Dyck words to ordered trees
combinat::dyckWords::toOrderedTree(Dyck word w)
Returns the ordered tree corresponding to the Dyck word w.
** SageMath-Combinat knows
* to_ordered_tree()
* from_ordered_tree() NotImplementedError: TODO
What a pitty! My question is: What is a quick workaround for this missing function?
EDIT:
Since it is so easy as tmontail in his answer shows then I do not
understand why it is not implemented. At least a hint in the docs
seems appropriate.Peter LuschnyWed, 07 Sep 2016 12:18:22 +0200https://ask.sagemath.org/question/34763/