Hot-keys on this page
r m x p toggle line displays
j k next/prev highlighted chunk
0 (zero) top of page
1 (one) first highlighted chunk
r""" Dynamical systems on projective varieties (Cython helper)
This is the helper file providing functionality for projective_ds.py.
AUTHORS:
- Dillon Rose (2014-01): Speed enhancements
"""
#***************************************************************************** # Copyright (C) 2014 William Stein <wstein@gmail.com> # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 2 of the License, or # (at your option) any later version. # http://www.gnu.org/licenses/ #*****************************************************************************
from sage.arith.functions cimport LCM_list from sage.rings.finite_rings.finite_field_constructor import GF from sage.sets.all import Set from sage.misc.misc import subsets
cpdef _fast_possible_periods(self, return_points=False): r""" Return the list of possible minimal periods of a periodic point over `\QQ` and (optionally) a point in each cycle.
ALGORITHM:
See [Hutz-gr]_
INPUT:
- ``return_points`` - (default: ``False``) boolean; if ``True``, then return the points as well as the possible periods
OUTPUT:
A list of positive integers, or a list of pairs of projective points and periods if ``return_points`` is ``True``.
EXAMPLES::
sage: from sage.dynamics.arithmetic_dynamics.projective_ds_helper import _fast_possible_periods sage: P.<x,y> = ProjectiveSpace(GF(23),1) sage: f = DynamicalSystem_projective([x^2-2*y^2, y^2]) sage: _fast_possible_periods(f, False) [1, 5, 11, 22, 110]
::
sage: from sage.dynamics.arithmetic_dynamics.projective_ds_helper import _fast_possible_periods sage: P.<x,y> = ProjectiveSpace(GF(13),1) sage: f = DynamicalSystem_projective([x^2-y^2, y^2]) sage: sorted(_fast_possible_periods(f, True)) [[(0 : 1), 2], [(1 : 0), 1], [(3 : 1), 3], [(3 : 1), 36]]
::
sage: from sage.dynamics.arithmetic_dynamics.projective_ds_helper import _fast_possible_periods sage: PS.<x,y,z> = ProjectiveSpace(2,GF(7)) sage: f = DynamicalSystem_projective([-360*x^3 + 760*x*z^2, y^3 - 604*y*z^2 + 240*z^3, 240*z^3]) sage: _fast_possible_periods(f, False) [1, 2, 4, 6, 12, 14, 28, 42, 84]
.. TODO::
- More space efficient hash/point-table. """ cdef int i, k, N cdef int hash_p, hash_q cdef int index, startindex cdef list pointslist, points_periods cdef list P, Q cdef set periods, lorders, rvalues
raise TypeError("must be prime field")
raise NotImplementedError("must be an endomorphism of projective space")
else: periods.add(period*r*p) points_periods.append([P_proj, period*r*p]) else: periods.add(period*r*4) points_periods.append([P_proj, period*r*4]) periods.add(period*r*8) points_periods.append([P_proj, period*r*8])
else:
def _enum_points(int prime, int dimension): """ Enumerate points in projective space over finite field with given prime and dimension.
EXAMPLES::
sage: from sage.dynamics.arithmetic_dynamics.projective_ds_helper import _enum_points sage: list(_enum_points(3,2)) [[1, 0, 0], [0, 1, 0], [1, 1, 0], [2, 1, 0], [0, 0, 1], [1, 0, 1], [2, 0, 1], [0, 1, 1], [1, 1, 1], [2, 1, 1], [0, 2, 1], [1, 2, 1], [2, 2, 1]] """ cdef int current_range cdef int highest_range cdef int value
cpdef int _hash(list Point, int prime): """ Hash point given as list to unique number.
EXAMPLES::
sage: from sage.dynamics.arithmetic_dynamics.projective_ds_helper import _hash sage: _hash([1, 2, 1], 3) 16
""" cdef int hash_q cdef int coefficient
cpdef list _get_point_from_hash(int value, int prime, int dimension): """ Hash unique number to point as a list.
EXAMPLES::
sage: from sage.dynamics.arithmetic_dynamics.projective_ds_helper import _get_point_from_hash sage: _get_point_from_hash(16, 3, 2) [1, 2, 1] """ cdef int i
cdef inline int _mod_inv(int num, int prime): """ Find the inverse of the number modulo the given prime. """ cdef int a, b, q, t, x, y
else:
cpdef _normalize_coordinates(list point, int prime, int len_points): """ Normalize the coordinates of the point for the given prime.
.. NOTE::
This mutates ``point``.
EXAMPLES::
sage: from sage.dynamics.arithmetic_dynamics.projective_ds_helper import _normalize_coordinates sage: L = [1,5,1] sage: _normalize_coordinates(L, 3, 3) sage: L [1, 2, 1] """ cdef int last_coefficient, coefficient, mod_inverse, val
|