2024-01-26 21:20:02 +0200 | received badge | ● Popular Question (source) |
2024-01-26 21:20:02 +0200 | received badge | ● Notable Question (source) |
2021-12-06 12:07:21 +0200 | received badge | ● Notable Question (source) |
2019-11-22 04:01:26 +0200 | received badge | ● Popular Question (source) |
2015-12-30 17:47:11 +0200 | received badge | ● Editor (source) |
2015-12-29 09:30:07 +0200 | asked a question | How to plot lattice paths ? I have seen that the command gives a nice plot of all Dyck paths. Is there an analogous command for the set of all 2^n lattice paths of length n with up- and downsteps of height 1? Please give details, I am a newcomer to Sage. Edit: Sorry if my question is not properly formulated. Perhaps I should modify my question somewhat: The command gives a nice picture (which I unfortunately cannot copy) of the Dyckpath corresponding to [1, 0, 1, 0, 1, 0, 1, 1, 0, 1, 0, 0] by interpreting 0 with a down-step and 1 with an up-step. How can I print a corresponding picture for a word which corresponds to a path with negative values? |
2015-12-23 09:39:11 +0200 | commented answer | How to compute the set of Dyck paths ? Thank you very much. I wanted to do the same as in the second answer: def prim(w): [prim(w) for w in DyckWords(4)] but got TypeError: 'CompleteDyckWords_size_with_category.element_class' object does not support item assignment. How can this be corrected? |
2015-12-23 09:32:53 +0200 | commented answer | How to compute the set of Dyck paths ? Thank you very much. I would also like to know where I can find more about lattice paths in SAGE, e.g. how to compute number of peaks or valleys, Motzkin paths, etc. |
2015-12-23 09:29:49 +0200 | received badge | ● Scholar (source) |
2015-12-22 17:52:36 +0200 | received badge | ● Student (source) |
2015-12-22 17:40:03 +0200 | asked a question | How to compute the set of Dyck paths ? I am new to SAGE and try to experiment with it. So I apologize if my question is too trivial. I am interested to do Dyck paths with SAGE. I understand that D=DyckWords(n) D.list() gives Dyck words as 2n-tuples of n numbers 0,1. But I want to get the corresponding Dyck paths by replacing 1 with an up-step (1,1) and 0 with a down-step (1,-1) represented by the (2n+1)-tuple of the heights of the path. Thus instead of w=[1,1,1,0,0,1,0,0] I want d=[0,1,2,3,2,1,2,1,0] with height h(d)=3. How do I get this? And how to compute the height of the path? More precisely how to compute the set of all (d,h(d))for d in D? |