[go: nahoru, domu]

Aller au contenu

Fichier:WaveLongitudinal.gif

Le contenu de la page n’est pas pris en charge dans d’autres langues.
Définition, traduction, prononciation, anagramme et synonyme sur le dictionnaire libre Wiktionnaire.

WaveLongitudinal.gif(427 × 469 pixels, taille du fichier : 1,16 Mio, type MIME : image/gif, en boucle, 63 trames, 6,3 s)

Description

Description
English: propagating longitudinal waves
Deutsch: longitudinale Wellen
Date
Source Travail personnel
Auteur And1mu

Source Code

created with LaTeX and PGF/TikZ

Script to create the animation:

#!/bin/bash

set -eu
DIR="animate"
FILE="WaveLongitudinal"

NUM=0
rm -f ${DIR}/frame???.png
for ANG in $(seq -1.5 0.20 11) ; do
    echo "Creating frame $NUM ..."
    POS=$ANG
    echo $POS $ANG
    sed -i "s/\\\def\\\myt{.\+}/\\\def\\\myt{$POS}/" ${FILE}.tex
    pdflatex -shell-escape ${FILE}.tex 1> /dev/null
    echo "Convert to png ..."
    NUMSTR=$(printf "%03d" $NUM)
    convert -density 100 ${FILE}.svg -shave 3 ${DIR}/frame${NUMSTR}.png
    NUM=$(($NUM+1))
done
cd $DIR
convert -delay 10 -loop 10000 frame*.png  ${FILE}.gif
cd -

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

\documentclass[crop,border=3,tikz,convert={outext=.svg,command=\unexpanded{pdf2svg
    \infile\space\outfile}},multi=false]{standalone}
\usepackage{ifthen}
\usetikzlibrary{math,decorations.pathmorphing,patterns}
\pgfdeclarelayer{background}
\pgfdeclarelayer{foreground}
\pgfsetlayers{background,main,foreground}

\begin{document}

\def\myt{5.1}
\def\mypi{3.141592653589793}

\newcommand{\spring}[2]{
  \def\s{0.015}
  \tikzmath{\l = ((#2)-(#1+8*\s))*9 ;}
  \draw[] (#1,0)--(#1+\s,0);
  \draw[decoration={aspect=0.33, segment length=\l,
    amplitude=2mm,coil},decorate] (#1+\s,0)--(#2,0);
}

\newcommand{\wave}[4]{
  \def\myA{#1}
  \def\mya{#2}
  \def\myB{#3}
  \def\myb{#4}
  \def\olda{0}

  \draw[ultra thick,blue,smooth,domain=0:10,samples=100] plot
  function {0.5*(\myA*exp(-\mya*(10-x-\myt)**2)+\myB*exp(-\myb*(x-\myt)**2))
  -1};

  \foreach \a in {0,0.5,...,10}{
    \tikzmath{\myy=
      0.2*(\myA*exp(-\mya*(10-\a-\myt)^2)+\myB*exp(-\myb*(\a-\myt)^2));
    }
    \tikzmath{\myv=
      0.5*(\mya*(10-\a-\myt)* \myA*exp(-\mya*(10-\a-\myt)^2)
      +\myb*(\a-\myt)*\myB*exp(-\myb*(\a-\myt)^2));
    }

    \tikzmath{\myoldy=
      0.2*(\myA*exp(-\mya*(10-\a+0.5-\myt)^2)+\myB*exp(-\myb*(\a-0.5-\myt)^2));
    }

    \ifthenelse{\lengthtest{\myy pt > 0.1 pt} \OR \lengthtest{\myy pt < -0.1 pt}}{
      \draw[red,->,tips=proper] (\a,0) -++ (\myy,0);
    }{
      \draw[red] (\a,0) -++ (\myy,0);
    }

    \draw[red,fill=white] (\a,0) circle (0.6mm);
    \begin{pgfonlayer}{foreground}
      \fill[red] (\a+\myy,0) circle (0.6mm);
    \end{pgfonlayer}
    \ifthenelse{\lengthtest{\a pt > 0 pt}}{
      \spring{\a-0.5+\myoldy}{\a+\myy};
    }
    % \pgfmathparse{\a==4?1:0}
    %\ifthenelse{\lengthtest{\myv pt > 0.1 pt} \OR \lengthtest{\myv pt < -0.1 pt}}{
    %  \draw[thick,->,tips=proper] (\a+\myy,1) -++ (\myv,0);
    %}{
    %  \draw[thick] (\a+\myy,1) -++ (\myv,0);
    %}
  }
}
\newcommand{\sinewave}[1]{
  \def\mypi{3.141592653589793}
  \def\myx{\myt}

  \draw[ultra thick,blue,smooth,domain=0:9.5,samples=40] plot
  function {0.7*sin(x-\myx)-1};
  \draw[ultra thick,dotted,blue,smooth,domain=9.5:10,samples=5] plot
  function {0.7*sin(x-\myx)-1};

  \foreach \a in {0,0.5,...,10}{
    \tikzmath{\myy=0.35*sin(180/\mypi*(\a-\myx));}
    \tikzmath{\myoldy=0.35*sin(180/\mypi*(\a-0.5-\myx));}
    \ifthenelse{\lengthtest{\myy pt > 0.1 pt} \OR \lengthtest{\myy pt < -0.1 pt}}{
      \draw[red,->,tips=proper] (\a,0) -++ (\myy,0);
    }{
      \draw[red] (\a,0) -++ (\myy,0);
    }
    \draw[red,fill=white] (\a,0) circle (0.6mm);
    \begin{pgfonlayer}{foreground}
      \fill[red] (\a+\myy,0) circle (0.6mm);
    \end{pgfonlayer}
    \ifthenelse{\lengthtest{\a pt > 0 pt}}{
      \spring{\a-0.5+\myoldy}{\a+\myy};
    }
  }
}

\begin{tikzpicture}[>=latex,scale=1]
  \begin{pgfonlayer}{background}
    \fill[white] (-0.5,-8) rectangle (10.5,4);
  \end{pgfonlayer}
  \clip (0,-8) rectangle (10,4);
  \begin{pgfonlayer}{foreground}
    \clip (0,-8) rectangle (10,4);
  \end{pgfonlayer}
  % \draw[thick,->] (0,-0.3) -- (0,2.8) node[above]{\Large $y$};
  %\draw[thick,->] (-0.1,0) -- (10.5,0) node[below]{\Large $x$};
  \foreach \a in {-1.5,-1,...,0}{
    \draw[dotted] (0,\a) -- (10,\a);
  }
  \wave{1}{5}{1}{5}
  \begin{scope}[shift={(0,-2.5)}]
    %\draw[thick,->] (0,-1.7) -- (0,1.8) node[above]{\Large $y$};
    %\draw[thick,->] (-0.1,0) -- (10.5,0) node[below]{\Large $x$};
    \foreach \a in {-2,-1.5,...,0}{
      \draw[dotted] (0,\a) -- (10,\a);
    }
    \wave{-1.5}{5}{1.5}{5}
  \end{scope}
  \begin{scope}[shift={(0,3)}]
    %\draw[thick,->] (0,-1.7) -- (0,1.8) node[above]{\Large $y$};
    %\draw[thick,->] (-0.1,0) -- (10.5,0) node[below]{\Large $x$};
    \foreach \a in {-2,-1.5,...,0}{
      \draw[dotted] (0,\a) -- (10,\a);
    }
    \wave{-1.3}{0.8}{1.4}{10}
  \end{scope}
  \begin{scope}[shift={(0,-5.5)}]
    %\draw[thick,->] (0,-1.7) -- (0,1.8) node[above]{\Large $y$};
    %\draw[thick,->] (-0.1,0) -- (10.5,0) node[below]{\Large $x$};
    \foreach \a in {-2,-1.5,...,0}{
      \draw[dotted] (0,\a) -- (10,\a);
    }
    \sinewave{-1.3}{0.8}{1.4}{10}
  \end{scope}
\end{tikzpicture}
\end{document}

Conditions d’utilisation

Moi, en tant que détenteur des droits d’auteur sur cette œuvre, je la publie sous la licence suivante :
w:fr:Creative Commons
paternité partage à l’identique
Vous êtes libre :
  • de partager – de copier, distribuer et transmettre cette œuvre
  • d’adapter – de modifier cette œuvre
Sous les conditions suivantes :
  • paternité – Vous devez donner les informations appropriées concernant l'auteur, fournir un lien vers la licence et indiquer si des modifications ont été faites. Vous pouvez faire cela par tout moyen raisonnable, mais en aucune façon suggérant que l’auteur vous soutient ou approuve l’utilisation que vous en faites.
  • partage à l’identique – Si vous modifiez, transformez, ou vous basez sur cette œuvre, vous devez distribuer votre contribution sous la même licence ou une licence compatible avec celle de l’original.

Légendes

Ajoutez en une ligne la description de ce que représente ce fichier

Éléments décrits dans ce fichier

dépeint

sous droit d'auteur<\/a>"}},"text\/plain":{"fr":{"P6216":"sous droit d'auteur"}}}}" class="wbmi-entityview-statementsGroup wbmi-entityview-statementsGroup-P6216 oo-ui-layout oo-ui-panelLayout oo-ui-panelLayout-framed">
Creative Commons Attribution \u2013 Partage dans les m\u00eames conditions 4.0 International<\/a>"}},"text\/plain":{"fr":{"P275":"Creative Commons Attribution \u2013 Partage dans les m\u00eames conditions 4.0 International"}}}}" class="wbmi-entityview-statementsGroup wbmi-entityview-statementsGroup-P275 oo-ui-layout oo-ui-panelLayout oo-ui-panelLayout-framed">
cr\u00e9ation originale de la personne ayant t\u00e9l\u00e9vers\u00e9<\/a>"}},"text\/plain":{"fr":{"P7482":"cr\u00e9ation originale de la personne ayant t\u00e9l\u00e9vers\u00e9"}}}}" class="wbmi-entityview-statementsGroup wbmi-entityview-statementsGroup-P7482 oo-ui-layout oo-ui-panelLayout oo-ui-panelLayout-framed">

Historique du fichier

Cliquer sur une date et heure pour voir le fichier tel qu'il était à ce moment-là.

Date et heureVignetteDimensionsUtilisateurCommentaire
actuel22 juin 2016 à 14:38Vignette pour la version du 22 juin 2016 à 14:38427 × 469 (1,16 Mio)And1muUser created page with UploadWizard

La page suivante utilise ce fichier :

Usage global du fichier

Les autres wikis suivants utilisent ce fichier :