Message Boards Message Boards

Algebraic "millipede" by artist math Chirag Dudhat: various implementations in Wolfram Language

Posted 11 months ago

Algebraic

What you see above is a combined visualization of several solutions by our very talented members of sister community Mathematica Stack Exchange. I asked a question there that I also copy below. You can find their solutions at the link. I liked all solutions and combined them with a few image processing lines. How GiF was generated is shown at the end.


Math artist Chirag Dudhat specializes in simple math that does something interesting visually. He recently had a hit with a "millipede" simulation with simple complex plane formulas. Below is a small part and full video is here.

enter image description here

The full video has a frame with formulas he used:

enter image description here

Quoting Chirag Dudhat own words:

The equation displayed in the video , represents the movement of a single leg. Zroot is where the leg connects to the body, Zjoint is the point where the leg bends and Ztip is the free point of the leg which may touch the surface. Change the value of L from 1 to n for n number of legs. For example , L = 12 gives you the position of 12th leg on complex plane and changing the value of "t" will animate it. This equation gives you a straight walking millipede. However for this animation I drew a curved path on my iPad , exported svg file, extracted x and y coordinates of the path. Moving the centipede on this path is like attaching the legs to the path itself and sliding the whole structure on the curve.

Please note the bold text.

But it turned out to be a bit tricky to get from simple to final form. Here is what I tried. First of all his formulas have a bit different parameter numbers to get the effect and furthermore - another formula is needed to get decreasing size of legs, thier complete number, and some other details. So here is my set of formulas:

maxL=73;
zR[L_]:=0.5I L

damp[L_,max_]:=Exp[-((L-max/2)^2/(15max))^3]

zJ[L_,t_]:=zR[L]+(-1)^L 3Exp[(5π I)/180 Sin[t+(π L)/6]]damp[L,maxL]
zT[L_,t_]:=zR[L]+(-1)^L 5Exp[(17π I)/180 Sin[t+(π L)/6]]damp[L,maxL]

zJs[L_,t_]:=zR[L]+(-1)^(L+1) 3Exp[(5π I)/180 Sin[t+(π L)/6]]damp[L,maxL]
zTs[L_,t_]:=zR[L]+(-1)^(L+1) 5Exp[(17π I)/180 Sin[t+(π L)/6]]damp[L,maxL]

This is easily animated with a Manipulate:

Manipulate[Rotate[Graphics[{
Point/@ReIm@Table[{zR[L],zJ[L,t],zT[L,t],zJs[L,t],zTs[L,t]},{L,maxL}],
Line[ReIm@Table[zR[L],{L,maxL}]],
Table[Line/@ReIm@{{zR[L],zJ[L,t],zT[L,t]},{zR[L],zJs[L,t],zTs[L,t]}},{L,maxL}]
},ImageSize->{200,600}],Pi/2],{t,0,33},SaveDefinitions->True]

enter image description here

My question:

How can we make this millipede to move along a path in the plane? For instance a closed random loop given by spline or any other similar path:

spline=BSplineFunction[RandomReal[1,{10,2}],SplineClosed->True]
ParametricPlot[spline[t],{t,0,1}]

Also, can we simplify all the code somehow? Feel free to get creative and create your own version if you want to. All millipedes moving along a curved path are cool :-)

Do not forget to check out answers HERE.

Attachments:
POSTED BY: Vitaliy Kaurov

enter image description here -- you have earned Featured Contributor Badge enter image description here Your exceptional post has been selected for our editorial column Staff Picks http://wolfr.am/StaffPicks and Your Profile is now distinguished by a Featured Contributor Badge and is displayed on the Featured Contributor Board. Thank you!

POSTED BY: EDITORIAL BOARD
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract