Hans Petter Langtangen 10 years ago
parent
commit
a95b69c555

+ 67 - 42
doc/pub/tutorial/._pysketcher000.html

@@ -55,34 +55,42 @@ Automatically generated HTML file from DocOnce source
                'sketcher:ex:pendulum:basic',
                'sketcher:ex:pendulum:basic',
                'sketcher:ex:pendulum:basic'),
                'sketcher:ex:pendulum:basic'),
               ('The body diagram', 2, None, '___sec10'),
               ('The body diagram', 2, None, '___sec10'),
-              ('Basic shapes', 1, None, '___sec11'),
-              ('Axis', 2, None, '___sec12'),
-              ('Distance with text', 2, None, '___sec13'),
-              ('Rectangle', 2, None, '___sec14'),
-              ('Triangle', 2, None, '___sec15'),
-              ('Arc', 2, None, '___sec16'),
-              ('Spring', 2, None, '___sec17'),
-              ('Dashpot', 2, None, '___sec18'),
-              ('Wavy', 2, None, '___sec19'),
-              ('Stochastic curves', 2, None, '___sec20'),
-              ('Inner workings of the Pysketcher tool', 1, None, '___sec21'),
+              ('Animated body diagram',
+               2,
+               'sketcher:ex:pendulum:anim',
+               'sketcher:ex:pendulum:anim'),
+              ('Function for drawing the body diagram', 3, None, '___sec12'),
+              ('Equations for the motion and forces', 3, None, '___sec13'),
+              ('Numerical solution', 3, None, '___sec14'),
+              ('Animation', 3, None, '___sec15'),
+              ('Basic shapes', 1, None, '___sec16'),
+              ('Axis', 2, None, '___sec17'),
+              ('Distance with text', 2, None, '___sec18'),
+              ('Rectangle', 2, None, '___sec19'),
+              ('Triangle', 2, None, '___sec20'),
+              ('Arc', 2, None, '___sec21'),
+              ('Spring', 2, None, '___sec22'),
+              ('Dashpot', 2, None, '___sec23'),
+              ('Wavy', 2, None, '___sec24'),
+              ('Stochastic curves', 2, None, '___sec25'),
+              ('Inner workings of the Pysketcher tool', 1, None, '___sec26'),
               ('Example of classes for geometric objects',
               ('Example of classes for geometric objects',
                2,
                2,
                None,
                None,
-               '___sec22'),
-              ('Simple geometric objects', 3, None, '___sec23'),
-              ('Class curve', 3, None, '___sec24'),
-              ('Compound geometric objects', 3, None, '___sec25'),
-              ('Adding functionality via recursion', 2, None, '___sec26'),
-              ('Basic principles of recursion', 3, None, '___sec27'),
-              ('Explaining recursion', 3, None, '___sec28'),
+               '___sec27'),
+              ('Simple geometric objects', 3, None, '___sec28'),
+              ('Class curve', 3, None, '___sec29'),
+              ('Compound geometric objects', 3, None, '___sec30'),
+              ('Adding functionality via recursion', 2, None, '___sec31'),
+              ('Basic principles of recursion', 3, None, '___sec32'),
+              ('Explaining recursion', 3, None, '___sec33'),
               ('Scaling, translating, and rotating a figure',
               ('Scaling, translating, and rotating a figure',
                2,
                2,
                'sketcher:scaling',
                'sketcher:scaling',
                'sketcher:scaling'),
                'sketcher:scaling'),
-              ('Scaling', 3, None, '___sec30'),
-              ('Translation', 3, None, '___sec31'),
-              ('Rotation', 3, None, '___sec32')]}
+              ('Scaling', 3, None, '___sec35'),
+              ('Translation', 3, None, '___sec36'),
+              ('Rotation', 3, None, '___sec37')]}
 end of tocinfo -->
 end of tocinfo -->
 
 
 <body>
 <body>
@@ -101,6 +109,18 @@ MathJax.Hub.Config({
  src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML">
  src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML">
 </script>
 </script>
 
 
+<!-- newcommands.tex -->
+$$
+\newcommand{\half}{\frac{1}{2}}
+\newcommand{\tp}{\thinspace .}
+\newcommand{\rpos}{\boldsymbol{r}}
+\newcommand{\ii}{\boldsymbol{i}}
+\newcommand{\jj}{\boldsymbol{j}}
+\newcommand{\ir}{\boldsymbol{i}_r}
+\newcommand{\ith}{\boldsymbol{i}_{\theta}}
+$$
+
+
 
 
 
 
     
     
@@ -131,28 +151,33 @@ MathJax.Hub.Config({
      <!-- navigation toc: --> <li><a href="._pysketcher003.html#sketcher:ex:pendulum" style="font-size: 80%;"><b>A simple pendulum</b></a></li>
      <!-- navigation toc: --> <li><a href="._pysketcher003.html#sketcher:ex:pendulum" style="font-size: 80%;"><b>A simple pendulum</b></a></li>
      <!-- navigation toc: --> <li><a href="._pysketcher003.html#sketcher:ex:pendulum:basic" style="font-size: 80%;">&nbsp;&nbsp;&nbsp;The basic physics sketch</a></li>
      <!-- navigation toc: --> <li><a href="._pysketcher003.html#sketcher:ex:pendulum:basic" style="font-size: 80%;">&nbsp;&nbsp;&nbsp;The basic physics sketch</a></li>
      <!-- navigation toc: --> <li><a href="._pysketcher003.html#___sec10" style="font-size: 80%;">&nbsp;&nbsp;&nbsp;The body diagram</a></li>
      <!-- navigation toc: --> <li><a href="._pysketcher003.html#___sec10" style="font-size: 80%;">&nbsp;&nbsp;&nbsp;The body diagram</a></li>
-     <!-- navigation toc: --> <li><a href="._pysketcher004.html#___sec11" style="font-size: 80%;"><b>Basic shapes</b></a></li>
-     <!-- navigation toc: --> <li><a href="._pysketcher004.html#___sec12" style="font-size: 80%;">&nbsp;&nbsp;&nbsp;Axis</a></li>
-     <!-- navigation toc: --> <li><a href="._pysketcher004.html#___sec13" style="font-size: 80%;">&nbsp;&nbsp;&nbsp;Distance with text</a></li>
-     <!-- navigation toc: --> <li><a href="._pysketcher004.html#___sec14" style="font-size: 80%;">&nbsp;&nbsp;&nbsp;Rectangle</a></li>
-     <!-- navigation toc: --> <li><a href="._pysketcher004.html#___sec15" style="font-size: 80%;">&nbsp;&nbsp;&nbsp;Triangle</a></li>
-     <!-- navigation toc: --> <li><a href="._pysketcher004.html#___sec16" style="font-size: 80%;">&nbsp;&nbsp;&nbsp;Arc</a></li>
-     <!-- navigation toc: --> <li><a href="._pysketcher004.html#___sec17" style="font-size: 80%;">&nbsp;&nbsp;&nbsp;Spring</a></li>
-     <!-- navigation toc: --> <li><a href="._pysketcher004.html#___sec18" style="font-size: 80%;">&nbsp;&nbsp;&nbsp;Dashpot</a></li>
-     <!-- navigation toc: --> <li><a href="._pysketcher004.html#___sec19" style="font-size: 80%;">&nbsp;&nbsp;&nbsp;Wavy</a></li>
-     <!-- navigation toc: --> <li><a href="._pysketcher004.html#___sec20" style="font-size: 80%;">&nbsp;&nbsp;&nbsp;Stochastic curves</a></li>
-     <!-- navigation toc: --> <li><a href="._pysketcher005.html#___sec21" style="font-size: 80%;"><b>Inner workings of the Pysketcher tool</b></a></li>
-     <!-- navigation toc: --> <li><a href="._pysketcher005.html#___sec22" style="font-size: 80%;">&nbsp;&nbsp;&nbsp;Example of classes for geometric objects</a></li>
-     <!-- navigation toc: --> <li><a href="._pysketcher005.html#___sec23" style="font-size: 80%;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Simple geometric objects</a></li>
-     <!-- navigation toc: --> <li><a href="._pysketcher005.html#___sec24" style="font-size: 80%;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Class curve</a></li>
-     <!-- navigation toc: --> <li><a href="._pysketcher005.html#___sec25" style="font-size: 80%;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Compound geometric objects</a></li>
-     <!-- navigation toc: --> <li><a href="._pysketcher005.html#___sec26" style="font-size: 80%;">&nbsp;&nbsp;&nbsp;Adding functionality via recursion</a></li>
-     <!-- navigation toc: --> <li><a href="._pysketcher005.html#___sec27" style="font-size: 80%;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Basic principles of recursion</a></li>
-     <!-- navigation toc: --> <li><a href="._pysketcher005.html#___sec28" style="font-size: 80%;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Explaining recursion</a></li>
+     <!-- navigation toc: --> <li><a href="._pysketcher003.html#sketcher:ex:pendulum:anim" style="font-size: 80%;">&nbsp;&nbsp;&nbsp;Animated body diagram</a></li>
+     <!-- navigation toc: --> <li><a href="._pysketcher003.html#___sec12" style="font-size: 80%;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Function for drawing the body diagram</a></li>
+     <!-- navigation toc: --> <li><a href="._pysketcher003.html#___sec13" style="font-size: 80%;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Equations for the motion and forces</a></li>
+     <!-- navigation toc: --> <li><a href="._pysketcher003.html#___sec14" style="font-size: 80%;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Numerical solution</a></li>
+     <!-- navigation toc: --> <li><a href="._pysketcher003.html#___sec15" style="font-size: 80%;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Animation</a></li>
+     <!-- navigation toc: --> <li><a href="._pysketcher004.html#___sec16" style="font-size: 80%;"><b>Basic shapes</b></a></li>
+     <!-- navigation toc: --> <li><a href="._pysketcher004.html#___sec17" style="font-size: 80%;">&nbsp;&nbsp;&nbsp;Axis</a></li>
+     <!-- navigation toc: --> <li><a href="._pysketcher004.html#___sec18" style="font-size: 80%;">&nbsp;&nbsp;&nbsp;Distance with text</a></li>
+     <!-- navigation toc: --> <li><a href="._pysketcher004.html#___sec19" style="font-size: 80%;">&nbsp;&nbsp;&nbsp;Rectangle</a></li>
+     <!-- navigation toc: --> <li><a href="._pysketcher004.html#___sec20" style="font-size: 80%;">&nbsp;&nbsp;&nbsp;Triangle</a></li>
+     <!-- navigation toc: --> <li><a href="._pysketcher004.html#___sec21" style="font-size: 80%;">&nbsp;&nbsp;&nbsp;Arc</a></li>
+     <!-- navigation toc: --> <li><a href="._pysketcher004.html#___sec22" style="font-size: 80%;">&nbsp;&nbsp;&nbsp;Spring</a></li>
+     <!-- navigation toc: --> <li><a href="._pysketcher004.html#___sec23" style="font-size: 80%;">&nbsp;&nbsp;&nbsp;Dashpot</a></li>
+     <!-- navigation toc: --> <li><a href="._pysketcher004.html#___sec24" style="font-size: 80%;">&nbsp;&nbsp;&nbsp;Wavy</a></li>
+     <!-- navigation toc: --> <li><a href="._pysketcher004.html#___sec25" style="font-size: 80%;">&nbsp;&nbsp;&nbsp;Stochastic curves</a></li>
+     <!-- navigation toc: --> <li><a href="._pysketcher005.html#___sec26" style="font-size: 80%;"><b>Inner workings of the Pysketcher tool</b></a></li>
+     <!-- navigation toc: --> <li><a href="._pysketcher005.html#___sec27" style="font-size: 80%;">&nbsp;&nbsp;&nbsp;Example of classes for geometric objects</a></li>
+     <!-- navigation toc: --> <li><a href="._pysketcher005.html#___sec28" style="font-size: 80%;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Simple geometric objects</a></li>
+     <!-- navigation toc: --> <li><a href="._pysketcher005.html#___sec29" style="font-size: 80%;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Class curve</a></li>
+     <!-- navigation toc: --> <li><a href="._pysketcher005.html#___sec30" style="font-size: 80%;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Compound geometric objects</a></li>
+     <!-- navigation toc: --> <li><a href="._pysketcher005.html#___sec31" style="font-size: 80%;">&nbsp;&nbsp;&nbsp;Adding functionality via recursion</a></li>
+     <!-- navigation toc: --> <li><a href="._pysketcher005.html#___sec32" style="font-size: 80%;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Basic principles of recursion</a></li>
+     <!-- navigation toc: --> <li><a href="._pysketcher005.html#___sec33" style="font-size: 80%;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Explaining recursion</a></li>
      <!-- navigation toc: --> <li><a href="._pysketcher005.html#sketcher:scaling" style="font-size: 80%;">&nbsp;&nbsp;&nbsp;Scaling, translating, and rotating a figure</a></li>
      <!-- navigation toc: --> <li><a href="._pysketcher005.html#sketcher:scaling" style="font-size: 80%;">&nbsp;&nbsp;&nbsp;Scaling, translating, and rotating a figure</a></li>
-     <!-- navigation toc: --> <li><a href="._pysketcher005.html#___sec30" style="font-size: 80%;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Scaling</a></li>
-     <!-- navigation toc: --> <li><a href="._pysketcher005.html#___sec31" style="font-size: 80%;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Translation</a></li>
-     <!-- navigation toc: --> <li><a href="._pysketcher005.html#___sec32" style="font-size: 80%;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Rotation</a></li>
+     <!-- navigation toc: --> <li><a href="._pysketcher005.html#___sec35" style="font-size: 80%;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Scaling</a></li>
+     <!-- navigation toc: --> <li><a href="._pysketcher005.html#___sec36" style="font-size: 80%;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Translation</a></li>
+     <!-- navigation toc: --> <li><a href="._pysketcher005.html#___sec37" style="font-size: 80%;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Rotation</a></li>
 
 
         </ul>
         </ul>
       </li>
       </li>

+ 81 - 55
doc/pub/tutorial/._pysketcher001.html

@@ -55,34 +55,42 @@ Automatically generated HTML file from DocOnce source
                'sketcher:ex:pendulum:basic',
                'sketcher:ex:pendulum:basic',
                'sketcher:ex:pendulum:basic'),
                'sketcher:ex:pendulum:basic'),
               ('The body diagram', 2, None, '___sec10'),
               ('The body diagram', 2, None, '___sec10'),
-              ('Basic shapes', 1, None, '___sec11'),
-              ('Axis', 2, None, '___sec12'),
-              ('Distance with text', 2, None, '___sec13'),
-              ('Rectangle', 2, None, '___sec14'),
-              ('Triangle', 2, None, '___sec15'),
-              ('Arc', 2, None, '___sec16'),
-              ('Spring', 2, None, '___sec17'),
-              ('Dashpot', 2, None, '___sec18'),
-              ('Wavy', 2, None, '___sec19'),
-              ('Stochastic curves', 2, None, '___sec20'),
-              ('Inner workings of the Pysketcher tool', 1, None, '___sec21'),
+              ('Animated body diagram',
+               2,
+               'sketcher:ex:pendulum:anim',
+               'sketcher:ex:pendulum:anim'),
+              ('Function for drawing the body diagram', 3, None, '___sec12'),
+              ('Equations for the motion and forces', 3, None, '___sec13'),
+              ('Numerical solution', 3, None, '___sec14'),
+              ('Animation', 3, None, '___sec15'),
+              ('Basic shapes', 1, None, '___sec16'),
+              ('Axis', 2, None, '___sec17'),
+              ('Distance with text', 2, None, '___sec18'),
+              ('Rectangle', 2, None, '___sec19'),
+              ('Triangle', 2, None, '___sec20'),
+              ('Arc', 2, None, '___sec21'),
+              ('Spring', 2, None, '___sec22'),
+              ('Dashpot', 2, None, '___sec23'),
+              ('Wavy', 2, None, '___sec24'),
+              ('Stochastic curves', 2, None, '___sec25'),
+              ('Inner workings of the Pysketcher tool', 1, None, '___sec26'),
               ('Example of classes for geometric objects',
               ('Example of classes for geometric objects',
                2,
                2,
                None,
                None,
-               '___sec22'),
-              ('Simple geometric objects', 3, None, '___sec23'),
-              ('Class curve', 3, None, '___sec24'),
-              ('Compound geometric objects', 3, None, '___sec25'),
-              ('Adding functionality via recursion', 2, None, '___sec26'),
-              ('Basic principles of recursion', 3, None, '___sec27'),
-              ('Explaining recursion', 3, None, '___sec28'),
+               '___sec27'),
+              ('Simple geometric objects', 3, None, '___sec28'),
+              ('Class curve', 3, None, '___sec29'),
+              ('Compound geometric objects', 3, None, '___sec30'),
+              ('Adding functionality via recursion', 2, None, '___sec31'),
+              ('Basic principles of recursion', 3, None, '___sec32'),
+              ('Explaining recursion', 3, None, '___sec33'),
               ('Scaling, translating, and rotating a figure',
               ('Scaling, translating, and rotating a figure',
                2,
                2,
                'sketcher:scaling',
                'sketcher:scaling',
                'sketcher:scaling'),
                'sketcher:scaling'),
-              ('Scaling', 3, None, '___sec30'),
-              ('Translation', 3, None, '___sec31'),
-              ('Rotation', 3, None, '___sec32')]}
+              ('Scaling', 3, None, '___sec35'),
+              ('Translation', 3, None, '___sec36'),
+              ('Rotation', 3, None, '___sec37')]}
 end of tocinfo -->
 end of tocinfo -->
 
 
 <body>
 <body>
