| 
            
                 
                SmtC: Show me the Code
                 
                
                Ole Peter Smith
                 
                
                Instituto de Matemática e Estatística
                 
                
                Universidade Federal de Goiás
                 
                
                http://www.olesmith.com.br
                 
             | 
            
               
             | 
        
        
            
              
               
                
                
                
                O dia que bosta valesse ouro. 
                Os pobres todos nascerĂ£o sem c*.
                   
                  Grafitti.
                   
                 
             | 
            
              
              
                
                  
                
                
                Trochoids and Cycloids
                
                Circle rolling on the $x$-axis, $r>0$, $b \in \mathbb{R}$:
                \[
                    \underline{r}(t)
                    =
                    \begin{pmatrix}x(t)\\y(t)\end{pmatrix}
                    =
                    \begin{pmatrix}
                       r t-b\sin{t}
                       \\
                       r-b\cos{t}
                    \end{pmatrix}
                    =
                    r
                    \begin{pmatrix}
                       t-\lambda \sin{t}
                       \\
                       1-\lambda\cos{t}
                    \end{pmatrix},
                \]
                Dimensionless parameter: $\lambda=\frac{b}{r}\in \mathbb{R}$.
                \[
                    \frac{1}{r}
                    \underline{r}(t)
                    =
                    \underbrace
                    {
                       \begin{pmatrix}
                          t
                          \\
                          1
                       \end{pmatrix}
                    }_\text{$\underline{R}(t)$}
                    -\lambda~
                    \underbrace
                    {
                       \begin{pmatrix}
                          \sin{t}
                          \\
                          \cos{t}
                       \end{pmatrix}
                    }_\text{$\underline{p}(t)$}
                \]
                
                   
                      - 
                        
                          
                            
                             
                            
                           
                         
                            
                            
                            
                            
                              
                            
\documentclass[]{standalone}
\usepackage{tikz}
\usepackage{pgfplots}
\usetikzlibrary{calc} 
\pgfplotsset{compat=1.14} 
\usepackage{xcolor}
%Draw Trochoids and Cycloid
%r fixed, b or Lambda varying
       
\tikzstyle{curves}=[
   smooth,samples=200,
   variable=\t,
   domain=0:4*pi,
]
%Radius of rolling circle
\tikzmath{\r=1;}
   
%Number of curves to draw.
\tikzmath{\N=10;}
   
%Relative position of rollong point. Lambda=\pm 1: cycloid
\tikzmath{\LambdaMin=-2.0;}
\tikzmath{\LambdaMax=2.0;}
%Steps of aLambda
\tikzmath{\dLambda=(\LambdaMax-\LambdaMin)/\N;}
  
