I want to plot the sequence

  • x_1 = \sin(pi root(2))

  • x_2 = \sin(pi root(6))

  • x_3 = \sin(pi root(12))

In short my x_n = sin( pi root(n^2 + n)). I want to plot this as an animation as n goes to infinity. Can i have the command line arguments for plotting this animation using TikZ package

  • 4
    What you tried so far? Show your effort and clarify what "animation" means in this case.
    – juliohm
    May 25 '13 at 16:41

Is this the kind of thing you want:

enter image description here

I've used pgfplots in a standalone file as follows

% arara: pdflatex
% !arara: indent: {overwrite: on}



\foreach \n in {3,4,...,30}
            \addplot[samples at={1,2,...,\n},only marks]expression{sin(deg(pi*sqrt{x^2+x}))};

And then used the command

convert -delay 10 -loop 0 -density 300 myfile.pdf myfile.gif

with ImageMagick installed. You'll see this technique demonstrated in a few other answers on the site- How to convert pstricks animation to GIF file? for example.

If you plan to have a lot of these animations, then you might like to make an arara rule, something like the following

# Make animated .gif file from .pdf
# author: Chris Hughes
# last edited by: cmh, May 25th 2013
# requires arara 3.0+
# Sample usage: 
# % arara: animate
# % arara: animate: {density: 200}
# % arara: animate: {density: 200, delay: 20}
# This rule is really just a shortcut for commands like the following
#  convert -delay 10 -loop 0 -density 300 myfile.pdf myfile.gif
# which will output myfile.gif
identifier: animate
name: animate
- <arara> convert -delay @{delay} -loop @{loop} -density @{density} "@{ getBasename(file) }.pdf" "@{ getBasename(file) }.gif"
- identifier: delay
  flag: <arara> @{parameters.delay}
  default: 10
- identifier: loop
  flag: <arara> @{parameters.loop}
  default: 0
- identifier: density
  flag: <arara> @{parameters.density}
  default: 300
  • Thanks a lot for the kind help. Yes this is what I wanted.
    – crskhr
    May 27 '13 at 10:20
  • This looks auspicious! :() But for % arara: indent: {overwrite: on} I get Can't locate YAML/Tiny.pm in @INC (@INC contains: C:/texlive/2013/tlpkg/tlperl/lib c:/texlive/2013/tlpkg/tlperl/lib .) at c:/texlive/2013/texmf-dist/scripts/latexindent/latexindent.pl
    – cis
    Jun 30 '14 at 11:53
  • @cis for windows users I recommend using latexindent.exe
    – cmhughes
    Jun 30 '14 at 12:20
  • Oh, I think the headstone is, I need ImageMagick for animate AND for indent TOO - right?
    – cis
    Jun 30 '14 at 13:05
  • @cis you shouldn't need ImageMagick for latexindent.exe
    – cmhughes
    Jun 30 '14 at 13:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.