@@ -101,6 +109,18 @@ MathJax.Hub.Config({
  src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML">
  src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML">
 </script>
 </script>
 
 
+<!-- newcommands.tex -->
+$$
+\newcommand{\half}{\frac{1}{2}}
+\newcommand{\tp}{\thinspace .}
+\newcommand{\rpos}{\boldsymbol{r}}
+\newcommand{\ii}{\boldsymbol{i}}
+\newcommand{\jj}{\boldsymbol{j}}
+\newcommand{\ir}{\boldsymbol{i}_r}
+\newcommand{\ith}{\boldsymbol{i}_{\theta}}
+$$
+
+
 
 
 
 
     
     
@@ -131,28 +151,33 @@ MathJax.Hub.Config({
      <!-- navigation toc: --> <li><a href="._pysketcher003.html#sketcher:ex:pendulum" style="font-size: 80%;"><b>A simple pendulum</b></a></li>
      <!-- navigation toc: --> <li><a href="._pysketcher003.html#sketcher:ex:pendulum" style="font-size: 80%;"><b>A simple pendulum</b></a></li>
      <!-- navigation toc: --> <li><a href="._pysketcher003.html#sketcher:ex:pendulum:basic" style="font-size: 80%;">&nbsp;&nbsp;&nbsp;The basic physics sketch</a></li>
      <!-- navigation toc: --> <li><a href="._pysketcher003.html#sketcher:ex:pendulum:basic" style="font-size: 80%;">&nbsp;&nbsp;&nbsp;The basic physics sketch</a></li>
      <!-- navigation toc: --> <li><a href="._pysketcher003.html#___sec10" style="font-size: 80%;">&nbsp;&nbsp;&nbsp;The body diagram</a></li>
      <!-- navigation toc: --> <li><a href="._pysketcher003.html#___sec10" style="font-size: 80%;">&nbsp;&nbsp;&nbsp;The body diagram</a></li>
-     <!-- navigation toc: --> <li><a href="._pysketcher004.html#___sec11" style="font-size: 80%;"><b>Basic shapes</b></a></li>
-     <!-- navigation toc: --> <li><a href="._pysketcher004.html#___sec12" style="font-size: 80%;">&nbsp;&nbsp;&nbsp;Axis</a></li>
-     <!-- navigation toc: --> <li><a href="._pysketcher004.html#___sec13" style="font-size: 80%;">&nbsp;&nbsp;&nbsp;Distance with text</a></li>
-     <!-- navigation toc: --> <li><a href="._pysketcher004.html#___sec14" style="font-size: 80%;">&nbsp;&nbsp;&nbsp;Rectangle</a></li>
-     <!-- navigation toc: --> <li><a href="._pysketcher004.html#___sec15" style="font-size: 80%;">&nbsp;&nbsp;&nbsp;Triangle</a></li>
-     <!-- navigation toc: --> <li><a href="._pysketcher004.html#___sec16" style="font-size: 80%;">&nbsp;&nbsp;&nbsp;Arc</a></li>
-     <!-- navigation toc: --> <li><a href="._pysketcher004.html#___sec17" style="font-size: 80%;">&nbsp;&nbsp;&nbsp;Spring</a></li>
-     <!-- navigation toc: --> <li><a href="._pysketcher004.html#___sec18" style="font-size: 80%;">&nbsp;&nbsp;&nbsp;Dashpot</a></li>
-     <!-- navigation toc: --> <li><a href="._pysketcher004.html#___sec19" style="font-size: 80%;">&nbsp;&nbsp;&nbsp;Wavy</a></li>
-     <!-- navigation toc: --> <li><a href="._pysketcher004.html#___sec20" style="font-size: 80%;">&nbsp;&nbsp;&nbsp;Stochastic curves</a></li>
-     <!-- navigation toc: --> <li><a href="._pysketcher005.html#___sec21" style="font-size: 80%;"><b>Inner workings of the Pysketcher tool</b></a></li>
-     <!-- navigation toc: --> <li><a href="._pysketcher005.html#___sec22" style="font-size: 80%;">&nbsp;&nbsp;&nbsp;Example of classes for geometric objects</a></li>
-     <!-- navigation toc: --> <li><a href="._pysketcher005.html#___sec23" style="font-size: 80%;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Simple geometric objects</a></li>
-     <!-- navigation toc: --> <li><a href="._pysketcher005.html#___sec24" style="font-size: 80%;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Class curve</a></li>
-     <!-- navigation toc: --> <li><a href="._pysketcher005.html#___sec25" style="font-size: 80%;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Compound geometric objects</a></li>
-     <!-- navigation toc: --> <li><a href="._pysketcher005.html#___sec26" style="font-size: 80%;">&nbsp;&nbsp;&nbsp;Adding functionality via recursion</a></li>
-     <!-- navigation toc: --> <li><a href="._pysketcher005.html#___sec27" style="font-size: 80%;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Basic principles of recursion</a></li>
-     <!-- navigation toc: --> <li><a href="._pysketcher005.html#___sec28" style="font-size: 80%;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Explaining recursion</a></li>
+     <!-- navigation toc: --> <li><a href="._pysketcher003.html#sketcher:ex:pendulum:anim" style="font-size: 80%;">&nbsp;&nbsp;&nbsp;Animated body diagram</a></li>
+     <!-- navigation toc: --> <li><a href="._pysketcher003.html#___sec12" style="font-size: 80%;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Function for drawing the body diagram</a></li>
+     <!-- navigation toc: --> <li><a href="._pysketcher003.html#___sec13" style="font-size: 80%;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Equations for the motion and forces</a></li>
+     <!-- navigation toc: --> <li><a href="._pysketcher003.html#___sec14" style="font-size: 80%;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Numerical solution</a></li>
+     <!-- navigation toc: --> <li><a href="._pysketcher003.html#___sec15" style="font-size: 80%;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Animation</a></li>
+     <!-- navigation toc: --> <li><a href="._pysketcher004.html#___sec16" style="font-size: 80%;"><b>Basic shapes</b></a></li>
+     <!-- navigation toc: --> <li><a href="._pysketcher004.html#___sec17" style="font-size: 80%;">&nbsp;&nbsp;&nbsp;Axis</a></li>
+     <!-- navigation toc: --> <li><a href="._pysketcher004.html#___sec18" style="font-size: 80%;">&nbsp;&nbsp;&nbsp;Distance with text</a></li>
+     <!-- navigation toc: --> <li><a href="._pysketcher004.html#___sec19" style="font-size: 80%;">&nbsp;&nbsp;&nbsp;Rectangle</a></li>
+     <!-- navigation toc: --> <li><a href="._pysketcher004.html#___sec20" style="font-size: 80%;">&nbsp;&nbsp;&nbsp;Triangle</a></li>
+     <!-- navigation toc: --> <li><a href="._pysketcher004.html#___sec21" style="font-size: 80%;">&nbsp;&nbsp;&nbsp;Arc</a></li>
+     <!-- navigation toc: --> <li><a href="._pysketcher004.html#___sec22" style="font-size: 80%;">&nbsp;&nbsp;&nbsp;Spring</a></li>
+     <!-- navigation toc: --> <li><a href="._pysketcher004.html#___sec23" style="font-size: 80%;">&nbsp;&nbsp;&nbsp;Dashpot</a></li>
+     <!-- navigation toc: --> <li><a href="._pysketcher004.html#___sec24" style="font-size: 80%;">&nbsp;&nbsp;&nbsp;Wavy</a></li>
+     <!-- navigation toc: --> <li><a href="._pysketcher004.html#___sec25" style="font-size: 80%;">&nbsp;&nbsp;&nbsp;Stochastic curves</a></li>
+     <!-- navigation toc: --> <li><a href="._pysketcher005.html#___sec26" style="font-size: 80%;"><b>Inner workings of the Pysketcher tool</b></a></li>
+     <!-- navigation toc: --> <li><a href="._pysketcher005.html#___sec27" style="font-size: 80%;">&nbsp;&nbsp;&nbsp;Example of classes for geometric objects</a></li>
+     <!-- navigation toc: --> <li><a href="._pysketcher005.html#___sec28" style="font-size: 80%;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Simple geometric objects</a></li>
+     <!-- navigation toc: --> <li><a href="._pysketcher005.html#___sec29" style="font-size: 80%;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Class curve</a></li>
+     <!-- navigation toc: --> <li><a href="._pysketcher005.html#___sec30" style="font-size: 80%;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Compound geometric objects</a></li>
+     <!-- navigation toc: --> <li><a href="._pysketcher005.html#___sec31" style="font-size: 80%;">&nbsp;&nbsp;&nbsp;Adding functionality via recursion</a></li>
+     <!-- navigation toc: --> <li><a href="._pysketcher005.html#___sec32" style="font-size: 80%;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Basic principles of recursion</a></li>
+     <!-- navigation toc: --> <li><a href="._pysketcher005.html#___sec33" style="font-size: 80%;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Explaining recursion</a></li>
      <!-- navigation toc: --> <li><a href="._pysketcher005.html#sketcher:scaling" style="font-size: 80%;">&nbsp;&nbsp;&nbsp;Scaling, translating, and rotating a figure</a></li>
      <!-- navigation toc: --> <li><a href="._pysketcher005.html#sketcher:scaling" style="font-size: 80%;">&nbsp;&nbsp;&nbsp;Scaling, translating, and rotating a figure</a></li>
-     <!-- navigation toc: --> <li><a href="._pysketcher005.html#___sec30" style="font-size: 80%;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Scaling</a></li>
-     <!-- navigation toc: --> <li><a href="._pysketcher005.html#___sec31" style="font-size: 80%;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Translation</a></li>
-     <!-- navigation toc: --> <li><a href="._pysketcher005.html#___sec32" style="font-size: 80%;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Rotation</a></li>
+     <!-- navigation toc: --> <li><a href="._pysketcher005.html#___sec35" style="font-size: 80%;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Scaling</a></li>
+     <!-- navigation toc: --> <li><a href="._pysketcher005.html#___sec36" style="font-size: 80%;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Translation</a></li>
+     <!-- navigation toc: --> <li><a href="._pysketcher005.html#___sec37" style="font-size: 80%;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Rotation</a></li>
 
 
         </ul>
         </ul>
       </li>
       </li>
@@ -177,19 +202,20 @@ Table of contents</h2>
 <a href="._pysketcher003.html#sketcher:ex:pendulum"> A simple pendulum </a><br>
 <a href="._pysketcher003.html#sketcher:ex:pendulum"> A simple pendulum </a><br>
 &nbsp; &nbsp; &nbsp; <a href="._pysketcher003.html#sketcher:ex:pendulum:basic"> The basic physics sketch </a><br>
 &nbsp; &nbsp; &nbsp; <a href="._pysketcher003.html#sketcher:ex:pendulum:basic"> The basic physics sketch </a><br>
 &nbsp; &nbsp; &nbsp; <a href="._pysketcher003.html#___sec10"> The body diagram </a><br>
 &nbsp; &nbsp; &nbsp; <a href="._pysketcher003.html#___sec10"> The body diagram </a><br>
-<a href="._pysketcher004.html#___sec11"> Basic shapes </a><br>
-&nbsp; &nbsp; &nbsp; <a href="._pysketcher004.html#___sec12"> Axis </a><br>
-&nbsp; &nbsp; &nbsp; <a href="._pysketcher004.html#___sec13"> Distance with text </a><br>
-&nbsp; &nbsp; &nbsp; <a href="._pysketcher004.html#___sec14"> Rectangle </a><br>
-&nbsp; &nbsp; &nbsp; <a href="._pysketcher004.html#___sec15"> Triangle </a><br>
-&nbsp; &nbsp; &nbsp; <a href="._pysketcher004.html#___sec16"> Arc </a><br>
-&nbsp; &nbsp; &nbsp; <a href="._pysketcher004.html#___sec17"> Spring </a><br>
-&nbsp; &nbsp; &nbsp; <a href="._pysketcher004.html#___sec18"> Dashpot </a><br>
-&nbsp; &nbsp; &nbsp; <a href="._pysketcher004.html#___sec19"> Wavy </a><br>
-&nbsp; &nbsp; &nbsp; <a href="._pysketcher004.html#___sec20"> Stochastic curves </a><br>
-<a href="._pysketcher005.html#___sec21"> Inner workings of the Pysketcher tool </a><br>
-&nbsp; &nbsp; &nbsp; <a href="._pysketcher005.html#___sec22"> Example of classes for geometric objects </a><br>
-&nbsp; &nbsp; &nbsp; <a href="._pysketcher005.html#___sec26"> Adding functionality via recursion </a><br>
+&nbsp; &nbsp; &nbsp; <a href="._pysketcher003.html#sketcher:ex:pendulum:anim"> Animated body diagram </a><br>
+<a href="._pysketcher004.html#___sec16"> Basic shapes </a><br>
+&nbsp; &nbsp; &nbsp; <a href="._pysketcher004.html#___sec17"> Axis </a><br>
+&nbsp; &nbsp; &nbsp; <a href="._pysketcher004.html#___sec18"> Distance with text </a><br>
+&nbsp; &nbsp; &nbsp; <a href="._pysketcher004.html#___sec19"> Rectangle </a><br>
+&nbsp; &nbsp; &nbsp; <a href="._pysketcher004.html#___sec20"> Triangle </a><br>
+&nbsp; &nbsp; &nbsp; <a href="._pysketcher004.html#___sec21"> Arc </a><br>
+&nbsp; &nbsp; &nbsp; <a href="._pysketcher004.html#___sec22"> Spring </a><br>
+&nbsp; &nbsp; &nbsp; <a href="._pysketcher004.html#___sec23"> Dashpot </a><br>
+&nbsp; &nbsp; &nbsp; <a href="._pysketcher004.html#___sec24"> Wavy </a><br>
+&nbsp; &nbsp; &nbsp; <a href="._pysketcher004.html#___sec25"> Stochastic curves </a><br>
+<a href="._pysketcher005.html#___sec26"> Inner workings of the Pysketcher tool </a><br>
+&nbsp; &nbsp; &nbsp; <a href="._pysketcher005.html#___sec27"> Example of classes for geometric objects </a><br>
+&nbsp; &nbsp; &nbsp; <a href="._pysketcher005.html#___sec31"> Adding functionality via recursion </a><br>
 &nbsp; &nbsp; &nbsp; <a href="._pysketcher005.html#sketcher:scaling"> Scaling, translating, and rotating a figure </a><br>
 &nbsp; &nbsp; &nbsp; <a href="._pysketcher005.html#sketcher:scaling"> Scaling, translating, and rotating a figure </a><br>
 </p>
 </p>
 <p>
 <p>

+ 67 - 42
doc/pub/tutorial/._pysketcher002.html

@@ -55,34 +55,42 @@ Automatically generated HTML file from DocOnce source
                'sketcher:ex:pendulum:basic',
                'sketcher:ex:pendulum:basic',
                'sketcher:ex:pendulum:basic'),
                'sketcher:ex:pendulum:basic'),
               ('The body diagram', 2, None, '___sec10'),
               ('The body diagram', 2, None, '___sec10'),
-              ('Basic shapes', 1, None, '___sec11'),
-              ('Axis', 2, None, '___sec12'),
-              ('Distance with text', 2, None, '___sec13'),
-              ('Rectangle', 2, None, '___sec14'),
-              ('Triangle', 2, None, '___sec15'),
-              ('Arc', 2, None, '___sec16'),
-              ('Spring', 2, None, '___sec17'),
-              ('Dashpot', 2, None, '___sec18'),
-              ('Wavy', 2, None, '___sec19'),
-              ('Stochastic curves', 2, None, '___sec20'),
-              ('Inner workings of the Pysketcher tool', 1, None, '___sec21'),
+              ('Animated body diagram',
+               2,
+               'sketcher:ex:pendulum:anim',
+               'sketcher:ex:pendulum:anim'),
+              ('Function for drawing the body diagram', 3, None, '___sec12'),
+              ('Equations for the motion and forces', 3, None, '___sec13'),
+              ('Numerical solution', 3, None, '___sec14'),
+              ('Animation', 3, None, '___sec15'),
+              ('Basic shapes', 1, None, '___sec16'),
+              ('Axis', 2, None, '___sec17'),
+              ('Distance with text', 2, None, '___sec18'),
+              ('Rectangle', 2, None, '___sec19'),
+              ('Triangle', 2, None, '___sec20'),
+              ('Arc', 2, None, '___sec21'),
+              ('Spring', 2, None, '___sec22'),
+              ('Dashpot', 2, None, '___sec23'),
+              ('Wavy', 2, None, '___sec24'),
+              ('Stochastic curves', 2, None, '___sec25'),
+              ('Inner workings of the Pysketcher tool', 1, None, '___sec26'),
               ('Example of classes for geometric objects',
               ('Example of classes for geometric objects',
                2,
                2,
                None,
                None,
-               '___sec22'),
-              ('Simple geometric objects', 3, None, '___sec23'),
-              ('Class curve', 3, None, '___sec24'),
-              ('Compound geometric objects', 3, None, '___sec25'),
-              ('Adding functionality via recursion', 2, None, '___sec26'),
-              ('Basic principles of recursion', 3, None, '___sec27'),
-              ('Explaining recursion', 3, None, '___sec28'),
+               '___sec27'),
+              ('Simple geometric objects', 3, None, '___sec28'),
+              ('Class curve', 3, None, '___sec29'),
+              ('Compound geometric objects', 3, None, '___sec30'),
+              ('Adding functionality via recursion', 2, None, '___sec31'),
+              ('Basic principles of recursion', 3, None, '___sec32'),
+              ('Explaining recursion', 3, None, '___sec33'),
               ('Scaling, translating, and rotating a figure',
               ('Scaling, translating, and rotating a figure',
                2,
                2,
                'sketcher:scaling',
                'sketcher:scaling',
                'sketcher:scaling'),
                'sketcher:scaling'),
-              ('Scaling', 3, None, '___sec30'),
-              ('Translation', 3, None, '___sec31'),
-              ('Rotation', 3, None, '___sec32')]}
+              ('Scaling', 3, None, '___sec35'),
+              ('Translation', 3, None, '___sec36'),
+              ('Rotation', 3, None, '___sec37')]}
 end of tocinfo -->
 end of tocinfo -->
 
 
 <body>
 <body>
@@ -101,6 +109,18 @@ MathJax.Hub.Config({
  src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML">
  src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML">
 </script>
 </script>
 
 
+<!-- newcommands.tex -->
+$$
+\newcommand{\half}{\frac{1}{2}}
+\newcommand{\tp}{\thinspace .}
+\newcommand{\rpos}{\boldsymbol{r}}
+\newcommand{\ii}{\boldsymbol{i}}
+\newcommand{\jj}{\boldsymbol{j}}
+\newcommand{\ir}{\boldsymbol{i}_r}
+\newcommand{\ith}{\boldsymbol{i}_{\theta}}
+$$
+
+
 
 
 
 
     
     
@@ -131,28 +151,33 @@ MathJax.Hub.Config({
      <!-- navigation toc: --> <li><a href="._pysketcher003.html#sketcher:ex:pendulum" style="font-size: 80%;"><b>A simple pendulum</b></a></li>
      <!-- navigation toc: --> <li><a href="._pysketcher003.html#sketcher:ex:pendulum" style="font-size: 80%;"><b>A simple pendulum</b></a></li>
      <!-- navigation toc: --> <li><a href="._pysketcher003.html#sketcher:ex:pendulum:basic" style="font-size: 80%;">&nbsp;&nbsp;&nbsp;The basic physics sketch</a></li>
      <!-- navigation toc: --> <li><a href="._pysketcher003.html#sketcher:ex:pendulum:basic" style="font-size: 80%;">&nbsp;&nbsp;&nbsp;The basic physics sketch</a></li>
      <!-- navigation toc: --> <li><a href="._pysketcher003.html#___sec10" style="font-size: 80%;">&nbsp;&nbsp;&nbsp;The body diagram</a></li>
      <!-- navigation toc: --> <li><a href="._pysketcher003.html#___sec10" style="font-size: 80%;">&nbsp;&nbsp;&nbsp;The body diagram</a></li>
-     <!-- navigation toc: --> <li><a href="._pysketcher004.html#___sec11" style="font-size: 80%;"><b>Basic shapes</b></a></li>
-     <!-- navigation toc: --> <li><a href="._pysketcher004.html#___sec12" style="font-size: 80%;">&nbsp;&nbsp;&nbsp;Axis</a></li>
-     <!-- navigation toc: --> <li><a href="._pysketcher004.html#___sec13" style="font-size: 80%;">&nbsp;&nbsp;&nbsp;Distance with text</a></li>
-     <!-- navigation toc: --> <li><a href="._pysketcher004.html#___sec14" style="font-size: 80%;">&nbsp;&nbsp;&nbsp;Rectangle</a></li>
-     <!-- navigation toc: --> <li><a href="._pysketcher004.html#___sec15" style="font-size: 80%;">&nbsp;&nbsp;&nbsp;Triangle</a></li>
-     <!-- navigation toc: --> <li><a href="._pysketcher004.html#___sec16" style="font-size: 80%;">&nbsp;&nbsp;&nbsp;Arc</a></li>
-     <!-- navigation toc: --> <li><a href="._pysketcher004.html#___sec17" style="font-size: 80%;">&nbsp;&nbsp;&nbsp;Spring</a></li>
-     <!-- navigation toc: --> <li><a href="._pysketcher004.html#___sec18" style="font-size: 80%;">&nbsp;&nbsp;&nbsp;Dashpot</a></li>
-     <!-- navigation toc: --> <li><a href="._pysketcher004.html#___sec19" style="font-size: 80%;">&nbsp;&nbsp;&nbsp;Wavy</a></li>
-     <!-- navigation toc: --> <li><a href="._pysketcher004.html#___sec20" style="font-size: 80%;">&nbsp;&nbsp;&nbsp;Stochastic curves</a></li>
-     <!-- navigation toc: --> <li><a href="._pysketcher005.html#___sec21" style="font-size: 80%;"><b>Inner workings of the Pysketcher tool</b></a></li>
-     <!-- navigation toc: --> <li><a href="._pysketcher005.html#___sec22" style="font-size: 80%;">&nbsp;&nbsp;&nbsp;Example of classes for geometric objects</a></li>
-     <!-- navigation toc: --> <li><a href="._pysketcher005.html#___sec23" style="font-size: 80%;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Simple geometric objects</a></li>
-     <!-- navigation toc: --> <li><a href="._pysketcher005.html#___sec24" style="font-size: 80%;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Class curve</a></li>
-     <!-- navigation toc: --> <li><a href="._pysketcher005.html#___sec25" style="font-size: 80%;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Compound geometric objects</a></li>
-     <!-- navigation toc: --> <li><a href="._pysketcher005.html#___sec26" style="font-size: 80%;">&nbsp;&nbsp;&nbsp;Adding functionality via recursion</a></li>
-     <!-- navigation toc: --> <li><a href="._pysketcher005.html#___sec27" style="font-size: 80%;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Basic principles of recursion</a></li>
-     <!-- navigation toc: --> <li><a href="._pysketcher005.html#___sec28" style="font-size: 80%;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Explaining recursion</a></li>
+     <!-- navigation toc: --> <li><a href="._pysketcher003.html#sketcher:ex:pendulum:anim" style="font-size: 80%;">&nbsp;&nbsp;&nbsp;Animated body diagram</a></li>
+     <!-- navigation toc: --> <li><a href="._pysketcher003.html#___sec12" style="font-size: 80%;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Function for drawing the body diagram</a></li>
+     <!-- navigation toc: --> <li><a href="._pysketcher003.html#___sec13" style="font-size: 80%;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Equations for the motion and forces</a></li>
+     <!-- navigation toc: --> <li><a href="._pysketcher003.html#___sec14" style="font-size: 80%;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Numerical solution</a></li>
+     <!-- navigation toc: --> <li><a href="._pysketcher003.html#___sec15" style="font-size: 80%;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Animation</a></li>
+     <!-- navigation toc: --> <li><a href="._pysketcher004.html#___sec16" style="font-size: 80%;"><b>Basic shapes</b></a></li>
+     <!-- navigation toc: --> <li><a href="._pysketcher004.html#___sec17" style="font-size: 80%;">&nbsp;&nbsp;&nbsp;Axis</a></li>
+     <!-- navigation toc: --> <li><a href="._pysketcher004.html#___sec18" style="font-size: 80%;">&nbsp;&nbsp;&nbsp;Distance with text</a></li>
+     <!-- navigation toc: --> <li><a href="._pysketcher004.html#___sec19" style="font-size: 80%;">&nbsp;&nbsp;&nbsp;Rectangle</a></li>
+     <!-- navigation toc: --> <li><a href="._pysketcher004.html#___sec20" style="font-size: 80%;">&nbsp;&nbsp;&nbsp;Triangle</a></li>
+     <!-- navigation toc: --> <li><a href="._pysketcher004.html#___sec21" style="font-size: 80%;">&nbsp;&nbsp;&nbsp;Arc</a></li>
+     <!-- navigation toc: --> <li><a href="._pysketcher004.html#___sec22" style="font-size: 80%;">&nbsp;&nbsp;&nbsp;Spring</a></li>
+     <!-- navigation toc: --> <li><a href="._pysketcher004.html#___sec23" style="font-size: 80%;">&nbsp;&nbsp;&nbsp;Dashpot</a></li>
+     <!-- navigation toc: --> <li><a href="._pysketcher004.html#___sec24" style="font-size: 80%;">&nbsp;&nbsp;&nbsp;Wavy</a></li>
+     <!-- navigation toc: --> <li><a href="._pysketcher004.html#___sec25" style="font-size: 80%;">&nbsp;&nbsp;&nbsp;Stochastic curves</a></li>
+     <!-- navigation toc: --> <li><a href="._pysketcher005.html#___sec26" style="font-size: 80%;"><b>Inner workings of the Pysketcher tool</b></a></li>
+     <!-- navigation toc: --> <li><a href="._pysketcher005.html#___sec27" style="font-size: 80%;">&nbsp;&nbsp;&nbsp;Example of classes for geometric objects</a></li>
+     <!-- navigation toc: --> <li><a href="._pysketcher005.html#___sec28" style="font-size: 80%;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Simple geometric objects</a></li>
+     <!-- navigation toc: --> <li><a href="._pysketcher005.html#___sec29" style="font-size: 80%;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Class curve</a></li>
+     <!-- navigation toc: --> <li><a href="._pysketcher005.html#___sec30" style="font-size: 80%;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Compound geometric objects</a></li>
+     <!-- navigation toc: --> <li><a href="._pysketcher005.html#___sec31" style="font-size: 80%;">&nbsp;&nbsp;&nbsp;Adding functionality via recursion</a></li>
+     <!-- navigation toc: --> <li><a href="._pysketcher005.html#___sec32" style="font-size: 80%;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Basic principles of recursion</a></li>
+     <!-- navigation toc: --> <li><a href="._pysketcher005.html#___sec33" style="font-size: 80%;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Explaining recursion</a></li>
      <!-- navigation toc: --> <li><a href="._pysketcher005.html#sketcher:scaling" style="font-size: 80%;">&nbsp;&nbsp;&nbsp;Scaling, translating, and rotating a figure</a></li>
      <!-- navigation toc: --> <li><a href="._pysketcher005.html#sketcher:scaling" style="font-size: 80%;">&nbsp;&nbsp;&nbsp;Scaling, translating, and rotating a figure</a></li>
-     <!-- navigation toc: --> <li><a href="._pysketcher005.html#___sec30" style="font-size: 80%;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Scaling</a></li>
-     <!-- navigation toc: --> <li><a href="._pysketcher005.html#___sec31" style="font-size: 80%;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Translation</a></li>
-     <!-- navigation toc: --> <li><a href="._pysketcher005.html#___sec32" style="font-size: 80%;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Rotation</a></li>
+     <!-- navigation toc: --> <li><a href="._pysketcher005.html#___sec35" style="font-size: 80%;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Scaling</a></li>
+     <!-- navigation toc: --> <li><a href="._pysketcher005.html#___sec36" style="font-size: 80%;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Translation</a></li>
+     <!-- navigation toc: --> <li><a href="._pysketcher005.html#___sec37" style="font-size: 80%;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Rotation</a></li>
 
 
         </ul>
         </ul>
       </li>
       </li>

+ 463 - 58
doc/pub/tutorial/._pysketcher003.html

@@ -55,34 +55,42 @@ Automatically generated HTML file from DocOnce source
                'sketcher:ex:pendulum:basic',
                'sketcher:ex:pendulum:basic',
                'sketcher:ex:pendulum:basic'),
                'sketcher:ex:pendulum:basic'),
               ('The body diagram', 2, None, '___sec10'),
               ('The body diagram', 2, None, '___sec10'),
-              ('Basic shapes', 1, None, '___sec11'),
-              ('Axis', 2, None, '___sec12'),
-              ('Distance with text', 2, None, '___sec13'),
-              ('Rectangle', 2, None, '___sec14'),
-              ('Triangle', 2, None, '___sec15'),
-              ('Arc', 2, None, '___sec16'),
-              ('Spring', 2, None, '___sec17'),
-              ('Dashpot', 2, None, '___sec18'),
-              ('Wavy', 2, None, '___sec19'),
-              ('Stochastic curves', 2, None, '___sec20'),
-              ('Inner workings of the Pysketcher tool', 1, None, '___sec21'),
+              ('Animated body diagram',
+               2,
+               'sketcher:ex:pendulum:anim',
+               'sketcher:ex:pendulum:anim'),
+              ('Function for drawing the body diagram', 3, None, '___sec12'),
+              ('Equations for the motion and forces', 3, None, '___sec13'),
+              ('Numerical solution', 3, None, '___sec14'),
+              ('Animation', 3, None, '___sec15'),
+              ('Basic shapes', 1, None, '___sec16'),
+              ('Axis', 2, None, '___sec17'),
+              ('Distance with text', 2, None, '___sec18'),
+              ('Rectangle', 2, None, '___sec19'),
+              ('Triangle', 2, None, '___sec20'),
+              ('Arc', 2, None, '___sec21'),
+              ('Spring', 2, None, '___sec22'),
+              ('Dashpot', 2, None, '___sec23'),
+              ('Wavy', 2, None, '___sec24'),
+              ('Stochastic curves', 2, None, '___sec25'),
+              ('Inner workings of the Pysketcher tool', 1, None, '___sec26'),
               ('Example of classes for geometric objects',
               ('Example of classes for geometric objects',
                2,
                2,
                None,
                None,
-               '___sec22'),
-              ('Simple geometric objects', 3, None, '___sec23'),
-              ('Class curve', 3, None, '___sec24'),
-              ('Compound geometric objects', 3, None, '___sec25'),
-              ('Adding functionality via recursion', 2, None, '___sec26'),
-              ('Basic principles of recursion', 3, None, '___sec27'),
-              ('Explaining recursion', 3, None, '___sec28'),
+               '___sec27'),
+              ('Simple geometric objects', 3, None, '___sec28'),
+              ('Class curve', 3, None, '___sec29'),
+              ('Compound geometric objects', 3, None, '___sec30'),
+              ('Adding functionality via recursion', 2, None, '___sec31'),
+              ('Basic principles of recursion', 3, None, '___sec32'),
+              ('Explaining recursion', 3, None, '___sec33'),
               ('Scaling, translating, and rotating a figure',
               ('Scaling, translating, and rotating a figure',
                2,
                2,
                'sketcher:scaling',
                'sketcher:scaling',
                'sketcher:scaling'),
                'sketcher:scaling'),
-              ('Scaling', 3, None, '___sec30'),
-              ('Translation', 3, None, '___sec31'),
-              ('Rotation', 3, None, '___sec32')]}
+              ('Scaling', 3, None, '___sec35'),
+              ('Translation', 3, None, '___sec36'),
+              ('Rotation', 3, None, '___sec37')]}
 end of tocinfo -->
 end of tocinfo -->
 
 
 <body>
 <body>
