# \[GIF\] Dance (Chladni figures for a square drum)

**URL:** <https://community.wolfram.com/t/gif-dance-chladni-figures-for-a-square-drum/13454>\
**Category:** Staff Picks\
**Tags:** computational-arts, geometry, graphics-and-visualization, interface-construction, symbolic-computations, staff-pick\
**Created:** [December 19, 2018, 12:31am UTC](https://community.wolfram.com/t/gif-dance-chladni-figures-for-a-square-drum/13454 "2018-12-19T00:31:55Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![claytonshonkwiler](https://yyz1.discourse-cdn.com/wolfram/user_avatar/community.wolfram.com/claytonshonkwiler/32/24940_2.png) [@claytonshonkwiler](https://community.wolfram.com/u/claytonshonkwiler)\
**Post date:** [December 19, 2018, 12:31am UTC](https://community.wolfram.com/t/gif-dance-chladni-figures-for-a-square-drum/13454/1 "2018-12-19T00:31:55Z")

</div>

![transition23cqc.gif](https://global.discourse-cdn.com/wolfram/original/2X/e/e44357c378a2c22d4ac7b08b5e357bc1c3fa23db.gif)

**Dance**

Speaking of [vibration modes of a square drum](https://wolfram.discourse.group/t/13419/1) , here are the Chladni figures for linear combinations of the (20,21) and (21,20) vibration modes of the square.

This is entirely in the spirit of [_The Band Plays On_](https://wolfram.discourse.group/t/9014/1) ; since that was a while ago, let me quote from that description:

> Cribbing from the [MathWorld article](http://mathworld.wolfram.com/WaveEquationRectangle.html), the vertical displacement of the (p,q) vibration mode of a 1 \times 1 square drum is

> u\_{pq}(x,y) = (A \cos \omega\_{pq} t + B \sin \omega\_{pq} t) \sin(p \pi x) \sin (q \pi y),

> where \omega\_{pq} = \pi \sqrt{p^2 + q^2}. This is easy enough to turn into a function:

```
 ?[p_, q_] := ? Sqrt[p^2 + q^2];
 ?[x_, y_, t_, p_, q_, A_, B_] := (A Cos[?[p, q] t] + B Sin[?[p, q] t]) Sin[p ? x] Sin[q ? y];

```

> In fact, the same holds for arbitrary rectangles, so long as the product of sines becomes \sin(p\pi x/L\_x)\sin(p \pi y/L\_y) where L\_x and L\_y are the lengths of the sides of the rectangle. The nice thing about squares is that you get an extra symmetry: the (p,q) mode and the (q,p) mode have the same frequency, so any linear combination will also form a standing wave.

In this GIF, I’m taking the combination u = u\_{20,21} + c u\_{21,20} and (by letting c=\tan \theta) varying c from -\infty to \infty. The curves in the animation are the so-called _Chladni figures_, or nodal lines of the vibration, meaning the solutions of u=0.

Here’s the code which does not produce a `Manipulate[]` that updates nicely in real time, unfortunately):

```
With[{p = 20, q = 21, A = 1, B = 0, 
  cols = RGBColor /@ {"#a2ef44", "#08085e"}},
 Manipulate[
  ContourPlot[
   ?[x, y, 0., p, q, A, B] + Tan[(?/2 - .0001) 2 (? - ?/2)/?] ?[x, y, 0., q, p, A, B] == 0,
   {x, .01, .99}, {y, .01, .99},
   Axes -> False, Frame -> False, PlotPoints -> 50, 
   ContourStyle -> Directive[CapForm["Round"], Thickness[.01], cols[[1]]], 
   PlotRangePadding -> -0.01, ImageSize -> 540, 
   Background -> cols[[-1]]],
  {?, 0, ?}]
 ]

```

---

<div class="post-metadata">

**Author:** ![wolframcommunity](https://yyz1.discourse-cdn.com/wolfram/user_avatar/community.wolfram.com/wolframcommunity/32/8335_2.png) [@wolframcommunity](https://community.wolfram.com/u/wolframcommunity)\
**Post date:** [December 19, 2018, 10:52am UTC](https://community.wolfram.com/t/gif-dance-chladni-figures-for-a-square-drum/13454/2 "2018-12-19T10:52:18Z")

</div>

![2015-11-02_10-07-11.png](https://global.discourse-cdn.com/wolfram/original/3X/5/0/50e59c9ead62f729e7130d3ea1482555a75602b6.png)

- Congratulations! This post is now a [Staff Pick](http://community.wolfram.com/content?curTag=staff+picks) as distinguished by a badge on [your profile](http://community.wolfram.com/web/claytonshonkwiler)! Thank you, keep it coming, and consider contributing your work to the [The Notebook Archive](http://notebookarchive.org)!
