L'equazione delle onde

Animazione per l'equazione delle onde

Prolungamento dispari e poi periodico di f:

f[x_] :=  Exp[-x] Sin[x]

g[x_] :=  Sign[x]  f[Abs[x]]

h[x_] := 
      If[Abs[x] < π, g[x], 
        g[Mod[x + π, 2 π] - π]]

Plot[h[x],  {x, -10, 10},  AspectRatio ->  0.15, 
        Ticks -> None];

Plot[{h[x],  h[x - 1]},  {x, -10, 10},  
        AspectRatio ->  0.15, Ticks -> None];

Plot[{h[x],  h[x + 1]},  {x, -10, 10},  
        AspectRatio ->  0.15, Ticks -> None];

Plot[(h[x + 1] +  h[x - 1])/2,  {x, -10, 10},  
        AspectRatio ->  0.15, Ticks -> None];

Prima animazione:

Do[ 
gr1  =  
          Plot[{h[x - t],  h[x + t]},  {x, -4, 6}, 
            DisplayFunction ->  Identity,  AspectRatio ->  0.1, 
            Ticks -> None]; 
gr2  =  
          Plot[(h[x - t] +  h[x + t])/2,  {x, 0, π}, 
            DisplayFunction ->  Identity, Ticks -> None,  
            PlotStyle -> {RGBColor[1, 0, 0], 
                Thickness[
                  0.005]}
]; 
Show[{gr1, 
            gr2}, DisplayFunction ->  $DisplayFunction,   ImageSize -> {500,  200}], 
{t, 
          0, π, π/40}];

Altra animazione. Ridefiniamo la funzione f che individua la configurazione iniziale:

Clear["Global`"]

f[x_] :=  
      Which[0 <= x ∧ x < 1,  
        x, (1 ≤ x) ∧ (x < 4),  (4 - x)/3,  
        True, 0]

Plot[f[x], {x, 0, 4}];

Prolungamento dispari:

g[x_] :=  Sign[x]  f[Abs[x]]

Prolungamento periodico:

h[x_] := If[Abs[x] < 4, g[x], g[Mod[x + 4, 8] - 4]]

Do[ 
gr1  =  
          Plot[{h[x - t],  h[x + t]},  {x, -4, 8}, 
            DisplayFunction ->  Identity, 
            Ticks -> None]; 
gr2  =  
          Plot[(h[x - t] +  h[x + t])/2,  {x, 0, 4},  
            AspectRatio ->  0.1, DisplayFunction ->  Identity, 
            Ticks -> None,  
            PlotStyle -> {RGBColor[1, 0, 0], 
                Thickness[
                  0.005]}
]; 
Show[{gr2, 
            gr1}, DisplayFunction ->  $DisplayFunction,   ImageSize -> {500,  200}], 
{t, 0, 4, 1/10}];

Terza animazione. Partiamo da:

r[x_] :=  Sin[x]

Do[ 
gr1  =  
          Plot[{r[x - t],  r[x + t]},  {x, -4, 6}, 
            DisplayFunction ->  Identity, 
            Ticks -> None]; 
gr2  =  
          Plot[(r[x - t] +  r[x + t])/2,  {x, 0, π}, 
            DisplayFunction ->  Identity, Ticks -> None,  
            AspectRatio ->  0.1,  
            PlotStyle -> {RGBColor[1, 0, 0], 
                Thickness[
                  0.005]}
]; 
Show[{gr2, 
            gr1}, DisplayFunction ->  $DisplayFunction,   ImageSize -> {500,  200}], 
{t, 
          0, π, π/41}];

Quarta animazione: produciamo un nodo

r[x_] :=  Sin[2  x]

Do[ 
gr1  =  
          Plot[{r[x - t],  r[x + t]},  {x, -4, 6}, 
            DisplayFunction ->  Identity, 
            Ticks -> None]; 
gr2  =  
          Plot[(r[x - t] +  r[x + t])/2,  {x, 0, π}, 
            DisplayFunction ->  Identity, Ticks -> None,  
            AspectRatio ->  0.1,  
            PlotStyle -> {RGBColor[1, 0, 0], 
                Thickness[
                  0.005]}
]; 
Show[{gr2, 
            gr1}, DisplayFunction ->  $DisplayFunction,   ImageSize -> {500,  200}], 
{t, 
          0, π, π/41}];