@@ -101,6 +109,18 @@ MathJax.Hub.Config({
  src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML">
  src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML">
 </script>
 </script>
 
 
+<!-- newcommands.tex -->
+$$
+\newcommand{\half}{\frac{1}{2}}
+\newcommand{\tp}{\thinspace .}
+\newcommand{\rpos}{\boldsymbol{r}}
+\newcommand{\ii}{\boldsymbol{i}}
+\newcommand{\jj}{\boldsymbol{j}}
+\newcommand{\ir}{\boldsymbol{i}_r}
+\newcommand{\ith}{\boldsymbol{i}_{\theta}}
+$$
+
+
 
 
 
 
     
     
@@ -131,28 +151,33 @@ MathJax.Hub.Config({
      <!-- navigation toc: --> <li><a href="#sketcher:ex:pendulum" style="font-size: 80%;"><b>A simple pendulum</b></a></li>
      <!-- navigation toc: --> <li><a href="#sketcher:ex:pendulum" style="font-size: 80%;"><b>A simple pendulum</b></a></li>
      <!-- navigation toc: --> <li><a href="#sketcher:ex:pendulum:basic" style="font-size: 80%;">&nbsp;&nbsp;&nbsp;The basic physics sketch</a></li>
      <!-- navigation toc: --> <li><a href="#sketcher:ex:pendulum:basic" style="font-size: 80%;">&nbsp;&nbsp;&nbsp;The basic physics sketch</a></li>
      <!-- navigation toc: --> <li><a href="#___sec10" style="font-size: 80%;">&nbsp;&nbsp;&nbsp;The body diagram</a></li>
      <!-- navigation toc: --> <li><a href="#___sec10" style="font-size: 80%;">&nbsp;&nbsp;&nbsp;The body diagram</a></li>
-     <!-- navigation toc: --> <li><a href="._pysketcher004.html#___sec11" style="font-size: 80%;"><b>Basic shapes</b></a></li>
-     <!-- navigation toc: --> <li><a href="._pysketcher004.html#___sec12" style="font-size: 80%;">&nbsp;&nbsp;&nbsp;Axis</a></li>
-     <!-- navigation toc: --> <li><a href="._pysketcher004.html#___sec13" style="font-size: 80%;">&nbsp;&nbsp;&nbsp;Distance with text</a></li>
-     <!-- navigation toc: --> <li><a href="._pysketcher004.html#___sec14" style="font-size: 80%;">&nbsp;&nbsp;&nbsp;Rectangle</a></li>
-     <!-- navigation toc: --> <li><a href="._pysketcher004.html#___sec15" style="font-size: 80%;">&nbsp;&nbsp;&nbsp;Triangle</a></li>
-     <!-- navigation toc: --> <li><a href="._pysketcher004.html#___sec16" style="font-size: 80%;">&nbsp;&nbsp;&nbsp;Arc</a></li>
-     <!-- navigation toc: --> <li><a href="._pysketcher004.html#___sec17" style="font-size: 80%;">&nbsp;&nbsp;&nbsp;Spring</a></li>
-     <!-- navigation toc: --> <li><a href="._pysketcher004.html#___sec18" style="font-size: 80%;">&nbsp;&nbsp;&nbsp;Dashpot</a></li>
-     <!-- navigation toc: --> <li><a href="._pysketcher004.html#___sec19" style="font-size: 80%;">&nbsp;&nbsp;&nbsp;Wavy</a></li>
-     <!-- navigation toc: --> <li><a href="._pysketcher004.html#___sec20" style="font-size: 80%;">&nbsp;&nbsp;&nbsp;Stochastic curves</a></li>
-     <!-- navigation toc: --> <li><a href="._pysketcher005.html#___sec21" style="font-size: 80%;"><b>Inner workings of the Pysketcher tool</b></a></li>
-     <!-- navigation toc: --> <li><a href="._pysketcher005.html#___sec22" style="font-size: 80%;">&nbsp;&nbsp;&nbsp;Example of classes for geometric objects</a></li>
-     <!-- navigation toc: --> <li><a href="._pysketcher005.html#___sec23" style="font-size: 80%;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Simple geometric objects</a></li>
-     <!-- navigation toc: --> <li><a href="._pysketcher005.html#___sec24" style="font-size: 80%;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Class curve</a></li>
-     <!-- navigation toc: --> <li><a href="._pysketcher005.html#___sec25" style="font-size: 80%;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Compound geometric objects</a></li>
-     <!-- navigation toc: --> <li><a href="._pysketcher005.html#___sec26" style="font-size: 80%;">&nbsp;&nbsp;&nbsp;Adding functionality via recursion</a></li>
-     <!-- navigation toc: --> <li><a href="._pysketcher005.html#___sec27" style="font-size: 80%;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Basic principles of recursion</a></li>
-     <!-- navigation toc: --> <li><a href="._pysketcher005.html#___sec28" style="font-size: 80%;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Explaining recursion</a></li>
+     <!-- navigation toc: --> <li><a href="#sketcher:ex:pendulum:anim" style="font-size: 80%;">&nbsp;&nbsp;&nbsp;Animated body diagram</a></li>
+     <!-- navigation toc: --> <li><a href="#___sec12" style="font-size: 80%;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Function for drawing the body diagram</a></li>
+     <!-- navigation toc: --> <li><a href="#___sec13" style="font-size: 80%;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Equations for the motion and forces</a></li>
+     <!-- navigation toc: --> <li><a href="#___sec14" style="font-size: 80%;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Numerical solution</a></li>
+     <!-- navigation toc: --> <li><a href="#___sec15" style="font-size: 80%;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Animation</a></li>
+     <!-- navigation toc: --> <li><a href="._pysketcher004.html#___sec16" style="font-size: 80%;"><b>Basic shapes</b></a></li>
+     <!-- navigation toc: --> <li><a href="._pysketcher004.html#___sec17" style="font-size: 80%;">&nbsp;&nbsp;&nbsp;Axis</a></li>
+     <!-- navigation toc: --> <li><a href="._pysketcher004.html#___sec18" style="font-size: 80%;">&nbsp;&nbsp;&nbsp;Distance with text</a></li>
+     <!-- navigation toc: --> <li><a href="._pysketcher004.html#___sec19" style="font-size: 80%;">&nbsp;&nbsp;&nbsp;Rectangle</a></li>
+     <!-- navigation toc: --> <li><a href="._pysketcher004.html#___sec20" style="font-size: 80%;">&nbsp;&nbsp;&nbsp;Triangle</a></li>
+     <!-- navigation toc: --> <li><a href="._pysketcher004.html#___sec21" style="font-size: 80%;">&nbsp;&nbsp;&nbsp;Arc</a></li>
+     <!-- navigation toc: --> <li><a href="._pysketcher004.html#___sec22" style="font-size: 80%;">&nbsp;&nbsp;&nbsp;Spring</a></li>
+     <!-- navigation toc: --> <li><a href="._pysketcher004.html#___sec23" style="font-size: 80%;">&nbsp;&nbsp;&nbsp;Dashpot</a></li>
+     <!-- navigation toc: --> <li><a href="._pysketcher004.html#___sec24" style="font-size: 80%;">&nbsp;&nbsp;&nbsp;Wavy</a></li>
+     <!-- navigation toc: --> <li><a href="._pysketcher004.html#___sec25" style="font-size: 80%;">&nbsp;&nbsp;&nbsp;Stochastic curves</a></li>
+     <!-- navigation toc: --> <li><a href="._pysketcher005.html#___sec26" style="font-size: 80%;"><b>Inner workings of the Pysketcher tool</b></a></li>
+     <!-- navigation toc: --> <li><a href="._pysketcher005.html#___sec27" style="font-size: 80%;">&nbsp;&nbsp;&nbsp;Example of classes for geometric objects</a></li>
+     <!-- navigation toc: --> <li><a href="._pysketcher005.html#___sec28" style="font-size: 80%;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Simple geometric objects</a></li>
+     <!-- navigation toc: --> <li><a href="._pysketcher005.html#___sec29" style="font-size: 80%;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Class curve</a></li>
+     <!-- navigation toc: --> <li><a href="._pysketcher005.html#___sec30" style="font-size: 80%;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Compound geometric objects</a></li>
+     <!-- navigation toc: --> <li><a href="._pysketcher005.html#___sec31" style="font-size: 80%;">&nbsp;&nbsp;&nbsp;Adding functionality via recursion</a></li>
+     <!-- navigation toc: --> <li><a href="._pysketcher005.html#___sec32" style="font-size: 80%;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Basic principles of recursion</a></li>
+     <!-- navigation toc: --> <li><a href="._pysketcher005.html#___sec33" style="font-size: 80%;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Explaining recursion</a></li>
      <!-- navigation toc: --> <li><a href="._pysketcher005.html#sketcher:scaling" style="font-size: 80%;">&nbsp;&nbsp;&nbsp;Scaling, translating, and rotating a figure</a></li>
      <!-- navigation toc: --> <li><a href="._pysketcher005.html#sketcher:scaling" style="font-size: 80%;">&nbsp;&nbsp;&nbsp;Scaling, translating, and rotating a figure</a></li>
-     <!-- navigation toc: --> <li><a href="._pysketcher005.html#___sec30" style="font-size: 80%;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Scaling</a></li>
-     <!-- navigation toc: --> <li><a href="._pysketcher005.html#___sec31" style="font-size: 80%;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Translation</a></li>
-     <!-- navigation toc: --> <li><a href="._pysketcher005.html#___sec32" style="font-size: 80%;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Rotation</a></li>
+     <!-- navigation toc: --> <li><a href="._pysketcher005.html#___sec35" style="font-size: 80%;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Scaling</a></li>
+     <!-- navigation toc: --> <li><a href="._pysketcher005.html#___sec36" style="font-size: 80%;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Translation</a></li>
+     <!-- navigation toc: --> <li><a href="._pysketcher005.html#___sec37" style="font-size: 80%;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Rotation</a></li>
 
 
         </ul>
         </ul>
       </li>
       </li>
@@ -174,7 +199,12 @@ MathJax.Hub.Config({
 
 
 <p>
 <p>
 We now want to make a sketch of simple pendulum from physics, as shown
 We now want to make a sketch of simple pendulum from physics, as shown
-in Figure <a href="#sketcher:ex:pendulum:fig1">8</a>. A suggested work flow is to
+in Figure <a href="#sketcher:ex:pendulum:fig1">8</a>. A body with mass \( m \) is attached
+to a massless, stiff rod, which can rotate about a point, causing the
+pendulum to oscillate.
+
+<p>
+A suggested work flow is to
 first sketch the figure on a piece of paper and introduce a coordinate
 first sketch the figure on a piece of paper and introduce a coordinate
 system. A simple coordinate system is indicated in Figure
 system. A simple coordinate system is indicated in Figure
 <a href="#sketcher:ex:pendulum:fig1wgrid">9</a>. In a code we introduce variables
 <a href="#sketcher:ex:pendulum:fig1wgrid">9</a>. In a code we introduce variables
@@ -206,13 +236,13 @@ Also note that we in this example let all lines be blue by default.
 <center> <!-- figure -->
 <center> <!-- figure -->
 <hr class="figure">
 <hr class="figure">
 <center><p class="caption">Figure 8:  Sketch of a simple pendulum. <div id="sketcher:ex:pendulum:fig1"></div> </p></center>
 <center><p class="caption">Figure 8:  Sketch of a simple pendulum. <div id="sketcher:ex:pendulum:fig1"></div> </p></center>
-<p><img src="fig-tut/pendulum1.png" align="bottom" width=400></p>
+<p><img src="fig-tut/pendulum1.png" align="bottom" width=300></p>
 </center>
 </center>
 
 
 <p>
 <p>
 <center> <!-- figure -->
 <center> <!-- figure -->
 <hr class="figure">
 <hr class="figure">
-<center><p class="caption">Figure 9:  Sketch of a simple pendulum. <div id="sketcher:ex:pendulum:fig1wgrid"></div> </p></center>
+<center><p class="caption">Figure 9:  Sketch with assisting coordinate system. <div id="sketcher:ex:pendulum:fig1wgrid"></div> </p></center>
 <p><img src="fig-tut/pendulum1_wgrid.png" align="bottom" width=400></p>
 <p><img src="fig-tut/pendulum1_wgrid.png" align="bottom" width=400></p>
 </center>
 </center>
 
 
@@ -253,13 +283,18 @@ Figure <a href="#sketcher:ex:pendulum:fig1">8</a> we see that we need
 
 
 Pysketcher has objects for each of these elements in our sketch.
 Pysketcher has objects for each of these elements in our sketch.
 We start with the simplest element: the vertical line, going from
 We start with the simplest element: the vertical line, going from
-<code>P</code> to <code>P</code> minus the length in \( y \) direction:
+<code>P</code> to <code>P</code> minus the length \( L \) in \( y \) direction:
 
 
 <p>
 <p>
 
 
 <!-- code=python (!bc pycod) typeset with pygments style "default" -->
 <!-- code=python (!bc pycod) typeset with pygments style "default" -->
 <div class="highlight" style="background: #f8f8f8"><pre style="line-height: 125%">vertical <span style="color: #666666">=</span> Line(P, P<span style="color: #666666">-</span>point(<span style="color: #666666">0</span>,L))
 <div class="highlight" style="background: #f8f8f8"><pre style="line-height: 125%">vertical <span style="color: #666666">=</span> Line(P, P<span style="color: #666666">-</span>point(<span style="color: #666666">0</span>,L))
 </pre></div>
 </pre></div>
+<p>
+The class <code>point</code> is very convenient: it turns its two coordinates into
+a vector with which we can compute, and is therefore one of the most
+widely used Pysketcher objects.
+
 <p>
 <p>
 The path of the mass is an arc that can be made by
 The path of the mass is an arc that can be made by
 Pysketcher's <code>Arc</code> object:
 Pysketcher's <code>Arc</code> object:
@@ -271,7 +306,7 @@ Pysketcher's <code>Arc</code> object:
 </pre></div>
 </pre></div>
 <p>
 <p>
 The first argument <code>P</code> is the center point, the second is the
 The first argument <code>P</code> is the center point, the second is the
-radius (<code>L</code> here), the next arguments is the start angle, here
+radius (<code>L</code> here), the next argument is the start angle, here
 it starts at -90 degrees, while the next argument is the angle of
 it starts at -90 degrees, while the next argument is the angle of
 the arc, here <code>a</code>.
 the arc, here <code>a</code>.
 For the path of the mass, we also need an arc object, but this
 For the path of the mass, we also need an arc object, but this
@@ -296,10 +331,11 @@ adjust spacings as one goes along.
 The rod is simply a line from <code>P</code> to the mass. We can easily
 The rod is simply a line from <code>P</code> to the mass. We can easily
 compute the position of the mass from basic geometry considerations,
 compute the position of the mass from basic geometry considerations,
 but it is easier and safer to look up this point in other objects
 but it is easier and safer to look up this point in other objects
-if it is already computed. The <code>path</code> object stores its start and
+if it is already computed. In the present case,
+the <code>path</code> object stored its start and
 end points, so <code>path.geometric_features()['end']</code> is the end point
 end points, so <code>path.geometric_features()['end']</code> is the end point
 of the path, which is the position of the mass. We can therefore
 of the path, which is the position of the mass. We can therefore
-create the rod simply as a line from <code>P</code> to this end point:
+create the rod simply as a line from <code>P</code> to this already computed end point:
 
 
 <p>
 <p>
 
 
@@ -351,6 +387,8 @@ length<span style="color: #666666">.</span>translate(L<span style="color: #66666
 For this translation we need a unit vector in the normal direction
 For this translation we need a unit vector in the normal direction
 of the rod, which is from geometric considerations given by
 of the rod, which is from geometric considerations given by
 \( (\cos a, \sin a) \), when \( a \) is the angle of the pendulum.
 \( (\cos a, \sin a) \), when \( a \) is the angle of the pendulum.
+Alternatively, we could have found the normal vector as a vector that
+is normal to <code>unit_rod_vec</code>: <code>point(-unit_rod_vec[1],unit_rod_vec[0])</code>.
 
 
 <p>
 <p>
 The final object is the gravity force vector, which is so common
 The final object is the gravity force vector, which is so common
@@ -363,15 +401,15 @@ in physics sketches that Pysketcher has a ready-made object: <code>Gravity</code
 </pre></div>
 </pre></div>
 <p>
 <p>
 Since blue is the default color for
 Since blue is the default color for
-lines, we want the dashed lines (<code>vertical</code> and <code>path</code>) to be black
-and dashed with linewidth 1. These properties can be set one by one,
-but we can also make a little helper function:
+lines, we want the dashed lines (for <code>vertical</code> and <code>path</code>) to be black
+and with linewidth 1. These properties can be set one by one for each
+object, but we can also make a little helper function:
 
 
 <p>
 <p>
 
 
 <!-- code=python (!bc pycod) typeset with pygments style "default" -->
 <!-- code=python (!bc pycod) typeset with pygments style "default" -->
 <div class="highlight" style="background: #f8f8f8"><pre style="line-height: 125%"><span style="color: #008000; font-weight: bold">def</span> <span style="color: #0000FF">set_dashed_thin_blackline</span>(<span style="color: #666666">*</span>objects):
 <div class="highlight" style="background: #f8f8f8"><pre style="line-height: 125%"><span style="color: #008000; font-weight: bold">def</span> <span style="color: #0000FF">set_dashed_thin_blackline</span>(<span style="color: #666666">*</span>objects):
-    <span style="color: #BA2121; font-style: italic">&quot;&quot;&quot;Set linestyle of an object to dashed, black, width=1.&quot;&quot;&quot;</span>
+    <span style="color: #BA2121; font-style: italic">&quot;&quot;&quot;Set linestyle of objects to dashed, black, width=1.&quot;&quot;&quot;</span>
     <span style="color: #008000; font-weight: bold">for</span> obj <span style="color: #AA22FF; font-weight: bold">in</span> objects:
     <span style="color: #008000; font-weight: bold">for</span> obj <span style="color: #AA22FF; font-weight: bold">in</span> objects:
         obj<span style="color: #666666">.</span>set_linestyle(<span style="color: #BA2121">&#39;dashed&#39;</span>)
         obj<span style="color: #666666">.</span>set_linestyle(<span style="color: #BA2121">&#39;dashed&#39;</span>)
         obj<span style="color: #666666">.</span>set_linecolor(<span style="color: #BA2121">&#39;black&#39;</span>)
         obj<span style="color: #666666">.</span>set_linecolor(<span style="color: #BA2121">&#39;black&#39;</span>)
@@ -412,7 +450,7 @@ coordinates.
 <center> <!-- figure -->
 <center> <!-- figure -->
 <hr class="figure">
 <hr class="figure">
 <center><p class="caption">Figure 10:  Body diagram of a simple pendulum. <div id="sketcher:ex:pendulum:fig2wgrid"></div> </p></center>
 <center><p class="caption">Figure 10:  Body diagram of a simple pendulum. <div id="sketcher:ex:pendulum:fig2wgrid"></div> </p></center>
-<p><img src="fig-tut/pendulum5_wgrid.png" align="bottom" width=400></p>
+<p><img src="fig-tut/pendulum5_wgrid.png" align="bottom" width=300></p>
 </center>
 </center>
 
 
 <p>
 <p>
@@ -431,9 +469,9 @@ We start by listing the objects in the sketch:
 </ol>
 </ol>
 
 
 The first object, \( (x_0,y_0) \), is simply a plain text where we have
 The first object, \( (x_0,y_0) \), is simply a plain text where we have
-to experiment with the position. The unit vectors in polar coordinates
+to experiment with its position. The unit vectors in polar coordinates
 may be drawn using the Pysketcher's <code>Force</code> object since it has an
 may be drawn using the Pysketcher's <code>Force</code> object since it has an
-arrow with a text. The first three object can then be made as follows:
+arrow with a text. The first three objects can then be made as follows:
 
 
 <p>
 <p>
 
 
@@ -454,7 +492,7 @@ the tweaked displacement <code>point(-0.4,-0.1)</code> in terms of <code>W</code
 The <code>text_spacing</code> values in the <code>Force</code> objects also use absolute
 The <code>text_spacing</code> values in the <code>Force</code> objects also use absolute
 coordinates. Very often, this is much more convenient when adjusting
 coordinates. Very often, this is much more convenient when adjusting
 the objects, and global size parameters like <code>W</code> and <code>H</code> are in practice
 the objects, and global size parameters like <code>W</code> and <code>H</code> are in practice
-seldom changed.
+seldom changed, so the solution above is quite typical.
 
 
 <p>
 <p>
 The vertical, dashed line, the dashed rod, and the arc for \( \theta \)
 The vertical, dashed line, the dashed rod, and the arc for \( \theta \)
@@ -489,6 +527,11 @@ air_force <span style="color: #666666">=</span> Force(mass_pt, mass_pt <span sty
                   <span style="color: #BA2121">&#39;$\sim|v|v$&#39;</span>, text_pos<span style="color: #666666">=</span><span style="color: #BA2121">&#39;end&#39;</span>,
                   <span style="color: #BA2121">&#39;$\sim|v|v$&#39;</span>, text_pos<span style="color: #666666">=</span><span style="color: #BA2121">&#39;end&#39;</span>,
                   text_spacing<span style="color: #666666">=</span>(<span style="color: #666666">0.04</span>,<span style="color: #666666">0.005</span>))
                   text_spacing<span style="color: #666666">=</span>(<span style="color: #666666">0.04</span>,<span style="color: #666666">0.005</span>))
 </pre></div>
 </pre></div>
+<p>
+Note that the drag force from the air is directed perpendicular to
+the rod, so we construct a unit vector in this direction directly from
+the <code>rod_vec</code> vector.
+
 <p>
 <p>
 All objects are in place, and we can compose a figure to be drawn:
 All objects are in place, and we can compose a figure to be drawn:
 
 
@@ -511,7 +554,369 @@ dictionary, but (as in ordinary Python dictionaries) add new
 elements later when desired.
 elements later when desired.
 
 
 <p>
 <p>
-<!-- FIGURE: [fig-tut/pendulum1.png, width=400 frac=0.5] Sketch of a simple pendulum. <div id="sketcher:ex:pendulum:fig2"></div> -->
+<!-- FIGURE: [fig-tut/pendulum1.png, width=300 frac=0.5] Sketch of a simple pendulum. <div id="sketcher:ex:pendulum:fig2"></div> -->
+
+<h2 id="sketcher:ex:pendulum:anim">Animated body diagram</h2>
+
+<p>
+We want to make an animated body diagram so that we can see how forces
+develop in time according to the motion. This means that we must
+couple the sketch at each time level to a numerical solution for
+the motion of the pendulum.
+
+<h3 id="___sec12">Function for drawing the body diagram </h3>
+
+<p>
+The previous flat program for making sketches of the pendulum is not
+suitable when we want to make a sketch at a lot of different points
+in time, i.e., for a lot of different angles that the pendulum makes
+with the vertical. We therefore need to draw the body diagram in
+a function where the angle is a parameter. We also supply arrays
+containing the (numerically computed) values of the angle \( \theta \) and
+the forces at various time levels, plus the desired time point and level
+for this particular sketch:
+
+<p>
+
+<!-- code=python (!bc pycod) typeset with pygments style "default" -->
+<div class="highlight" style="background: #f8f8f8"><pre style="line-height: 125%"><span style="color: #008000; font-weight: bold">from</span> <span style="color: #0000FF; font-weight: bold">pysketcher</span> <span style="color: #008000; font-weight: bold">import</span> <span style="color: #666666">*</span>
+
+H <span style="color: #666666">=</span> <span style="color: #666666">15.</span>
+W <span style="color: #666666">=</span> <span style="color: #666666">17.</span>
+
+drawing_tool<span style="color: #666666">.</span>set_coordinate_system(xmin<span style="color: #666666">=0</span>, xmax<span style="color: #666666">=</span>W,
+                                   ymin<span style="color: #666666">=0</span>, ymax<span style="color: #666666">=</span>H,
+                                   axis<span style="color: #666666">=</span><span style="color: #008000">False</span>)
+
+<span style="color: #008000; font-weight: bold">def</span> <span style="color: #0000FF">pendulum</span>(theta, S, mg, drag, t, time_level):
+
+    drawing_tool<span style="color: #666666">.</span>set_linecolor(<span style="color: #BA2121">&#39;blue&#39;</span>)
+    <span style="color: #008000; font-weight: bold">import</span> <span style="color: #0000FF; font-weight: bold">math</span>
+    a <span style="color: #666666">=</span> math<span style="color: #666666">.</span>degrees(theta[time_level])
+    L <span style="color: #666666">=</span> <span style="color: #666666">0.4*</span>H         <span style="color: #408080; font-style: italic"># length</span>
+    P <span style="color: #666666">=</span> (W<span style="color: #666666">/2</span>, <span style="color: #666666">0.8*</span>H)  <span style="color: #408080; font-style: italic"># rotation point</span>
+
+    vertical <span style="color: #666666">=</span> Line(P, P<span style="color: #666666">-</span>point(<span style="color: #666666">0</span>,L))
+    path <span style="color: #666666">=</span> Arc(P, L, <span style="color: #666666">-90</span>, a)
+    angle <span style="color: #666666">=</span> Arc_wText(<span style="color: #BA2121">r&#39;$\theta$&#39;</span>, P, L<span style="color: #666666">/4</span>, <span style="color: #666666">-90</span>, a, text_spacing<span style="color: #666666">=1/30.</span>)
+
+    mass_pt <span style="color: #666666">=</span> path<span style="color: #666666">.</span>geometric_features()[<span style="color: #BA2121">&#39;end&#39;</span>]
+    rod <span style="color: #666666">=</span> Line(P, mass_pt)
+
+    mass <span style="color: #666666">=</span> Circle(center<span style="color: #666666">=</span>mass_pt, radius<span style="color: #666666">=</span>L<span style="color: #666666">/20.</span>)
+    mass<span style="color: #666666">.</span>set_filled_curves(color<span style="color: #666666">=</span><span style="color: #BA2121">&#39;blue&#39;</span>)
+    rod_vec <span style="color: #666666">=</span> rod<span style="color: #666666">.</span>geometric_features()[<span style="color: #BA2121">&#39;end&#39;</span>] <span style="color: #666666">-</span> \ 
+              rod<span style="color: #666666">.</span>geometric_features()[<span style="color: #BA2121">&#39;start&#39;</span>]
+    unit_rod_vec <span style="color: #666666">=</span> unit_vec(rod_vec)
+    mass_symbol <span style="color: #666666">=</span> Text(<span style="color: #BA2121">&#39;$m$&#39;</span>, mass_pt <span style="color: #666666">+</span> L<span style="color: #666666">/10*</span>unit_rod_vec)
+
+    length <span style="color: #666666">=</span> Distance_wText(P, mass_pt, <span style="color: #BA2121">&#39;$L$&#39;</span>)
+    <span style="color: #408080; font-style: italic"># Displace length indication</span>
+    length<span style="color: #666666">.</span>translate(L<span style="color: #666666">/15*</span>point(cos(radians(a)), sin(radians(a))))
+    gravity <span style="color: #666666">=</span> Gravity(start<span style="color: #666666">=</span>P<span style="color: #666666">+</span>point(<span style="color: #666666">0.8*</span>L,<span style="color: #666666">0</span>), length<span style="color: #666666">=</span>L<span style="color: #666666">/3</span>)
+
+    <span style="color: #008000; font-weight: bold">def</span> <span style="color: #0000FF">set_dashed_thin_blackline</span>(<span style="color: #666666">*</span>objects):
+        <span style="color: #BA2121; font-style: italic">&quot;&quot;&quot;Set linestyle of objects to dashed, black, width=1.&quot;&quot;&quot;</span>
+        <span style="color: #008000; font-weight: bold">for</span> obj <span style="color: #AA22FF; font-weight: bold">in</span> objects:
+            obj<span style="color: #666666">.</span>set_linestyle(<span style="color: #BA2121">&#39;dashed&#39;</span>)
+            obj<span style="color: #666666">.</span>set_linecolor(<span style="color: #BA2121">&#39;black&#39;</span>)
+            obj<span style="color: #666666">.</span>set_linewidth(<span style="color: #666666">1</span>)
+
+    set_dashed_thin_blackline(vertical, path)
+
+    fig <span style="color: #666666">=</span> Composition(
+        {<span style="color: #BA2121">&#39;body&#39;</span>: mass, <span style="color: #BA2121">&#39;rod&#39;</span>: rod,
+         <span style="color: #BA2121">&#39;vertical&#39;</span>: vertical, <span style="color: #BA2121">&#39;theta&#39;</span>: angle, <span style="color: #BA2121">&#39;path&#39;</span>: path,
+         <span style="color: #BA2121">&#39;g&#39;</span>: gravity, <span style="color: #BA2121">&#39;L&#39;</span>: length})
+
+    <span style="color: #408080; font-style: italic">#fig.draw()</span>
+    <span style="color: #408080; font-style: italic">#drawing_tool.display()</span>
+    <span style="color: #408080; font-style: italic">#drawing_tool.savefig(&#39;tmp_pendulum1&#39;)</span>
+
+    drawing_tool<span style="color: #666666">.</span>set_linecolor(<span style="color: #BA2121">&#39;black&#39;</span>)
+
+    rod_start <span style="color: #666666">=</span> rod<span style="color: #666666">.</span>geometric_features()[<span style="color: #BA2121">&#39;start&#39;</span>]  <span style="color: #408080; font-style: italic"># Point P</span>
+    vertical2 <span style="color: #666666">=</span> Line(rod_start, rod_start <span style="color: #666666">+</span> point(<span style="color: #666666">0</span>,<span style="color: #666666">-</span>L<span style="color: #666666">/3</span>))
+    set_dashed_thin_blackline(vertical2)
+    set_dashed_thin_blackline(rod)
+    angle2 <span style="color: #666666">=</span> Arc_wText(<span style="color: #BA2121">r&#39;$\theta$&#39;</span>, rod_start, L<span style="color: #666666">/6</span>, <span style="color: #666666">-90</span>, a,
+                       text_spacing<span style="color: #666666">=1/30.</span>)
+
+    magnitude <span style="color: #666666">=</span> <span style="color: #666666">1.2*</span>L<span style="color: #666666">/2</span>   <span style="color: #408080; font-style: italic"># length of a unit force in figure</span>
+    force <span style="color: #666666">=</span> mg[time_level]  <span style="color: #408080; font-style: italic"># constant (scaled eq: about 1)</span>
+    force <span style="color: #666666">*=</span> magnitude
+    mg_force  <span style="color: #666666">=</span> Force(mass_pt, mass_pt <span style="color: #666666">+</span> force<span style="color: #666666">*</span>point(<span style="color: #666666">0</span>,<span style="color: #666666">-1</span>),
+                      <span style="color: #BA2121">&#39;&#39;</span>, text_pos<span style="color: #666666">=</span><span style="color: #BA2121">&#39;end&#39;</span>)
+    force <span style="color: #666666">=</span> S[time_level]
+    force <span style="color: #666666">*=</span> magnitude
+    rod_force <span style="color: #666666">=</span> Force(mass_pt, mass_pt <span style="color: #666666">-</span> force<span style="color: #666666">*</span>unit_vec(rod_vec),
+                      <span style="color: #BA2121">&#39;&#39;</span>, text_pos<span style="color: #666666">=</span><span style="color: #BA2121">&#39;end&#39;</span>,
+                      text_spacing<span style="color: #666666">=</span>(<span style="color: #666666">0.03</span>, <span style="color: #666666">0.01</span>))
+    force <span style="color: #666666">=</span> drag[time_level]
+    force <span style="color: #666666">*=</span> magnitude
+    <span style="color: #408080; font-style: italic">#print(&#39;drag(%g)=%g&#39; % (t, drag[time_level]))</span>
+    air_force <span style="color: #666666">=</span> Force(mass_pt, mass_pt <span style="color: #666666">-</span>
+                      force<span style="color: #666666">*</span>unit_vec((rod_vec[<span style="color: #666666">1</span>], <span style="color: #666666">-</span>rod_vec[<span style="color: #666666">0</span>])),
+                      <span style="color: #BA2121">&#39;&#39;</span>, text_pos<span style="color: #666666">=</span><span style="color: #BA2121">&#39;end&#39;</span>,
+                      text_spacing<span style="color: #666666">=</span>(<span style="color: #666666">0.04</span>,<span style="color: #666666">0.005</span>))
+
+    body_diagram <span style="color: #666666">=</span> Composition(
+        {<span style="color: #BA2121">&#39;mg&#39;</span>: mg_force, <span style="color: #BA2121">&#39;S&#39;</span>: rod_force, <span style="color: #BA2121">&#39;air&#39;</span>: air_force,
+         <span style="color: #BA2121">&#39;rod&#39;</span>: rod,
+         <span style="color: #BA2121">&#39;vertical&#39;</span>: vertical2, <span style="color: #BA2121">&#39;theta&#39;</span>: angle2,
+         <span style="color: #BA2121">&#39;body&#39;</span>: mass})
+
+    x0y0 <span style="color: #666666">=</span> Text(<span style="color: #BA2121">&#39;$(x_0,y_0)$&#39;</span>, P <span style="color: #666666">+</span> point(<span style="color: #666666">-0.4</span>,<span style="color: #666666">-0.1</span>))
+    ir <span style="color: #666666">=</span> Force(P, P <span style="color: #666666">+</span> L<span style="color: #666666">/10*</span>unit_vec(rod_vec),
+               <span style="color: #BA2121">r&#39;$\boldsymbol{i}_r$&#39;</span>, text_pos<span style="color: #666666">=</span><span style="color: #BA2121">&#39;end&#39;</span>,
+               text_spacing<span style="color: #666666">=</span>(<span style="color: #666666">0.015</span>,<span style="color: #666666">0</span>))
+    ith <span style="color: #666666">=</span> Force(P, P <span style="color: #666666">+</span> L<span style="color: #666666">/10*</span>unit_vec((<span style="color: #666666">-</span>rod_vec[<span style="color: #666666">1</span>], rod_vec[<span style="color: #666666">0</span>])),
+               <span style="color: #BA2121">r&#39;$\boldsymbol{i}_{\theta}$&#39;</span>, text_pos<span style="color: #666666">=</span><span style="color: #BA2121">&#39;end&#39;</span>,
+                text_spacing<span style="color: #666666">=</span>(<span style="color: #666666">0.02</span>,<span style="color: #666666">0.005</span>))
+
+    <span style="color: #408080; font-style: italic">#body_diagram[&#39;ir&#39;] = ir</span>
+    <span style="color: #408080; font-style: italic">#body_diagram[&#39;ith&#39;] = ith</span>
+    <span style="color: #408080; font-style: italic">#body_diagram[&#39;origin&#39;] = x0y0</span>
+
+    drawing_tool<span style="color: #666666">.</span>erase()
+    body_diagram<span style="color: #666666">.</span>draw(verbose<span style="color: #666666">=0</span>)
+    <span style="color: #408080; font-style: italic">#drawing_tool.display(&#39;Body diagram&#39;)</span>
+    drawing_tool<span style="color: #666666">.</span>savefig(<span style="color: #BA2121">&#39;tmp_</span><span style="color: #BB6688; font-weight: bold">%04d</span><span style="color: #BA2121">.png&#39;</span> <span style="color: #666666">%</span> time_level, crop<span style="color: #666666">=</span><span style="color: #008000">False</span>)
+    <span style="color: #408080; font-style: italic"># No cropping: otherwise movies will be very strange</span>
+</pre></div>
+
+<h3 id="___sec13">Equations for the motion and forces </h3>
+
+<p>
+The modeling of the motion of a pendulum is most conveniently done in
+polar coordinates since then the unknown force in the rod is separated
+from the equation determining the motion \( \theta(t) \).
+The position vector for the mass is
+
+$$ \rpos = x_0\ii + y_0\jj + L\ir\tp$$
+
+The corresponding acceleration becomes
+
+$$ \ddot{\rpos} = L\ddot{\theta}{\ith} - L\dot{\theta^2}{\ir}\tp$$
+
+<!-- Note: the extra braces help to render the equation correctly in sphinx! -->
+
+<p>
+There are three forces on the mass: the gravity force
+\( mg\jj = mg(-\cos\theta\,\ir + \sin\theta\,\ith) \), the force in the rod
+\( -S\ir \), and the drag force because of air resistance:
+
+$$ -\half C_D \varrho \pi R^2 |v|v\,\ith,$$
+
+where \( C_D\approx 0.4 \) is the drag coefficient for a sphere, \( \varrho \)
+is the density of air, \( R \) is the radius of the mass, and \( v \) is the
+velocity (\( v=L\dot\theta \)). The drag force acts in \( -\ith \) direction
+when \( v>0 \).
+
+<p>
+Newton's second law of motion for the pendulum now becomes
+
+$$ mL\ddot\theta\ith - mL\dot\theta^2\ir = -mg(-\cos\theta\,\ir +
+\sin\theta\,\ith)
+-S\ir - \half C_D \varrho \pi R^2 L^2|\dot\theta|\dot\theta\ith,$$
+
+which gives two component equations
+
+$$
+\begin{align}
+mL\ddot\theta + \half C_D \varrho \pi R^2 L^2|\dot\theta|\dot\theta +
+mg\sin\theta &= 0,
+\tag{1}\\ 
+S &= mL\dot\theta^2 + mg\cos\theta
+\tag{2}\tp
+\end{align}
+$$
+
+<p>
+It is almost always convenient to scale such equations. Introducing
+the dimensionless time
+
+$$ \bar t = \frac{t}{t_c},\quad t_c = \sqrt{\frac{L}{g}},$$
+
+leads to
+
+$$
+\begin{align}
+\frac{d^2\theta}{d\bar t^2} +
+\alpha\left\vert\frac{d\theta}{d\bar t}\right\vert\frac{d\theta}{d\bar t} +
+\sin\theta &= 0,
+\tag{3}\\ 
+\bar S &= \left(\frac{d\theta}{d\bar t}\right)^2
++ \cos\theta,
+\tag{4}
+\end{align}
+$$
+
+where \( \alpha \) is a dimensionless drag coefficient
+
+$$ \alpha = \frac{C_D\varrho\pi R^2L}{2m},$$
+
+and \( \bar S \) is the scaled force
+
+$$ \bar S = \frac{S}{mg}\tp$$
+
+We see that \( \bar S = 1 \) for the equilibrium position \( \theta=0 \), so this
+scaling of \( S \) seems appropriate.
+
+<p>
+The parameter \( \alpha \) is about
+the ratio of the drag force and the gravity force:
+
+$$ \frac{|\half C_D\varrho \pi R^2 |v|v|}{|mg|}\sim
+\frac{C_D\varrho \pi R^2 L^2 t_c^{-2}}{mg}
+\left|\frac{d\bar\theta}{d\bar t}\right|\frac{d\bar\theta}{d\bar t}
+\sim \frac{C_D\varrho \pi R^2 L}{2m}\theta_0^2 = \alpha \theta_0^2\tp$$
+
+(We have that \( \theta(t)/d\theta_0 \) is in \( [-1,1] \), so we expect
+since \( \theta_0^{-1}d\bar\theta/d\bar t \) to be around unity.)
+
+<p>
+The next step is to write a numerical solver for
+<a href="#mjx-eqn-3">(3)</a>-<a href="#mjx-eqn-4">(4)</a>. To
+this end, we use the <a href="https://github.com/hplgit/odespy" target="_self">Odespy</a>
+package. The system of second-order ODEs must be expressed as a system
+of first-order ODEs. We realize that the unknown \( \bar S \) is decoupled
+from \( \theta \) in the sense that we can first use
+<a href="#mjx-eqn-3">(3)</a> to solve for \( \theta \) and
+then compute \( \bar S \) from <a href="#mjx-eqn-4">(4)</a>.
+The first-order ODEs become
+
+$$
+\begin{align}
+\frac{d\omega}{d\bar t} &= -\alpha\left\vert\omega\right\vert\omega
+- \sin\theta,
+\tag{5}\\ 
+\frac{d\theta}{d\bar t} &= \omega\tp
+\tag{6}
+\end{align}
+$$
+
+Then we compute
+
+$$
+\begin{equation}
+\bar S = \omega^2 + \cos\theta\tp
+\tag{7}
+\end{equation}
+$$
+
+The dimensionless air resistance force can also be computed:
+
+$$
+\begin{equation}
+-\alpha|\omega|\omega\tp
+\tag{8}
+\end{equation}
+$$
+
+Since we scaled the force \( S \) by \( mg \), \( mg \) is the natural force scale,
+and the \( mg \) force itself is then unity.
+
+<p>
+By updating \( \omega \) in the first equation, we can use an Euler-Cromer
+scheme on Odespy (all other schemes are independent of whether the
+\( \theta \) or \( \omega \) equation comes first).
+
+<h3 id="___sec14">Numerical solution </h3>
+
+<p>
+An appropriate solver is
+
+<p>
+
+<!-- code=python (!bc pycod) typeset with pygments style "default" -->
+<div class="highlight" style="background: #f8f8f8"><pre style="line-height: 125%"><span style="color: #008000; font-weight: bold">def</span> <span style="color: #0000FF">simulate_pendulum</span>(alpha, theta0, dt, T):
+    <span style="color: #008000; font-weight: bold">import</span> <span style="color: #0000FF; font-weight: bold">odespy</span>
+
+    <span style="color: #008000; font-weight: bold">def</span> <span style="color: #0000FF">f</span>(u, t, alpha):
+        omega, theta <span style="color: #666666">=</span> u
+        <span style="color: #008000; font-weight: bold">return</span> [<span style="color: #666666">-</span>alpha<span style="color: #666666">*</span>omega<span style="color: #666666">*</span><span style="color: #008000">abs</span>(omega) <span style="color: #666666">-</span> sin(theta),
+                omega]
+
+    <span style="color: #008000; font-weight: bold">import</span> <span style="color: #0000FF; font-weight: bold">numpy</span> <span style="color: #008000; font-weight: bold">as</span> <span style="color: #0000FF; font-weight: bold">np</span>
+    Nt <span style="color: #666666">=</span> <span style="color: #008000">int</span>(<span style="color: #008000">round</span>(T<span style="color: #666666">/</span><span style="color: #008000">float</span>(dt)))
+    t <span style="color: #666666">=</span> np<span style="color: #666666">.</span>linspace(<span style="color: #666666">0</span>, Nt<span style="color: #666666">*</span>dt, Nt<span style="color: #666666">+1</span>)
+    solver <span style="color: #666666">=</span> odespy<span style="color: #666666">.</span>RK4(f, f_args<span style="color: #666666">=</span>[alpha])
+    solver<span style="color: #666666">.</span>set_initial_condition([<span style="color: #666666">0</span>, theta0])
+    u, t <span style="color: #666666">=</span> solver<span style="color: #666666">.</span>solve(t,
+                        terminate<span style="color: #666666">=</span><span style="color: #008000; font-weight: bold">lambda</span> u, t, n: <span style="color: #008000">abs</span>(u[n,<span style="color: #666666">1</span>]) <span style="color: #666666">&lt;</span> <span style="color: #666666">1E-3</span>)
+    omega <span style="color: #666666">=</span> u[:,<span style="color: #666666">0</span>]
+    theta <span style="color: #666666">=</span> u[:,<span style="color: #666666">1</span>]
+    S <span style="color: #666666">=</span> omega<span style="color: #666666">**2</span> <span style="color: #666666">+</span> np<span style="color: #666666">.</span>cos(theta)
+    drag <span style="color: #666666">=</span> <span style="color: #666666">-</span>alpha<span style="color: #666666">*</span>np<span style="color: #666666">.</span>abs(omega)<span style="color: #666666">*</span>omega
+    <span style="color: #008000; font-weight: bold">return</span> t, theta, omega, S, drag
+</pre></div>
+
+<h3 id="___sec15">Animation </h3>
+
+<p>
+We can finally traverse the time array and draw a body diagram
+at each time level. The resulting sketches are saved to files
+<code>tmp_%04d.png</code>, and these files can be combined to videos:
+
+<p>
+
+<!-- code=python (!bc pycod) typeset with pygments style "default" -->
+<div class="highlight" style="background: #f8f8f8"><pre style="line-height: 125%"><span style="color: #008000; font-weight: bold">def</span> <span style="color: #0000FF">animate</span>():
+    <span style="color: #408080; font-style: italic"># Clean up old plot files</span>
+    <span style="color: #008000; font-weight: bold">import</span> <span style="color: #0000FF; font-weight: bold">os</span><span style="color: #666666">,</span> <span style="color: #0000FF; font-weight: bold">glob</span>
+    <span style="color: #008000; font-weight: bold">for</span> filename <span style="color: #AA22FF; font-weight: bold">in</span> glob<span style="color: #666666">.</span>glob(<span style="color: #BA2121">&#39;tmp_*.png&#39;</span>) <span style="color: #666666">+</span> glob<span style="color: #666666">.</span>glob(<span style="color: #BA2121">&#39;movie.*&#39;</span>):
+        os<span style="color: #666666">.</span>remove(filename)
+    <span style="color: #408080; font-style: italic"># Solve problem</span>
+    <span style="color: #008000; font-weight: bold">from</span> <span style="color: #0000FF; font-weight: bold">math</span> <span style="color: #008000; font-weight: bold">import</span> pi, radians, degrees
+    <span style="color: #008000; font-weight: bold">import</span> <span style="color: #0000FF; font-weight: bold">numpy</span> <span style="color: #008000; font-weight: bold">as</span> <span style="color: #0000FF; font-weight: bold">np</span>
+    alpha <span style="color: #666666">=</span> <span style="color: #666666">0.4</span>
+    period <span style="color: #666666">=</span> <span style="color: #666666">2*</span>pi
+    T <span style="color: #666666">=</span> <span style="color: #666666">12*</span>period
+    dt <span style="color: #666666">=</span> period<span style="color: #666666">/40</span>
+    a <span style="color: #666666">=</span> <span style="color: #666666">70</span>
+    theta0 <span style="color: #666666">=</span> radians(a)
+    t, theta, omega, S, drag <span style="color: #666666">=</span> simulate_pendulum(alpha, theta0, dt, T)
+    mg <span style="color: #666666">=</span> np<span style="color: #666666">.</span>ones(S<span style="color: #666666">.</span>size)
+    <span style="color: #408080; font-style: italic"># Visualize drag force 5 times as large</span>
+    drag <span style="color: #666666">*=</span> <span style="color: #666666">5</span>
+    <span style="color: #008000; font-weight: bold">print</span>(<span style="color: #BA2121">&#39;NOTE: drag force magnified 5 times!!&#39;</span>)
+
+    <span style="color: #408080; font-style: italic"># Draw animation</span>
+    <span style="color: #008000; font-weight: bold">import</span> <span style="color: #0000FF; font-weight: bold">time</span>
+    <span style="color: #008000; font-weight: bold">for</span> time_level, t_ <span style="color: #AA22FF; font-weight: bold">in</span> <span style="color: #008000">enumerate</span>(t):
+        pendulum(theta, S, mg, drag, t_, time_level)
+        time<span style="color: #666666">.</span>sleep(<span style="color: #666666">0.2</span>)
+
+    <span style="color: #408080; font-style: italic"># Make videos</span>
+    prog <span style="color: #666666">=</span> <span style="color: #BA2121">&#39;ffmpeg&#39;</span>
+    filename <span style="color: #666666">=</span> <span style="color: #BA2121">&#39;tmp_</span><span style="color: #BB6688; font-weight: bold">%04d</span><span style="color: #BA2121">.png&#39;</span>
+    fps <span style="color: #666666">=</span> <span style="color: #666666">6</span>
+    codecs <span style="color: #666666">=</span> {<span style="color: #BA2121">&#39;flv&#39;</span>: <span style="color: #BA2121">&#39;flv&#39;</span>, <span style="color: #BA2121">&#39;mp4&#39;</span>: <span style="color: #BA2121">&#39;libx264&#39;</span>,
+              <span style="color: #BA2121">&#39;webm&#39;</span>: <span style="color: #BA2121">&#39;libvpx&#39;</span>, <span style="color: #BA2121">&#39;ogg&#39;</span>: <span style="color: #BA2121">&#39;libtheora&#39;</span>}
+    <span style="color: #008000; font-weight: bold">for</span> ext <span style="color: #AA22FF; font-weight: bold">in</span> codecs:
+        lib <span style="color: #666666">=</span> codecs[ext]
+        cmd <span style="color: #666666">=</span> <span style="color: #BA2121">&#39;</span><span style="color: #BB6688; font-weight: bold">%(prog)s</span><span style="color: #BA2121"> -i </span><span style="color: #BB6688; font-weight: bold">%(filename)s</span><span style="color: #BA2121"> -r </span><span style="color: #BB6688; font-weight: bold">%(fps)s</span><span style="color: #BA2121"> &#39;</span> <span style="color: #666666">%</span> <span style="color: #008000">vars</span>()
+        cmd <span style="color: #666666">+=</span> <span style="color: #BA2121">&#39;-vcodec </span><span style="color: #BB6688; font-weight: bold">%(lib)s</span><span style="color: #BA2121"> movie.</span><span style="color: #BB6688; font-weight: bold">%(ext)s</span><span style="color: #BA2121">&#39;</span> <span style="color: #666666">%</span> <span style="color: #008000">vars</span>()
+        <span style="color: #008000; font-weight: bold">print</span>(cmd)
+        os<span style="color: #666666">.</span>system(cmd)
+</pre></div>
+<p>
+
+<div>
+<video  loop controls width='640' height='365' preload='none'>
+    <source src='https://github.com/hplgit/pysketcher/raw/master/doc/pub/tutorial/mov-tut/pendulum/movie.mp4'  type='video/mp4;  codecs="avc1.42E01E, mp4a.40.2"'>
+    <source src='https://github.com/hplgit/pysketcher/raw/master/doc/pub/tutorial/mov-tut/pendulum/movie.webm' type='video/webm; codecs="vp8, vorbis"'>
+    <source src='https://github.com/hplgit/pysketcher/raw/master/doc/pub/tutorial/mov-tut/pendulum/movie.ogg'  type='video/ogg;  codecs="theora, vorbis"'>
+</video>
+</div>
+<p><em>The drag force is magnified 5 times (compared to \( mg \) and \( S \)!</em></p>
+
+<!-- Issue warning if in a Safari browser -->
+<script language="javascript">
+if (!!(window.safari)) {
+  document.write("<div style=\"width: 95%%; padding: 10px; border: 1px solid #100; border-radius: 4px;\"><p><font color=\"red\">The above movie will not play in Safari - use Chrome, Firefox, or Opera.</font></p></div>")}
+</script>
 
 
 <p>
 <p>
 <p>
 <p>

+ 408 - 16
doc/pub/tutorial/html/_sources/main_sketcher.txt

@@ -675,7 +675,11 @@ The basic physics sketch
 ------------------------
 ------------------------
 
 
 We now want to make a sketch of simple pendulum from physics, as shown
 We now want to make a sketch of simple pendulum from physics, as shown
-in Figure :ref:`sketcher:ex:pendulum:fig1`. A suggested work flow is to
+in Figure :ref:`sketcher:ex:pendulum:fig1`. A body with mass :math:`m` is attached
+to a massless, stiff rod, which can rotate about a point, causing the
+pendulum to oscillate.
+
+A suggested work flow is to
 first sketch the figure on a piece of paper and introduce a coordinate
 first sketch the figure on a piece of paper and introduce a coordinate
 system. A simple coordinate system is indicated in Figure
 system. A simple coordinate system is indicated in Figure
 :ref:`sketcher:ex:pendulum:fig1wgrid`. In a code we introduce variables
 :ref:`sketcher:ex:pendulum:fig1wgrid`. In a code we introduce variables
@@ -704,7 +708,7 @@ Also note that we in this example let all lines be blue by default.
 .. _sketcher:ex:pendulum:fig1:
 .. _sketcher:ex:pendulum:fig1:
 
 
 .. figure:: pendulum1.png
 .. figure:: pendulum1.png
-   :width: 400
+   :width: 300
 
 
    *Sketch of a simple pendulum*
    *Sketch of a simple pendulum*
 
 
@@ -713,7 +717,7 @@ Also note that we in this example let all lines be blue by default.
 .. figure:: pendulum1_wgrid.png
 .. figure:: pendulum1_wgrid.png
    :width: 400
    :width: 400
 
 
-   *Sketch of a simple pendulum*
+   *Sketch with assisting coordinate system*
 
 
 The next step is to introduce variables for key quantities in the sketch.
 The next step is to introduce variables for key quantities in the sketch.
 Let ``L`` be the length of the pendulum, ``P`` the rotation point, and let
 Let ``L`` be the length of the pendulum, ``P`` the rotation point, and let
@@ -753,12 +757,16 @@ Figure :ref:`sketcher:ex:pendulum:fig1` we see that we need
 
 
 Pysketcher has objects for each of these elements in our sketch.
 Pysketcher has objects for each of these elements in our sketch.
 We start with the simplest element: the vertical line, going from
 We start with the simplest element: the vertical line, going from
-``P`` to ``P`` minus the length in :math:`y` direction:
+``P`` to ``P`` minus the length :math:`L` in :math:`y` direction:
 
 
 .. code-block:: python
 .. code-block:: python
 
 
         vertical = Line(P, P-point(0,L))
         vertical = Line(P, P-point(0,L))
 
 
+The class ``point`` is very convenient: it turns its two coordinates into
+a vector with which we can compute, and is therefore one of the most
+widely used Pysketcher objects.
+
 The path of the mass is an arc that can be made by
 The path of the mass is an arc that can be made by
 Pysketcher's ``Arc`` object:
 Pysketcher's ``Arc`` object:
 
 
@@ -767,7 +775,7 @@ Pysketcher's ``Arc`` object:
         path = Arc(P, L, -90, a)
         path = Arc(P, L, -90, a)
 
 
 The first argument ``P`` is the center point, the second is the
 The first argument ``P`` is the center point, the second is the
-radius (``L`` here), the next arguments is the start angle, here
+radius (``L`` here), the next argument is the start angle, here
 it starts at -90 degrees, while the next argument is the angle of
 it starts at -90 degrees, while the next argument is the angle of
 the arc, here ``a``.
 the arc, here ``a``.
 For the path of the mass, we also need an arc object, but this
 For the path of the mass, we also need an arc object, but this
@@ -789,10 +797,11 @@ adjust spacings as one goes along.
 The rod is simply a line from ``P`` to the mass. We can easily
 The rod is simply a line from ``P`` to the mass. We can easily
 compute the position of the mass from basic geometry considerations,
 compute the position of the mass from basic geometry considerations,
 but it is easier and safer to look up this point in other objects
 but it is easier and safer to look up this point in other objects
-if it is already computed. The ``path`` object stores its start and
+if it is already computed. In the present case,
+the ``path`` object stored its start and
 end points, so ``path.geometric_features()['end']`` is the end point
 end points, so ``path.geometric_features()['end']`` is the end point
 of the path, which is the position of the mass. We can therefore
 of the path, which is the position of the mass. We can therefore
-create the rod simply as a line from ``P`` to this end point:
+create the rod simply as a line from ``P`` to this already computed end point:
 
 
 .. code-block:: python
 .. code-block:: python
 
 
@@ -835,6 +844,8 @@ normal direction of the rod:
 For this translation we need a unit vector in the normal direction
 For this translation we need a unit vector in the normal direction
 of the rod, which is from geometric considerations given by
 of the rod, which is from geometric considerations given by
 :math:`(\cos a, \sin a)`, when :math:`a` is the angle of the pendulum.
 :math:`(\cos a, \sin a)`, when :math:`a` is the angle of the pendulum.
+Alternatively, we could have found the normal vector as a vector that
+is normal to ``unit_rod_vec``: ``point(-unit_rod_vec[1],unit_rod_vec[0])``.
 
 
 The final object is the gravity force vector, which is so common
 The final object is the gravity force vector, which is so common
 in physics sketches that Pysketcher has a ready-made object: ``Gravity``,
 in physics sketches that Pysketcher has a ready-made object: ``Gravity``,
@@ -844,14 +855,14 @@ in physics sketches that Pysketcher has a ready-made object: ``Gravity``,
         gravity = Gravity(start=P+point(0.8*L,0), length=L/3)
         gravity = Gravity(start=P+point(0.8*L,0), length=L/3)
 
 
 Since blue is the default color for
 Since blue is the default color for
-lines, we want the dashed lines (``vertical`` and ``path``) to be black
-and dashed with linewidth 1. These properties can be set one by one,
-but we can also make a little helper function:
+lines, we want the dashed lines (for ``vertical`` and ``path``) to be black
+and with linewidth 1. These properties can be set one by one for each
+object, but we can also make a little helper function:
 
 
 .. code-block:: python
 .. code-block:: python
 
 
         def set_dashed_thin_blackline(*objects):
         def set_dashed_thin_blackline(*objects):
-            """Set linestyle of an object to dashed, black, width=1."""
+            """Set linestyle of objects to dashed, black, width=1."""
             for obj in objects:
             for obj in objects:
                 obj.set_linestyle('dashed')
                 obj.set_linestyle('dashed')
                 obj.set_linecolor('black')
                 obj.set_linecolor('black')
@@ -888,7 +899,7 @@ coordinates.
 .. _sketcher:ex:pendulum:fig2wgrid:
 .. _sketcher:ex:pendulum:fig2wgrid:
 
 
 .. figure:: pendulum5_wgrid.png
 .. figure:: pendulum5_wgrid.png
-   :width: 400
+   :width: 300
 
 
    *Body diagram of a simple pendulum*
    *Body diagram of a simple pendulum*
 
 
@@ -913,9 +924,9 @@ We start by listing the objects in the sketch:
 9. the air resistance force with text :math:`\sim |v|v`
 9. the air resistance force with text :math:`\sim |v|v`
 
 
 The first object, :math:`(x_0,y_0)`, is simply a plain text where we have
 The first object, :math:`(x_0,y_0)`, is simply a plain text where we have
-to experiment with the position. The unit vectors in polar coordinates
+to experiment with its position. The unit vectors in polar coordinates
 may be drawn using the Pysketcher's ``Force`` object since it has an
 may be drawn using the Pysketcher's ``Force`` object since it has an
-arrow with a text. The first three object can then be made as follows:
+arrow with a text. The first three objects can then be made as follows:
 
 
 .. code-block:: python
 .. code-block:: python
 
 
@@ -934,7 +945,7 @@ the tweaked displacement ``point(-0.4,-0.1)`` in terms of ``W`` and ``H``.
 The ``text_spacing`` values in the ``Force`` objects also use absolute
 The ``text_spacing`` values in the ``Force`` objects also use absolute
 coordinates. Very often, this is much more convenient when adjusting
 coordinates. Very often, this is much more convenient when adjusting
 the objects, and global size parameters like ``W`` and ``H`` are in practice
 the objects, and global size parameters like ``W`` and ``H`` are in practice
-seldom changed.
+seldom changed, so the solution above is quite typical.
 
 
 The vertical, dashed line, the dashed rod, and the arc for :math:`\theta`
 The vertical, dashed line, the dashed rod, and the arc for :math:`\theta`
 are made by
 are made by
@@ -964,6 +975,10 @@ The forces are constructed as shown below.
                           '$\sim|v|v$', text_pos='end',
                           '$\sim|v|v$', text_pos='end',
                           text_spacing=(0.04,0.005))
                           text_spacing=(0.04,0.005))
 
 
+Note that the drag force from the air is directed perpendicular to
+the rod, so we construct a unit vector in this direction directly from
+the ``rod_vec`` vector.
+
 All objects are in place, and we can compose a figure to be drawn:
 All objects are in place, and we can compose a figure to be drawn:
 
 
 .. code-block:: python
 .. code-block:: python
@@ -982,7 +997,384 @@ Here, we exemplify that we can start out with a composition as a
 dictionary, but (as in ordinary Python dictionaries) add new
 dictionary, but (as in ordinary Python dictionaries) add new
 elements later when desired.
 elements later when desired.
 
 
-.. FIGURE: [fig-tut/pendulum1.png, width=400 frac=0.5] Sketch of a simple pendulum.
+.. FIGURE: [fig-tut/pendulum1.png, width=300 frac=0.5] Sketch of a simple pendulum.
+
+.. _sketcher:ex:pendulum:anim:
+
+Animated body diagram
+---------------------
+
+We want to make an animated body diagram so that we can see how forces
+develop in time according to the motion. This means that we must
+couple the sketch at each time level to a numerical solution for
+the motion of the pendulum.
+
+Function for drawing the body diagram
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+The previous flat program for making sketches of the pendulum is not
+suitable when we want to make a sketch at a lot of different points
+in time, i.e., for a lot of different angles that the pendulum makes
+with the vertical. We therefore need to draw the body diagram in
+a function where the angle is a parameter. We also supply arrays
+containing the (numerically computed) values of the angle :math:`\theta` and
+the forces at various time levels, plus the desired time point and level
+for this particular sketch:
+
+.. code-block:: python
+
+        from pysketcher import *
+        
+        H = 15.
+        W = 17.
+        
+        drawing_tool.set_coordinate_system(xmin=0, xmax=W,
+                                           ymin=0, ymax=H,
+                                           axis=False)
+        
+        def pendulum(theta, S, mg, drag, t, time_level):
+        
+            drawing_tool.set_linecolor('blue')
+            import math
+            a = math.degrees(theta[time_level])
+            L = 0.4*H         # length
+            P = (W/2, 0.8*H)  # rotation point
+        
+            vertical = Line(P, P-point(0,L))
+            path = Arc(P, L, -90, a)
+            angle = Arc_wText(r'$\theta$', P, L/4, -90, a, text_spacing=1/30.)
+        
+            mass_pt = path.geometric_features()['end']
+            rod = Line(P, mass_pt)
+        
+            mass = Circle(center=mass_pt, radius=L/20.)
+            mass.set_filled_curves(color='blue')
+            rod_vec = rod.geometric_features()['end'] - \ 
+                      rod.geometric_features()['start']
+            unit_rod_vec = unit_vec(rod_vec)
+            mass_symbol = Text('$m$', mass_pt + L/10*unit_rod_vec)
+        
+            length = Distance_wText(P, mass_pt, '$L$')
+            # Displace length indication
+            length.translate(L/15*point(cos(radians(a)), sin(radians(a))))
+            gravity = Gravity(start=P+point(0.8*L,0), length=L/3)
+        
+            def set_dashed_thin_blackline(*objects):
+                """Set linestyle of objects to dashed, black, width=1."""
+                for obj in objects:
+                    obj.set_linestyle('dashed')
+                    obj.set_linecolor('black')
+                    obj.set_linewidth(1)
+        
+            set_dashed_thin_blackline(vertical, path)
+        
+            fig = Composition(
+                {'body': mass, 'rod': rod,
+                 'vertical': vertical, 'theta': angle, 'path': path,
+                 'g': gravity, 'L': length})
+        
+            #fig.draw()
+            #drawing_tool.display()
+            #drawing_tool.savefig('tmp_pendulum1')
+        
+            drawing_tool.set_linecolor('black')
+        
+            rod_start = rod.geometric_features()['start']  # Point P
+            vertical2 = Line(rod_start, rod_start + point(0,-L/3))
+            set_dashed_thin_blackline(vertical2)
+            set_dashed_thin_blackline(rod)
+            angle2 = Arc_wText(r'$\theta$', rod_start, L/6, -90, a,
+                               text_spacing=1/30.)
+        
+            magnitude = 1.2*L/2   # length of a unit force in figure
+            force = mg[time_level]  # constant (scaled eq: about 1)
+            force *= magnitude
+            mg_force  = Force(mass_pt, mass_pt + force*point(0,-1),
+                              '', text_pos='end')
+            force = S[time_level]
+            force *= magnitude
+            rod_force = Force(mass_pt, mass_pt - force*unit_vec(rod_vec),
+                              '', text_pos='end',
+                              text_spacing=(0.03, 0.01))
+            force = drag[time_level]
+            force *= magnitude
+            #print('drag(%g)=%g' % (t, drag[time_level]))
+            air_force = Force(mass_pt, mass_pt -
+                              force*unit_vec((rod_vec[1], -rod_vec[0])),
+                              '', text_pos='end',
+                              text_spacing=(0.04,0.005))
+        
+            body_diagram = Composition(
+                {'mg': mg_force, 'S': rod_force, 'air': air_force,
+                 'rod': rod,
+                 'vertical': vertical2, 'theta': angle2,
+                 'body': mass})
+        
+            x0y0 = Text('$(x_0,y_0)$', P + point(-0.4,-0.1))
+            ir = Force(P, P + L/10*unit_vec(rod_vec),
+                       r'$\boldsymbol{i}_r$', text_pos='end',
+                       text_spacing=(0.015,0))
+            ith = Force(P, P + L/10*unit_vec((-rod_vec[1], rod_vec[0])),
+                       r'$\boldsymbol{i}_{\theta}$', text_pos='end',
+                        text_spacing=(0.02,0.005))
+        
+            #body_diagram['ir'] = ir
+            #body_diagram['ith'] = ith
+            #body_diagram['origin'] = x0y0
+        
+            drawing_tool.erase()
+            body_diagram.draw(verbose=0)
+            #drawing_tool.display('Body diagram')
+            drawing_tool.savefig('tmp_%04d.png' % time_level, crop=False)
+            # No cropping: otherwise movies will be very strange
+
+Equations for the motion and forces
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+The modeling of the motion of a pendulum is most conveniently done in
+polar coordinates since then the unknown force in the rod is separated
+from the equation determining the motion :math:`\theta(t)`.
+The position vector for the mass is
+
+.. math::
+         \boldsymbol{r} = x_0\boldsymbol{i} + y_0\boldsymbol{j} + L{\boldsymbol{i}_r}{\thinspace .}
+
+The corresponding acceleration becomes
+
+.. math::
+         \ddot{\boldsymbol{r}} = L\ddot{\theta}{\boldsymbol{i}_{\theta}} - L\dot{\theta^2}{{\boldsymbol{i}_r}}{\thinspace .}
+
+.. Note: the extra braces help to render the equation correctly in sphinx!
+
+There are three forces on the mass: the gravity force
+:math:`mg\boldsymbol{j} = mg(-\cos\theta\,{\boldsymbol{i}_r} + \sin\theta\,\boldsymbol{i}_{\theta})`, the force in the rod
+:math:`-S{\boldsymbol{i}_r}`, and the drag force because of air resistance:
+
+.. math::
+         -\frac{1}{2} C_D \varrho \pi R^2 |v|v\,\boldsymbol{i}_{\theta},
+
+where :math:`C_D\approx 0.4` is the drag coefficient for a sphere, :math:`\varrho`
+is the density of air, :math:`R` is the radius of the mass, and :math:`v` is the
+velocity (:math:`v=L\dot\theta`). The drag force acts in :math:`-\boldsymbol{i}_{\theta}` direction
+when :math:`v>0`.
+
+Newton's second law of motion for the pendulum now becomes
+
+.. math::
+         mL\ddot\theta\boldsymbol{i}_{\theta} - mL\dot\theta^2{\boldsymbol{i}_r} = -mg(-\cos\theta\,{\boldsymbol{i}_r} +
+        \sin\theta\,\boldsymbol{i}_{\theta})
+        -S{\boldsymbol{i}_r} - \frac{1}{2} C_D \varrho \pi R^2 L^2|\dot\theta|\dot\theta\boldsymbol{i}_{\theta},
+
+which gives two component equations
+
+.. math::
+   :label: sketcher:ex:pendulum:anim:eq:ith
+        
+        mL\ddot\theta + \frac{1}{2} C_D \varrho \pi R^2 L^2|\dot\theta|\dot\theta +
+        mg\sin\theta = 0,
+        
+        
+
+.. math::
+   :label: sketcher:ex:pendulum:anim:eq:ir
+          
+        S = mL\dot\theta^2 + mg\cos\theta
+        {\thinspace .}
+        
+
+It is almost always convenient to scale such equations. Introducing
+the dimensionless time
+
+.. math::
+         \bar t = \frac{t}{t_c},\quad t_c = \sqrt{\frac{L}{g}},
+
+leads to
+
+.. math::
+   :label: sketcher:ex:pendulum:anim:eq:ith:s
+        
+        \frac{d^2\theta}{d\bar t^2} +
+        \alpha\left\vert\frac{d\theta}{d\bar t}\right\vert\frac{d\theta}{d\bar t} +
+        \sin\theta = 0,
+        
+        
+
+.. math::
+   :label: sketcher:ex:pendulum:anim:eq:ir:s
+          
+        \bar S = \left(\frac{d\theta}{d\bar t}\right)^2
+        + \cos\theta,
+        
+        
+
+where :math:`\alpha` is a dimensionless drag coefficient
+
+.. math::
+         \alpha = \frac{C_D\varrho\pi R^2L}{2m},
+
+and :math:`\bar S` is the scaled force
+
+.. math::
+         \bar S = \frac{S}{mg}{\thinspace .}
+
+We see that :math:`\bar S = 1` for the equilibrium position :math:`\theta=0`, so this
+scaling of :math:`S` seems appropriate.
+
+The parameter :math:`\alpha` is about
+the ratio of the drag force and the gravity force:
+
+.. math::
+         \frac{|\frac{1}{2} C_D\varrho \pi R^2 |v|v|}{|mg|}\sim
+        \frac{C_D\varrho \pi R^2 L^2 t_c^{-2}}{mg}
+        \left|\frac{d\bar\theta}{d\bar t}\right|\frac{d\bar\theta}{d\bar t}
+        \sim \frac{C_D\varrho \pi R^2 L}{2m}\theta_0^2 = \alpha \theta_0^2{\thinspace .}
+
+(We have that :math:`\theta(t)/d\theta_0` is in :math:`[-1,1]`, so we expect
+since :math:`\theta_0^{-1}d\bar\theta/d\bar t` to be around unity.)
+
+The next step is to write a numerical solver for
+:eq:`sketcher:ex:pendulum:anim:eq:ith:s`-:eq:`sketcher:ex:pendulum:anim:eq:ir:s`. To
+this end, we use the `Odespy <https://github.com/hplgit/odespy>`__
+package. The system of second-order ODEs must be expressed as a system
+of first-order ODEs. We realize that the unknown :math:`\bar S` is decoupled
+from :math:`\theta` in the sense that we can first use
+:eq:`sketcher:ex:pendulum:anim:eq:ith:s` to solve for :math:`\theta` and
+then compute :math:`\bar S` from :eq:`sketcher:ex:pendulum:anim:eq:ir:s`.
+The first-order ODEs become
+
+.. math::
+   :label: _auto1
+        
+        \frac{d\omega}{d\bar t} = -\alpha\left\vert\omega\right\vert\omega
+        - \sin\theta,
+        
+        
+
+.. math::
+   :label: _auto2
+          
+        \frac{d\theta}{d\bar t} = \omega{\thinspace .}
+        
+        
+
+Then we compute
+
+.. math::
+   :label: _auto3
+        
+        \bar S = \omega^2 + \cos\theta{\thinspace .}
+        
+        
+
+The dimensionless air resistance force can also be computed:
+
+.. math::
+   :label: _auto4
+        
+        -\alpha|\omega|\omega{\thinspace .}
+        
+        
+
+Since we scaled the force :math:`S` by :math:`mg`, :math:`mg` is the natural force scale,
+and the :math:`mg` force itself is then unity.
+
+By updating :math:`\omega` in the first equation, we can use an Euler-Cromer
+scheme on Odespy (all other schemes are independent of whether the
+:math:`\theta` or :math:`\omega` equation comes first).
+
+Numerical solution
+~~~~~~~~~~~~~~~~~~
+
+An appropriate solver is
+
+.. code-block:: python
+
+        def simulate_pendulum(alpha, theta0, dt, T):
+            import odespy
+        
+            def f(u, t, alpha):
+                omega, theta = u
+                return [-alpha*omega*abs(omega) - sin(theta),
+                        omega]
+        
+            import numpy as np
+            Nt = int(round(T/float(dt)))
+            t = np.linspace(0, Nt*dt, Nt+1)
+            solver = odespy.RK4(f, f_args=[alpha])
+            solver.set_initial_condition([0, theta0])
+            u, t = solver.solve(t,
+                                terminate=lambda u, t, n: abs(u[n,1]) < 1E-3)
+            omega = u[:,0]
+            theta = u[:,1]
+            S = omega**2 + np.cos(theta)
+            drag = -alpha*np.abs(omega)*omega
+            return t, theta, omega, S, drag
+
+Animation
+~~~~~~~~~
+
+We can finally traverse the time array and draw a body diagram
+at each time level. The resulting sketches are saved to files
+``tmp_%04d.png``, and these files can be combined to videos:
+
+.. code-block:: python
+
+        def animate():
+            # Clean up old plot files
+            import os, glob
+            for filename in glob.glob('tmp_*.png') + glob.glob('movie.*'):
+                os.remove(filename)
+            # Solve problem
+            from math import pi, radians, degrees
+            import numpy as np
+            alpha = 0.4
+            period = 2*pi
+            T = 12*period
+            dt = period/40
+            a = 70
+            theta0 = radians(a)
+            t, theta, omega, S, drag = simulate_pendulum(alpha, theta0, dt, T)
+            mg = np.ones(S.size)
+            # Visualize drag force 5 times as large
+            drag *= 5
+            print('NOTE: drag force magnified 5 times!!')
+        
+            # Draw animation
+            import time
+            for time_level, t_ in enumerate(t):
+                pendulum(theta, S, mg, drag, t_, time_level)
+                time.sleep(0.2)
+        
+            # Make videos
+            prog = 'ffmpeg'
+            filename = 'tmp_%04d.png'
+            fps = 6
+            codecs = {'flv': 'flv', 'mp4': 'libx264',
+                      'webm': 'libvpx', 'ogg': 'libtheora'}
+            for ext in codecs:
+                lib = codecs[ext]
+                cmd = '%(prog)s -i %(filename)s -r %(fps)s ' % vars()
+                cmd += '-vcodec %(lib)s movie.%(ext)s' % vars()
+                print(cmd)
+                os.system(cmd)
+
+.. raw:: html
+        
+        <div>
+        <video  loop controls width='640' height='365' preload='none'>
+            <source src='https://github.com/hplgit/pysketcher/raw/master/doc/pub/tutorial/mov-tut/pendulum/movie.mp4'  type='video/mp4;  codecs="avc1.42E01E, mp4a.40.2"'>
+            <source src='https://github.com/hplgit/pysketcher/raw/master/doc/pub/tutorial/mov-tut/pendulum/movie.webm' type='video/webm; codecs="vp8, vorbis"'>
+            <source src='https://github.com/hplgit/pysketcher/raw/master/doc/pub/tutorial/mov-tut/pendulum/movie.ogg'  type='video/ogg;  codecs="theora, vorbis"'>
+        </video>
+        </div>
+        <p><em>The drag force is magnified 5 times (compared to :math:`mg` and :math:`S`!</em></p>
+        
+        <!-- Issue warning if in a Safari browser -->
+        <script language="javascript">
+        if (!!(window.safari)) {
+          document.write("<div style=\"width: 95%%; padding: 10px; border: 1px solid #100; border-radius: 4px;\"><p><font color=\"red\">The above movie will not play in Safari - use Chrome, Firefox, or Opera.</font></p></div>")}
+        </script>
+        
 
 
 .. !split
 .. !split
 
 

+ 1 - 0
doc/pub/tutorial/html/index.html

@@ -87,6 +87,7 @@
 <li class="toctree-l2"><a class="reference internal" href="main_sketcher.html#a-simple-pendulum">A simple pendulum</a><ul>
 <li class="toctree-l2"><a class="reference internal" href="main_sketcher.html#a-simple-pendulum">A simple pendulum</a><ul>
 <li class="toctree-l3"><a class="reference internal" href="main_sketcher.html#the-basic-physics-sketch">The basic physics sketch</a></li>
 <li class="toctree-l3"><a class="reference internal" href="main_sketcher.html#the-basic-physics-sketch">The basic physics sketch</a></li>
 <li class="toctree-l3"><a class="reference internal" href="main_sketcher.html#the-body-diagram">The body diagram</a></li>
 <li class="toctree-l3"><a class="reference internal" href="main_sketcher.html#the-body-diagram">The body diagram</a></li>
+<li class="toctree-l3"><a class="reference internal" href="main_sketcher.html#animated-body-diagram">Animated body diagram</a></li>
 </ul>
 </ul>
 </li>
 </li>
 <li class="toctree-l2"><a class="reference internal" href="main_sketcher.html#basic-shapes">Basic shapes</a><ul>
 <li class="toctree-l2"><a class="reference internal" href="main_sketcher.html#basic-shapes">Basic shapes</a><ul>

File diff suppressed because it is too large
+ 332 - 17
doc/pub/tutorial/html/main_sketcher.html


BIN
doc/pub/tutorial/html/objects.inv


File diff suppressed because it is too large
+ 1 - 1
doc/pub/tutorial/html/searchindex.js


+ 67 - 42
doc/pub/tutorial/pysketcher.html

@@ -55,34 +55,42 @@ Automatically generated HTML file from DocOnce source
                'sketcher:ex:pendulum:basic',
                'sketcher:ex:pendulum:basic',
                'sketcher:ex:pendulum:basic'),
                'sketcher:ex:pendulum:basic'),
               ('The body diagram', 2, None, '___sec10'),
               ('The body diagram', 2, None, '___sec10'),
-              ('Basic shapes', 1, None, '___sec11'),
-              ('Axis', 2, None, '___sec12'),
-              ('Distance with text', 2, None, '___sec13'),
-              ('Rectangle', 2, None, '___sec14'),
-              ('Triangle', 2, None, '___sec15'),
-              ('Arc', 2, None, '___sec16'),
-              ('Spring', 2, None, '___sec17'),
-              ('Dashpot', 2, None, '___sec18'),
-              ('Wavy', 2, None, '___sec19'),
-              ('Stochastic curves', 2, None, '___sec20'),
-              ('Inner workings of the Pysketcher tool', 1, None, '___sec21'),
+              ('Animated body diagram',
+               2,
+               'sketcher:ex:pendulum:anim',
+               'sketcher:ex:pendulum:anim'),
+              ('Function for drawing the body diagram', 3, None, '___sec12'),
+              ('Equations for the motion and forces', 3, None, '___sec13'),
+              ('Numerical solution', 3, None, '___sec14'),
+              ('Animation', 3, None, '___sec15'),
+              ('Basic shapes', 1, None, '___sec16'),
+              ('Axis', 2, None, '___sec17'),
+              ('Distance with text', 2, None, '___sec18'),
+              ('Rectangle', 2, None, '___sec19'),
+              ('Triangle', 2, None, '___sec20'),
+              ('Arc', 2, None, '___sec21'),
+              ('Spring', 2, None, '___sec22'),
+              ('Dashpot', 2, None, '___sec23'),
+              ('Wavy', 2, None, '___sec24'),
+              ('Stochastic curves', 2, None, '___sec25'),
+              ('Inner workings of the Pysketcher tool', 1, None, '___sec26'),
               ('Example of classes for geometric objects',
               ('Example of classes for geometric objects',
                2,
                2,
                None,
                None,
-               '___sec22'),
-              ('Simple geometric objects', 3, None, '___sec23'),
-              ('Class curve', 3, None, '___sec24'),
-              ('Compound geometric objects', 3, None, '___sec25'),
-              ('Adding functionality via recursion', 2, None, '___sec26'),
-              ('Basic principles of recursion', 3, None, '___sec27'),
-              ('Explaining recursion', 3, None, '___sec28'),
+               '___sec27'),
+              ('Simple geometric objects', 3, None, '___sec28'),
+              ('Class curve', 3, None, '___sec29'),
+              ('Compound geometric objects', 3, None, '___sec30'),
+              ('Adding functionality via recursion', 2, None, '___sec31'),
+              ('Basic principles of recursion', 3, None, '___sec32'),
+              ('Explaining recursion', 3, None, '___sec33'),
               ('Scaling, translating, and rotating a figure',
               ('Scaling, translating, and rotating a figure',
                2,
                2,
                'sketcher:scaling',
                'sketcher:scaling',
                'sketcher:scaling'),
                'sketcher:scaling'),
-              ('Scaling', 3, None, '___sec30'),
-              ('Translation', 3, None, '___sec31'),
-              ('Rotation', 3, None, '___sec32')]}
+              ('Scaling', 3, None, '___sec35'),
+              ('Translation', 3, None, '___sec36'),
+              ('Rotation', 3, None, '___sec37')]}
 end of tocinfo -->
 end of tocinfo -->
 
 
 <body>
 <body>
@@ -101,6 +109,18 @@ MathJax.Hub.Config({
  src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML">
  src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML">
 </script>
 </script>
 
 
+<!-- newcommands.tex -->
+$$
+\newcommand{\half}{\frac{1}{2}}
+\newcommand{\tp}{\thinspace .}
+\newcommand{\rpos}{\boldsymbol{r}}
+\newcommand{\ii}{\boldsymbol{i}}
+\newcommand{\jj}{\boldsymbol{j}}
+\newcommand{\ir}{\boldsymbol{i}_r}
+\newcommand{\ith}{\boldsymbol{i}_{\theta}}
+$$
+
+
 
 
 
 
     
     
@@ -131,28 +151,33 @@ MathJax.Hub.Config({
      <!-- navigation toc: --> <li><a href="._pysketcher003.html#sketcher:ex:pendulum" style="font-size: 80%;"><b>A simple pendulum</b></a></li>
      <!-- navigation toc: --> <li><a href="._pysketcher003.html#sketcher:ex:pendulum" style="font-size: 80%;"><b>A simple pendulum</b></a></li>
      <!-- navigation toc: --> <li><a href="._pysketcher003.html#sketcher:ex:pendulum:basic" style="font-size: 80%;">&nbsp;&nbsp;&nbsp;The basic physics sketch</a></li>
      <!-- navigation toc: --> <li><a href="._pysketcher003.html#sketcher:ex:pendulum:basic" style="font-size: 80%;">&nbsp;&nbsp;&nbsp;The basic physics sketch</a></li>
      <!-- navigation toc: --> <li><a href="._pysketcher003.html#___sec10" style="font-size: 80%;">&nbsp;&nbsp;&nbsp;The body diagram</a></li>
      <!-- navigation toc: --> <li><a href="._pysketcher003.html#___sec10" style="font-size: 80%;">&nbsp;&nbsp;&nbsp;The body diagram</a></li>
-     <!-- navigation toc: --> <li><a href="._pysketcher004.html#___sec11" style="font-size: 80%;"><b>Basic shapes</b></a></li>
-     <!-- navigation toc: --> <li><a href="._pysketcher004.html#___sec12" style="font-size: 80%;">&nbsp;&nbsp;&nbsp;Axis</a></li>
-     <!-- navigation toc: --> <li><a href="._pysketcher004.html#___sec13" style="font-size: 80%;">&nbsp;&nbsp;&nbsp;Distance with text</a></li>
-     <!-- navigation toc: --> <li><a href="._pysketcher004.html#___sec14" style="font-size: 80%;">&nbsp;&nbsp;&nbsp;Rectangle</a></li>
-     <!-- navigation toc: --> <li><a href="._pysketcher004.html#___sec15" style="font-size: 80%;">&nbsp;&nbsp;&nbsp;Triangle</a></li>
-     <!-- navigation toc: --> <li><a href="._pysketcher004.html#___sec16" style="font-size: 80%;">&nbsp;&nbsp;&nbsp;Arc</a></li>
-     <!-- navigation toc: --> <li><a href="._pysketcher004.html#___sec17" style="font-size: 80%;">&nbsp;&nbsp;&nbsp;Spring</a></li>
-     <!-- navigation toc: --> <li><a href="._pysketcher004.html#___sec18" style="font-size: 80%;">&nbsp;&nbsp;&nbsp;Dashpot</a></li>
-     <!-- navigation toc: --> <li><a href="._pysketcher004.html#___sec19" style="font-size: 80%;">&nbsp;&nbsp;&nbsp;Wavy</a></li>
-     <!-- navigation toc: --> <li><a href="._pysketcher004.html#___sec20" style="font-size: 80%;">&nbsp;&nbsp;&nbsp;Stochastic curves</a></li>
-     <!-- navigation toc: --> <li><a href="._pysketcher005.html#___sec21" style="font-size: 80%;"><b>Inner workings of the Pysketcher tool</b></a></li>
-     <!-- navigation toc: --> <li><a href="._pysketcher005.html#___sec22" style="font-size: 80%;">&nbsp;&nbsp;&nbsp;Example of classes for geometric objects</a></li>
-     <!-- navigation toc: --> <li><a href="._pysketcher005.html#___sec23" style="font-size: 80%;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Simple geometric objects</a></li>
-     <!-- navigation toc: --> <li><a href="._pysketcher005.html#___sec24" style="font-size: 80%;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Class curve</a></li>
-     <!-- navigation toc: --> <li><a href="._pysketcher005.html#___sec25" style="font-size: 80%;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Compound geometric objects</a></li>
-     <!-- navigation toc: --> <li><a href="._pysketcher005.html#___sec26" style="font-size: 80%;">&nbsp;&nbsp;&nbsp;Adding functionality via recursion</a></li>
-     <!-- navigation toc: --> <li><a href="._pysketcher005.html#___sec27" style="font-size: 80%;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Basic principles of recursion</a></li>
-     <!-- navigation toc: --> <li><a href="._pysketcher005.html#___sec28" style="font-size: 80%;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Explaining recursion</a></li>
+     <!-- navigation toc: --> <li><a href="._pysketcher003.html#sketcher:ex:pendulum:anim" style="font-size: 80%;">&nbsp;&nbsp;&nbsp;Animated body diagram</a></li>
+     <!-- navigation toc: --> <li><a href="._pysketcher003.html#___sec12" style="font-size: 80%;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Function for drawing the body diagram</a></li>
+     <!-- navigation toc: --> <li><a href="._pysketcher003.html#___sec13" style="font-size: 80%;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Equations for the motion and forces</a></li>
+     <!-- navigation toc: --> <li><a href="._pysketcher003.html#___sec14" style="font-size: 80%;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Numerical solution</a></li>
+     <!-- navigation toc: --> <li><a href="._pysketcher003.html#___sec15" style="font-size: 80%;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Animation</a></li>
+     <!-- navigation toc: --> <li><a href="._pysketcher004.html#___sec16" style="font-size: 80%;"><b>Basic shapes</b></a></li>
+     <!-- navigation toc: --> <li><a href="._pysketcher004.html#___sec17" style="font-size: 80%;">&nbsp;&nbsp;&nbsp;Axis</a></li>
+     <!-- navigation toc: --> <li><a href="._pysketcher004.html#___sec18" style="font-size: 80%;">&nbsp;&nbsp;&nbsp;Distance with text</a></li>
+     <!-- navigation toc: --> <li><a href="._pysketcher004.html#___sec19" style="font-size: 80%;">&nbsp;&nbsp;&nbsp;Rectangle</a></li>
+     <!-- navigation toc: --> <li><a href="._pysketcher004.html#___sec20" style="font-size: 80%;">&nbsp;&nbsp;&nbsp;Triangle</a></li>
+     <!-- navigation toc: --> <li><a href="._pysketcher004.html#___sec21" style="font-size: 80%;">&nbsp;&nbsp;&nbsp;Arc</a></li>
+     <!-- navigation toc: --> <li><a href="._pysketcher004.html#___sec22" style="font-size: 80%;">&nbsp;&nbsp;&nbsp;Spring</a></li>
+     <!-- navigation toc: --> <li><a href="._pysketcher004.html#___sec23" style="font-size: 80%;">&nbsp;&nbsp;&nbsp;Dashpot</a></li>
+     <!-- navigation toc: --> <li><a href="._pysketcher004.html#___sec24" style="font-size: 80%;">&nbsp;&nbsp;&nbsp;Wavy</a></li>
+     <!-- navigation toc: --> <li><a href="._pysketcher004.html#___sec25" style="font-size: 80%;">&nbsp;&nbsp;&nbsp;Stochastic curves</a></li>
+     <!-- navigation toc: --> <li><a href="._pysketcher005.html#___sec26" style="font-size: 80%;"><b>Inner workings of the Pysketcher tool</b></a></li>
+     <!-- navigation toc: --> <li><a href="._pysketcher005.html#___sec27" style="font-size: 80%;">&nbsp;&nbsp;&nbsp;Example of classes for geometric objects</a></li>
+     <!-- navigation toc: --> <li><a href="._pysketcher005.html#___sec28" style="font-size: 80%;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Simple geometric objects</a></li>
+     <!-- navigation toc: --> <li><a href="._pysketcher005.html#___sec29" style="font-size: 80%;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Class curve</a></li>
+     <!-- navigation toc: --> <li><a href="._pysketcher005.html#___sec30" style="font-size: 80%;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Compound geometric objects</a></li>
+     <!-- navigation toc: --> <li><a href="._pysketcher005.html#___sec31" style="font-size: 80%;">&nbsp;&nbsp;&nbsp;Adding functionality via recursion</a></li>
+     <!-- navigation toc: --> <li><a href="._pysketcher005.html#___sec32" style="font-size: 80%;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Basic principles of recursion</a></li>
+     <!-- navigation toc: --> <li><a href="._pysketcher005.html#___sec33" style="font-size: 80%;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Explaining recursion</a></li>
      <!-- navigation toc: --> <li><a href="._pysketcher005.html#sketcher:scaling" style="font-size: 80%;">&nbsp;&nbsp;&nbsp;Scaling, translating, and rotating a figure</a></li>
      <!-- navigation toc: --> <li><a href="._pysketcher005.html#sketcher:scaling" style="font-size: 80%;">&nbsp;&nbsp;&nbsp;Scaling, translating, and rotating a figure</a></li>
-     <!-- navigation toc: --> <li><a href="._pysketcher005.html#___sec30" style="font-size: 80%;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Scaling</a></li>
-     <!-- navigation toc: --> <li><a href="._pysketcher005.html#___sec31" style="font-size: 80%;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Translation</a></li>
-     <!-- navigation toc: --> <li><a href="._pysketcher005.html#___sec32" style="font-size: 80%;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Rotation</a></li>
+     <!-- navigation toc: --> <li><a href="._pysketcher005.html#___sec35" style="font-size: 80%;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Scaling</a></li>
+     <!-- navigation toc: --> <li><a href="._pysketcher005.html#___sec36" style="font-size: 80%;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Translation</a></li>
+     <!-- navigation toc: --> <li><a href="._pysketcher005.html#___sec37" style="font-size: 80%;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Rotation</a></li>
 
 
         </ul>
         </ul>
       </li>
       </li>

BIN
doc/pub/tutorial/pysketcher.pdf