Opened 8 years ago
Closed 7 years ago
#8670 closed enhancement (fixed)
Provide projections methods for word paths
Reported by: | slabbe | Owned by: | slabbe |
---|---|---|---|
Priority: | major | Milestone: | sage-4.7 |
Component: | combinatorics | Keywords: | |
Cc: | abmasse, vdelecroix, robertwb, tjolivet, tmonteil | Merged in: | sage-4.7.alpha2 |
Authors: | Sébastien Labbé | Reviewers: | Franco Saliola, Timo Jolivet |
Report Upstream: | N/A | Work issues: | |
Branch: | Commit: | ||
Dependencies: | Stopgaps: |
Description (last modified by )
Nice mathematical objects can be obtained when projecting appropriately a discrete path (Rauzy fractals for instance).
This patch introduces 3 projection functions for word path. It also adds 2 functions to WordMorphism
and 2 matrix rotation functions to sage/matrix/constructor.py
.
The first 1000 points of the Rauzy fractal :
sage: s = WordMorphism('1->12,2->13,3->1') sage: D = s.fixed_point('1') sage: v = s.pisot_vector() sage: P = WordPaths('123',[(1,0,0),(0,1,0),(0,0,1)]) sage: w = P(D[:1000]) sage: w.projected_plot(v)
See more examples in doctests.
Attachments (4)
Change History (18)
comment:1 Changed 8 years ago by
- Cc abmasse vdelecroix added
- Status changed from new to needs_review
comment:2 Changed 8 years ago by
- Status changed from needs_review to needs_work
comment:3 Changed 8 years ago by
- Cc robertwb added
- Status changed from needs_work to needs_review
I fixed the above problem in the updated patch. Needs review!
Since I am adding two functions to the file sage/plot/plot3d/transform.pyx
, I am also adding Robert Bradshaw in cc of this ticket. He might have some comments to share.
comment:4 Changed 8 years ago by
- Status changed from needs_review to needs_work
- Your definition of Pisot eigenvector is ambiguous.
Returns the left eigenvector of the incidence matrix associated to the largest eigenvalue (in absolute value).
It is possible that there are multiple eigenvalues with the same absolute value:
sage: mu = WordMorphism('a->c,b->c,c->ab') sage: m = matrix(mu); m [0 0 1] [0 0 1] [1 1 0] sage: m.eigenvalues() [0, -1.414213562373095?, 1.414213562373095?]
It is not clear which eigenvector gets returned here.
Also, there may be more than one eigenvector associated to your "maximal" eigenvalue, and your method only returns one eigenvector:
sage: mu = WordMorphism('a->a,b->b,c->abc') sage: mu.pisot_eigenvector_left() (1, -1, 0) sage: m = matrix(mu); m [1 0 1] [0 1 1] [0 0 1] sage: m.eigenspaces_left() [ (1, Vector space of degree 3 and dimension 2 over Rational Field User basis matrix: [ 1 -1 0] [ 0 0 1]) ]
- The method
directive_vector
should include a definition of what the directive vector is.
- In your functions
rotate_ith_to_zero
androtate_vector_on_axis
, you first construct the matrix and then coerce it into the ring specified by the user. Why is this preferable to doing the computations directly in the ring? What about making this an optioncompute_in_ring=False
? I think all you need to do is add the following line at the beginning:if compute_in_ring is True: v = vector(ring, v)
comment:6 Changed 8 years ago by
- Cc tjolivet added
comment:7 Changed 7 years ago by
- Cc tmonteil added
comment:8 Changed 7 years ago by
- Description modified (diff)
- Status changed from needs_review to needs_work
Hi,
Here are a few remarks:
(1) There is a doctest failure:
File "/home/timo/sage-4.6.1/devel/sage-trac_8670/sage/plot/plot3d/transform.pyx", line 325: sage: rotate_vector_on_axis(v, 0, ring=RealField(10)) * vExpected: (5.5, 0.0020, 0.0020, 0.00)Got: (5.5, 0.00098, 0.00098, 0.00)
This should be fixed by using "...
", and could be done for the other occurrences of printed floats.
(2) I think that the rotations matrices should be in a file in sage/matrix/. I remember having looked for something like rotate_arbitrary
, but I didn't find it because it was in plot3d/ and not in matrix/.
(3) The documentation for rotate_vector_on_axis
could be a little bit clearer (the description).
Otherwise this is a nice and useful patch.
comment:9 Changed 7 years ago by
- Status changed from needs_work to needs_review
Thanks for the comments. I moved the two rotation matrix constructor to the file sage/matrix/constructor.py
. I improved the docstrings and fixed the doctest failure (I was having the same).
Needs review.
comment:10 Changed 7 years ago by
- Description modified (diff)
comment:11 Changed 7 years ago by
For the patchbot :
Apply trac_8670_folded-sl.patch
comment:12 Changed 7 years ago by
- Reviewers set to Franco Saliola, Timo Jolivet
- Status changed from needs_review to positive_review
comment:13 Changed 7 years ago by
- Milestone changed from sage-4.6.2 to sage-4.7
comment:14 Changed 7 years ago by
- Merged in set to sage-4.7.alpha2
- Resolution set to fixed
- Status changed from positive_review to closed
There are some limit case problems :
Will post a new patch soon.