%Variation of colors - color in [0,100].
\tikzmath{\dcolor=100/\N;}
\begin{document}
   \begin{tikzpicture}
       %Coordinate system
       \draw[-latex] (-\r,0) -- (4*pi+\r*\LambdaMax,0) node [right] {$x$};
       \draw[-latex] (0,-\r) -- (0,\r*\LambdaMax) node [above] {$y$};
              
       \foreach \n in {0,1,...,\N}
       {
           %\Lambda and color, \color
           \tikzmath{\Lambda=\LambdaMin+\n*\dLambda;}
           \tikzmath{\color=\n*\dcolor;}
          
           %cos and sin expects degrees: deg(\t)
           \draw
              [
                 curves,
                 %Convex combination of colors
                 color=orange!\color!cyan
              ]
              plot (
                 { \r*(  \t-\Lambda*sin(deg(\t))  ) },
                 { \r*(  1-\Lambda*cos(deg(\t)) }
              );
       }
       
       \draw
          [
             curves,thick,
             color=blue
          ]
          plot (  
             { \r*(  \t-sin(deg(\t))  ) },
             { \r*(  1-cos(deg(\t)) }
          );
      
       
       
   \end{tikzpicture}
\end{document}
 
 
                             | 
                             
                             
                            
                        
                        
                        
                        
                       
                      - 
                        
                        Tangent or Velocity:
                        \[
                            \frac{1}{r} 
                            \underline{r}'(t)
                            =
                            \begin{pmatrix}
                               1-\lambda \cos{t}
                               \\
                               \lambda\sin{t}
                            \end{pmatrix}
                            =
                            \begin{pmatrix}
                               1\\0
                            \end{pmatrix}
                            -
                            \lambda
                            \begin{pmatrix}
                               \cos{t}
                               \\
                               -\sin{t}
                            \end{pmatrix}
                            =
                            \underline{i}
                            -
                            \lambda\underline{q}(t)
                        \]
                        Unit vector:
                        \[
                           \underline{q}(t)
                           =
                           \begin{pmatrix}
                               \cos{t}
                               \\
                               -\sin{t}
                            \end{pmatrix}
                            \perp \underline{p}(t)
                        \]
                          
                            
                             
                            
                           
                         
                            
                            
                            
                            
                              
                            
\documentclass[]{standalone}
\usepackage{tikz}
\usepackage{pgfplots}
\usetikzlibrary{calc} 
\pgfplotsset{compat=1.14} 
\usepackage{xcolor}
%Draw Trochoids and Cycloid
%r fixed, b or Lambda varying
       
\tikzstyle{curves}=[
   smooth,samples=200,
   variable=\t,
   domain=0:4*pi,
   color=blue
]
\tikzstyle{rolling}=[
   color=red
]
%Radius of rolling circle
\tikzmath{\r=1;}
   
%Number of curves to draw.
\tikzmath{\N=10;}
   
%Relative position of rollong point. Lambda=\pm 1: cycloid
\tikzmath{\LambdaMin=0.0;}
\tikzmath{\LambdaMax=2.0;}
%Steps of aLambda
\tikzmath{\dLambda=(\LambdaMax-\LambdaMin)/\N;}
  
%Variation of colors - color in [0,100].
\tikzmath{\dcolor=100/\N;}
\newcommand{\DrawTrochoid}[2]
{
   %cos and sin expects degrees: deg(\t)
   %Alternative: tikzpicture option trig format=rad
   \draw[curves,#2]
       plot
       (
           { \r*(  \t-#1*sin(deg(\t))  ) },
           { \r*(  1 -#1*cos(deg(\t))  ) }
       );
}
%Fixed time - draw rolling
\tikzmath{\T=4*pi/3;}
   
\begin{document}
   \begin{tikzpicture}
       %Coordinate system
       \draw[-latex] (-\r,0) -- (4*pi+0.5*\r*\LambdaMax,0) node [right] {$x$};
       \draw[-latex] (0,-\r) -- (0,1.5*\r*\LambdaMax) node [above] {$y$};
              
       \foreach \n in {0,1,...,\N}
       {
           %\Lambda and color, \color
           \tikzmath{\Lambda=\LambdaMin+\n*\dLambda;}
           \tikzmath{\col=\n*\dcolor;}
          
           \DrawTrochoid{\Lambda}{color=blue!\col!cyan,thin} 
       }
       
       %Draw cycloid
       \tikzmath{\Lambda=1;}
       \DrawTrochoid{\Lambda}{color=blue,thick}
      
       \tikzmath{\Angle=deg(\T);}
       \tikzmath{\xt=\r*(   \T-\Lambda*sin(\Angle)   );}
       \tikzmath{\yt=\r*(    1-\Lambda*cos(\Angle)   );}
   
       \coordinate (RCycloid) at (\xt,\yt);
       \filldraw[curves] (RCycloid) circle(1pt);
      
       %Rolling center
       \tikzmath{\xR=\r*\T;}
       \tikzmath{\yR=\r;}
       \coordinate (Rolling) at (\xR,\yR);
       
       \filldraw[rolling] (Rolling) circle(1pt);
       \draw[rolling] (Rolling) circle(\r);
      
       %Point on last trochoid
       \tikzmath{\px=-sin(\Angle);}
       \tikzmath{\py=-cos(\Angle);}
       \coordinate (p) at (\px,\py);
       \coordinate (q) at (\py,-\px);
       
       \coordinate (RTrochoid) at ($(Rolling)+\r*\LambdaMax*(p)$);
       \draw[-latex,rolling] (RCycloid)-- +(q);
       \draw[-latex,rolling] (Rolling)-- (RCycloid);
       \draw[-latex,curves] (RCycloid)-- (RTrochoid);
      
       %Tangent
       \tikzmath{\drx=\r*(1-\LambdaMax*cos(\Angle));}
       \tikzmath{\dry=\r*\LambdaMax*sin(\Angle);}
       \coordinate (dr) at (\drx,\dry);
       
       \draw[-latex,curves] (RTrochoid)-- +(dr);
   \end{tikzpicture}
\end{document}
 
 
                             | 
                             
                             
                            
                        
                        
                        
                        
                       
                      - 
                        
                        \[
                            \underline{p}(t)=
                            \begin{pmatrix}
                               \sin{t}
                               \\
                               \cos{t}
                            \end{pmatrix},
                            \qquad
                            \underline{q}(t)=
                            \begin{pmatrix}
                               \cos{t}
                               \\
                               -\sin{t}
                            \end{pmatrix}
                        \]
                        Not a RHS:
                        \[
                           \underline{\widehat q}(t)=\underline{p}(t),
                           \qquad
                           \underline{\widehat p}(t)=-\underline{q}(t)
                        \]
                        \[
                           \underline{p}'(t)=\underline{q}(t),
                           \qquad
                           \underline{q}'(t)=-\underline{p}(t)
                        \]
                        
                        
                      
 
                      - 
                        
                        Acceleration:
                        \[
                            \frac{1}{r} 
                            \underline{r}''(t)
                            =
                           \lambda
                            \begin{pmatrix}
                               \sin{t}
                               \\
                               \cos{t}
                            \end{pmatrix}
                            =
                            \lambda\underline{p}(t)
                        \]
                        
                        
                        
                      
 
                   
                
                
                  
                    
                    Generated: 31 Dec 1969, 21:00:00
                     
                    
                    0 of 0 images
                     
                    
                    Base Path: /usr/local/
                     
                    
                    Glob Path: Images/3-Fig*.svg
                     
                  
                
                
                
                 
                
                
                
              
                
               
             | 
            
                  
                  Messages: 
                  
                  
                  
                  0 secs.
                  
                
             |