³ò
'¹Jc           @   sƒ   y d  d k  Z d  d k i Z Wn e j
 o Z d Ge GHn Xd d	 d „  ƒ  YZ d e f d „  ƒ  YZ d e f d „  ƒ  YZ	 d S(
   iÿÿÿÿNs   Error importing modules:t	   OneDimMapc           B   sD   e  Z d  Z d „  Z d „  Z d „  Z d „  Z d „  Z d „  Z RS(   sV   
	Base class for all map classes. This provides 
	methods common to all map classes.
	c         C   s)   d d d g |  _  |  i ƒ  d |  _ d S(   s'   Constructor for the OneDMap base class.g        g      ð?s   One Dimensional Map f(x) = xN(   t   defaultst	   resetValst   mapStr(   t   self(    (    sV   /Users/chaos/Presentations/NonlinearPhysics 2009/Software/PartF_Code/OneDMapClasses.pyt   __init__   s    
c         C   s   |  i  S(   s   String representation of map.(   R   (   R   (    (    sV   /Users/chaos/Presentations/NonlinearPhysics 2009/Software/PartF_Code/OneDMapClasses.pyt   __repr__   s    c         C   s   | S(   s9   Returns f(x). This is a place holder for all map classes.(    (   R   t   x(    (    sV   /Users/chaos/Presentations/NonlinearPhysics 2009/Software/PartF_Code/OneDMapClasses.pyt   func    s    c         C   s0   x) t  | ƒ D] } |  i |  i ƒ |  _ q Wd S(   s3   Iterates the map num_its times and saves the state.N(   t   xrangeR   t   state(   R   t   num_itst   n(    (    sV   /Users/chaos/Presentations/NonlinearPhysics 2009/Software/PartF_Code/OneDMapClasses.pyt   iterate%   s     c         C   s&  t  i ƒ  t  i |  i d |  i |  i f ƒ t  i d ƒ t  i d ƒ d } d } d } |  i |  i t | ƒ } x¡ t	 i
 |  i |  i | ƒ D]„ |  _ |  i |  _ |  i | ƒ t	 i |  i | ƒ } g  } x1 t | ƒ D]# } |  i d ƒ | i |  i ƒ qÚ Wt  i | | d ƒ q Wt  i ƒ  d	 S(
   s3   Generate and display a bifurcation plot of the map.s&   , bifurcation diagram for r in [%g,%g]s   Control parameter rs   {X(n)}iÈ   iú   i  i   s   k,N(   t   pltt   figuret   titleR   t   rLowt   rHit   xlabelt   ylabelt   floatt   npt   aranget   rt   icR
   R   t   repeatR	   t   appendt   plott   show(   R   t   nTransientst	   nIteratest   nStepst   rInct   rsweepR   t   i(    (    sV   /Users/chaos/Presentations/NonlinearPhysics 2009/Software/PartF_Code/OneDMapClasses.pyt   plotBifn,   s*    
 	 c         C   sT   |  i  d |  _ |  i  d |  _ |  i  d |  _ |  i  d |  _ |  i  d |  _ d S(   s,   Set map values to their respective defaults.i    i   i   N(   R   R   R
   R   R   R   (   R   (    (    sV   /Users/chaos/Presentations/NonlinearPhysics 2009/Software/PartF_Code/OneDMapClasses.pyR   P   s
    (	   t   __name__t
   __module__t   __doc__R   R   R   R   R$   R   (    (    (    sV   /Users/chaos/Presentations/NonlinearPhysics 2009/Software/PartF_Code/OneDMapClasses.pyR       s   	
				$t   LogisticMapc           B   s    e  Z d  Z d „  Z d „  Z RS(   s   The logistic map class.c         C   s6   t  i |  ƒ d d d g |  _ |  i ƒ  d |  _ d S(   s%   Constructor for a LogisticMap object.g333333Ó?g        g      @s   Logistic Map: f(x) = r*x*(1-x)N(   R    R   R   R   R   (   R   (    (    sV   /Users/chaos/Presentations/NonlinearPhysics 2009/Software/PartF_Code/OneDMapClasses.pyR   _   s    
c         C   s   |  i  |  i d |  i S(   s   Computes the logistic map.g      ð?(   R   R
   (   R   R   (    (    sV   /Users/chaos/Presentations/NonlinearPhysics 2009/Software/PartF_Code/OneDMapClasses.pyR   l   s    (   R%   R&   R'   R   R   (    (    (    sV   /Users/chaos/Presentations/NonlinearPhysics 2009/Software/PartF_Code/OneDMapClasses.pyR(   \   s   	t	   CosineMapc           B   s    e  Z d  Z d „  Z d „  Z RS(   s   The cosine map class.c         C   s6   t  i |  ƒ d d d g |  _ |  i ƒ  d |  _ d S(   s#   Constructor for a CosineMap object.g333333Ó?g      Àg      @s   Cosine Map: f(x)=r*cos(x)N(   R    R   R   R   R   (   R   (    (    sV   /Users/chaos/Presentations/NonlinearPhysics 2009/Software/PartF_Code/OneDMapClasses.pyR   v   s    
c         C   s   |  i  t i |  i ƒ S(   s   Computes the cosine map.(   R   R   t   cosR
   (   R   R   (    (    sV   /Users/chaos/Presentations/NonlinearPhysics 2009/Software/PartF_Code/OneDMapClasses.pyR   ƒ   s    (   R%   R&   R'   R   R   (    (    (    sV   /Users/chaos/Presentations/NonlinearPhysics 2009/Software/PartF_Code/OneDMapClasses.pyR)   s   s   	(    (
   t   numpyR   t   matplotlib.pyplott   pyplotR   t   ImportErrort   msgR    R(   R)   (    (    (    sV   /Users/chaos/Presentations/NonlinearPhysics 2009/Software/PartF_Code/OneDMapClasses.pys   <module>   s   Q