Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Provide projections methods for word paths #8670

Closed
seblabbe opened this issue Apr 11, 2010 · 16 comments
Closed

Provide projections methods for word paths #8670

seblabbe opened this issue Apr 11, 2010 · 16 comments

Comments

@seblabbe
Copy link
Contributor

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.

CC: @sagetrac-abmasse @videlec @robertwb @sagetrac-tjolivet @sagetrac-tmonteil

Component: combinatorics

Author: Sébastien Labbé

Reviewer: Franco Saliola, Timo Jolivet

Merged: sage-4.7.alpha2

Issue created by migration from https://trac.sagemath.org/ticket/8670

@seblabbe seblabbe added this to the sage-4.6.2 milestone Apr 11, 2010
@seblabbe seblabbe self-assigned this Apr 11, 2010
@seblabbe
Copy link
Contributor Author

comment:2

There are some limit case problems :

sage: from sage.plot.plot3d.transform import *
sage: rotate_vector_on_axis((1,0,0), 0)
Traceback (most recent call last):
...
ZeroDivisionError: Rational division by zero

Will post a new patch soon.

@seblabbe
Copy link
Contributor Author

comment:3

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.

@seblabbe
Copy link
Contributor Author

Does not depend on any known patch. Applies on 4.3.4.

@saliola
Copy link
Contributor

saliola commented Jun 23, 2010

comment:4

Attachment: trac_8670-word-path-projection-sl.patch.gz

  1. 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])
]
  1. The method directive_vector should include a definition of what the directive vector is.

  2. In your functions rotate_ith_to_zero and rotate_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 option compute_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)

@seblabbe
Copy link
Contributor Author

comment:5

Needs review again!

@seblabbe
Copy link
Contributor Author

Attachment: trac_8670-review-sl.patch.gz

Applies over the precedent patch

@sagetrac-tjolivet
Copy link
Mannequin

sagetrac-tjolivet mannequin commented Jan 28, 2011

comment:8

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.

@sagetrac-tjolivet

This comment has been minimized.

@seblabbe
Copy link
Contributor Author

Attachment: trac_8670_second_corrections-sl.patch.gz

Applies over the precedent 2 patches

@seblabbe
Copy link
Contributor Author

comment:9

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.

@seblabbe

This comment has been minimized.

@seblabbe
Copy link
Contributor Author

Attachment: trac_8670_folded-sl.patch.gz

Apply only this one.

@seblabbe
Copy link
Contributor Author

comment:11

For the patchbot :

Apply trac_8670_folded-sl.patch

@sagetrac-tjolivet
Copy link
Mannequin

sagetrac-tjolivet mannequin commented Feb 7, 2011

Reviewer: Franco Saliola, Timo Jolivet

@sagetrac-tjolivet
Copy link
Mannequin

sagetrac-tjolivet mannequin commented Feb 7, 2011

Author: Sébastien Labbé

@jdemeyer
Copy link
Contributor

Merged: sage-4.7.alpha2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants