File:2-5-10-40-SlitInterference.gif

From Wikimedia Commons, the free media repository
Jump to navigation Jump to search

2-5-10-40-SlitInterference.gif(526 × 527 pixels, file size: 4.71 MB, MIME type: image/gif, looped, 360 frames, 18 s)

Captions

Captions

Add a one-line explanation of what this file represents

Summary

[edit]
Description
English: Animation of the interference of waves originating from grating slits.
Deutsch: Animation der Überlagerung von Wellen eines Mehrfachspalts/Gitters.
Date
Source Own work
Author And1mu

Source Code

[edit]
created with LaTeX and PGF/TikZ

Script to create the animations from the frames:

#!/bin/bash

set -e
DIR="animate"
FILE="tikz.tex"

for SLOTS in 2-5-10-40 ; do
    NUM=0
    rm ${DIR}/frame???.png
    sed -i "s/\\\def\\\lines{.\+}/\\\def\\\lines{$SLOTS}/" tikz.tex
    for ANG in $(seq 0 2 358) ; do
        echo "Creating frame $NUM for $SLOTS lines ..."
        sed -i "s/\\\def\\\PhaseDiff{.\+}/\\\def\\\PhaseDiff{$ANG}/" tikz.tex
        pdflatex -shell-escape tikz.tex 1> /dev/null
        echo "Convert to png ..."
        NUMSTR=$(printf "%03d" $NUM)
        convert -shave 3x3 tikz.svg ${DIR}/frame${NUMSTR}.png
        NUM=$(($NUM+1))
    done
    cd $DIR
    convert -delay 5 -loop 0 frame*.png ${SLOTS}SlitInterference.gif
    cd -
done

The code to create a single frame (tikz.tex):

\documentclass[crop,border=3,tikz,convert={outext=.svg,command=\unexpanded{pdf2svg \infile\space\outfile}},multi=false]{standalone}
\usepackage{ifthen}
\usetikzlibrary{math}
\usetikzlibrary{calc,through,shapes}

\pgfkeys{/tikz/savelength/.code 2 args={\global\edef#1{#2}}}

\pgfdeclarelayer{background}
\pgfdeclarelayer{foreground}
\pgfsetlayers{background,main,foreground}

\def\lines{40}
\def\omegat{20}
\def\PhaseDiff{359}

\newcommand{\mypicture}{
  \tikzmath{\D=\PhaseDiff;}
  \draw[gray,->] (0,-4) -- (0,4);
  \draw[gray,->] (-4,0) -- (4,0);
  \coordinate (A) at (0,0);
  \tikzmath{\Amp=5/\lines;}
  \coordinate (B) at (\omegat:\Amp);
  \foreach \a in {1,...,\lines}{
    \draw[->,blue] (A) -- (B);
    \coordinate (A) at (B);
    \coordinate (F) at (B);
    \coordinate (B) at ($ (B)+(\a*\D+\omegat:\Amp) $);
  }
  \node at (-4,4){\large $N=\lines$};

  \path let \p1=(F), \n1={veclen(\x1,\y1)} in [savelength={\n}{\n1}];

  \ifthenelse{\lengthtest{\n < 8 pt}}{
    \draw[ultra thick,red,tips=proper] (0,0) -- (F);
    \ifthenelse{\lengthtest{\n < 1 pt}}{
      \draw[ultra thick] (0,0) circle (1);
      % \node at (-1.5,-1.5){Minimum};
    }{}
  }{
    \draw[ultra thick,red,->,tips=proper] (0,0) -- (F);
  }

  \begin{pgfonlayer}{background}
    \draw[fill=white] (-5.1,-5.1) rectangle (5.1,5.1);
    \path[fill=red!30] let \p1=(F), \n1={veclen(\x1,\y1)}  in (0,0) circle[radius=\n1];
  \end{pgfonlayer}
}

\begin{document}
\begin{tikzpicture}[>=latex]
  \tikzmath{\lines=2;}
  \mypicture
  \node()[fill=white, inner sep=10] at (5.1,-5.1){\Huge $\delta=\PhaseDiff^\circ$};
  \begin{scope}[shift={(10.2,0)}]
    \tikzmath{\lines=5;}
    \mypicture
  \end{scope}
  \begin{scope}[shift={(0,-10.2)}]
    \tikzmath{\lines=10;}
    \mypicture
  \end{scope}
  \begin{scope}[shift={(10.2,-10.2)}]
    \tikzmath{\lines=40;}
    \mypicture
  \end{scope}
\end{tikzpicture}
\end{document}

Licensing

[edit]
I, the copyright holder of this work, hereby publish it under the following license:
w:en:Creative Commons
attribution share alike
This file is licensed under the Creative Commons Attribution-Share Alike 4.0 International license.
You are free:
  • to share – to copy, distribute and transmit the work
  • to remix – to adapt the work
Under the following conditions:
  • attribution – You must give appropriate credit, provide a link to the license, and indicate if changes were made. You may do so in any reasonable manner, but not in any way that suggests the licensor endorses you or your use.
  • share alike – If you remix, transform, or build upon the material, you must distribute your contributions under the same or compatible license as the original.

File history

Click on a date/time to view the file as it appeared at that time.

Date/TimeThumbnailDimensionsUserComment
current23:01, 2 February 2021Thumbnail for version as of 23:01, 2 February 2021526 × 527 (4.71 MB)Bürgerentscheid (talk | contribs)resized to fit 100 MP limit
11:14, 27 March 2016Thumbnail for version as of 11:14, 27 March 2016573 × 574 (4.28 MB)And1mu (talk | contribs)layout improvements: the phase is the same for all, show only once
08:12, 22 March 2016Thumbnail for version as of 08:12, 22 March 2016573 × 574 (4.5 MB)And1mu (talk | contribs)User created page with UploadWizard

There are no pages that use this file.

File usage on other wikis

The following other wikis use this file: