In my last blog post, I discussed how to construct closed-form trigonometric formulas for sketches of people’s faces. Using similar techniques, Wolfram|Alpha has recently added a collection of hundreds of such closed-form curves for faces, shapes, animals, logos, and signatures. In today’s post, I want to show some of the entertaining things one can do with these parametrized curves. Although these are just simple curves, a large variety of fun images (and animations) can be constructed from them. These can then be used, for example, in political cartoons, talk shows, posters, music album covers, or just to spice up an advanced calculus or first-year theoretical mechanics class. I will first discuss the fun applications, and then the more mathematical ones.
Wolfram|Alpha has hundreds of curves that can be used for the variations discussed below. Here are some example categories.
![Pokemon, people, fictional characters' curves Pokemon, people, fictional characters' curves](http://blog.wolframalpha.com/data/uploads/2013/05/Screen-Shot-2013-05-29-at-7.49.51-PM.png)
![My little pony, food, shape and logo curves My little pony, food, shape and logo curves](http://blog.wolframalpha.com/data/uploads/2013/05/Screen-Shot-2013-05-29-at-7.49.18-PM.png)
I will start by implementing two simple functions. We will work with the individual curve segments rather than with one monolithic curve, because for most of the applications below, the concrete parametrization of the whole curves does not matter. The parametrizations returned by Wolfram|Alpha are a set of truncated Fourier sums multiplied by unit step functions. The unit step functions ensure that we can use a single parametrization and nevertheless have individual disconnected line segments. The function extractCurveSegments gives a list of the individual curve segments that a curve is made of. And the getSegmentLength gives the length of a segment.
![extractCurveSegments and getSegmentLength extractCurveSegments and getSegmentLength](http://blog.wolframalpha.com/data/uploads/2013/05/Screen-Shot-2013-05-29-at-7.47.50-PM.png)
As with most Wolfram|Alpha functionality, it’s easy to import a computable form of the data into Mathematica. So, let’s import the parametrization of the face of Barack Obama.
![Barack Obama curve Barack Obama curve](http://blog.wolframalpha.com/data/uploads/2013/05/Screen-Shot-2013-05-29-at-7.47.07-PM.png)
We extract the individual curve segments for further use. Each curve segment is an expression in t that, when plotted for t from 0 to 2π, draws the visual representation of the segment.
![Individual curve segments for Obama curve Individual curve segments for Obama curve](http://blog.wolframalpha.com/data/uploads/2013/05/Screen-Shot-2013-05-29-at-7.46.14-PM.png)
Let us now use the segment parametrizations to build some variations of the original image. First we plot the line segments as 3D tubes of finite thickness. Although simple, this makes the curves look already a bit more interesting.
![Line segments as 3D tubes of finite thickness for Obama curve Line segments as 3D tubes of finite thickness for Obama curve](http://blog.wolframalpha.com/data/uploads/2013/05/Screen-Shot-2013-05-29-at-7.45.02-PM.png)
Another way to make a more interesting-looking graphic: the next graphic shows each curve segment as a spiral that originates from the segment’s center of mass.
![Each curve segment as a spiral that originates from the segment's center of mass for Obama curve Each curve segment as a spiral that originates from the segment's center of mass for Obama curve](http://blog.wolframalpha.com/data/uploads/2013/05/Screen-Shot-2013-05-29-at-7.43.55-PM.png)
If we sample the curve segments coarsely and position chains of disks at each curve point, we can construct some Medusa-like images. We position a disk at each point of the parametrized curve, and from each of these disks we attach a sequence of smaller and smaller disks.
![Disks in 3D at curve points for Obama curve Disks in 3D at curve points for Obama curve](http://blog.wolframalpha.com/data/uploads/2013/05/Screen-Shot-2013-05-29-at-7.53.05-PM.png)
And here the same is done with spheres instead of disks in 3D.
![Spheres in 3D at curve points for Obama curve Spheres in 3D at curve points for Obama curve](http://blog.wolframalpha.com/data/uploads/2013/06/Screen-shot-2013-06-04-at-10.22.20-AM.png)
If we sample the curve segments densely, we can build a 3D plot of the distance of all points {x,y} of the plane to the nearest (or second nearest, …) curve segment points. To do so efficiently, we use Nearest.
![make3DNearestDistancePlot of Obama curve make3DNearestDistancePlot of Obama curve](http://blog.wolframalpha.com/data/uploads/2013/05/Screen-Shot-2013-05-29-at-8.19.34-PM.png)
The resulting image looks more interesting than the curves themselves, as we now also see some structure in the regions between the curves.
![3D nearest distance plot of Obama curve 3D nearest distance plot of Obama curve](http://blog.wolframalpha.com/data/uploads/2013/05/Screen-Shot-2013-05-29-at-8.20.08-PM.png)
So far, we have kept the curve points and placed and added various additions to the plot. We can also change the actual coordinates of the curve points. Having the coordinates of the curve points in explicit form at hand, we can easily take the square root of the curves. The next graphic shows the resulting curves for taking the square root in x,y coordinates and in polar coordinates.
![Obama curve taking the square root in x,y coordinates and in polar coordinates Obama curve taking the square root in x,y coordinates and in polar coordinates](http://blog.wolframalpha.com/data/uploads/2013/05/Screen-Shot-2013-05-29-at-8.20.52-PM.png)
Generalizing the map to arbitrary power functions is straightforward, and the following interactive example allows arbitrary reference points and exponents. For some more visual variety, we use some current and former presidents and prime ministers. In addition to the power function mapping parameters, we allow the interactive change of the coordinate system origin through a locator.
![Generalizing the map to arbitrary power functions for Obama curve Generalizing the map to arbitrary power functions for Obama curve](http://blog.wolframalpha.com/data/uploads/2013/06/Screen-Shot-2013-06-04-at-4.18.13-PM.png)
![Generalizing the map to arbitrary power functions for Obama curve Generalizing the map to arbitrary power functions for Obama curve](http://blog.wolframalpha.com/data/uploads/2013/05/Screen-Shot-2013-05-29-at-8.21.42-PM.png)
![Generalizing the map to arbitrary power functions for Obama curve Generalizing the map to arbitrary power functions for Obama curve](http://blog.wolframalpha.com/data/uploads/2013/05/Screen-Shot-2013-05-29-at-7.57.12-PM.png)
![Generalizing the map to arbitrary power functions for Obama curve Generalizing the map to arbitrary power functions for Obama curve](http://blog.wolframalpha.com/data/uploads/2013/05/Screen-Shot-2013-05-3021.png)
Now let’s switch to another person curve. This is a sketch of Wolfram|Alpha’s creator, Stephen Wolfram.
![Stephen Wolfram curve Stephen Wolfram curve](http://blog.wolframalpha.com/data/uploads/2013/05/Screen-Shot-2013-05-29-at-8.23.32-PM.png)
We again extract the individual curve segments for further use.
![Individual line segments for Wolfram curve Individual line segments for Wolfram curve](http://blog.wolframalpha.com/data/uploads/2013/05/Screen-Shot-2013-05-29-at-8.23.47-PM.png)
We plot again the distances of points in the plane to the nearest line segment. The middle and right image show the distances to the second-nearest and the third-nearest curve segments. Not unexpectedly, measuring the distance to more distant line segments loses important facial structures.
![Wolfram plot using the distances of points in the plane to the nearest line segment Wolfram plot using the distances of points in the plane to the nearest line segment](http://blog.wolframalpha.com/data/uploads/2013/05/Screen-Shot-2013-05-29-at-8.24.48-PM.png)
Here are two more uses of the distance array; this time, we make three array plots from the data that was used to make the last plot.
![Array plots of Wolfram Array plots of Wolfram](http://blog.wolframalpha.com/data/uploads/2013/05/Screen-Shot-2013-05-29-at-8.25.26-PM.png)
Here is a version of Stephen in a Roman mosaic fresco style. To construct it, we start with a semi-random array of points. For these points we build a Voronoi diagram of these points (using ListContourPlot[points, InterpolationOrder->0]). We map the individual polygons of the Voronoi diagram into 3D (to get a more realistic mosaic feeling) and color them according to the distance to the points of the curve segments.
![Roman mosaic fresco style version of Wolfram Roman mosaic fresco style version of Wolfram](http://blog.wolframalpha.com/data/uploads/2013/06/Screen-Shot-2013-06-04-at-4.22.07-PM.png)
![Roman mosaic fresco style version of Wolfram Roman mosaic fresco style version of Wolfram](http://blog.wolframalpha.com/data/uploads/2013/05/Screen-Shot-2013-05-29-at-8.27.53-PM.png)
And here is a more modern art version of Stephen Wolfram. On a square grid, we imprint the curve segments as if they act gravitationally on the grid vertices and slightly deform the grid.
![Modern art version of Wolfram Modern art version of Wolfram](http://blog.wolframalpha.com/data/uploads/2013/06/Screen-Shot-2013-06-04-at-4.24.38-PM.png)
Since the sketch of Stephen Wolfram’s face is given as a set of curves, we can apply various differential geometric operations. The next graphic shows the pedal curve and the contrapedal curve of the face curves, meaning that the curves are defined in such a way that a point on the new curve is perpendicular to the tangent (normal) of the original curve with respect to a point P (the locator). (Initially, we put the pedal point in Stephen’s left nostril.)
![Pedal curve and contrapedal curve of Wolfram curves Pedal curve and contrapedal curve of Wolfram curves](http://blog.wolframalpha.com/data/uploads/2013/05/Screen-Shot-2013-05-29-at-8.30.07-PM.png)
![Pedal curve and the contrapedal curve of Wolfram parametrization Pedal curve and the contrapedal curve of Wolfram parametrization](http://blog.wolframalpha.com/data/uploads/2013/05/Screen-Shot-2013-05-29-at-8.40.05-AM.png)
Rotating the curves that form the face outline around the z axis gives an interesting-looking 3D image of Stephen Wolfram’s face.
![3D image of Wolfram 3D image of Wolfram](http://blog.wolframalpha.com/data/uploads/2013/06/Screen-shot-2013-06-04-at-10.28.15-AM.png)
Now let’s take the last two face curves, the ones from Wolf Blitzer and Anderson Cooper, and morph them into each other. Because the parametrizations don’t allow a one-to-one map, we can’t directly interpolate between the parametrized curves, but we can easily interpolate between the points of the curves. First we rescale the curves, so that the two faces are identically positioned and scaled.
![Wolf Blitzer and Anderson Cooper curves Wolf Blitzer and Anderson Cooper curves](http://blog.wolframalpha.com/data/uploads/2013/05/Screen-Shot-2013-05-29-at-8.32.30-PM.png)
We select 20,000 points on each face curve set and find the nearest point on the other face curve set. Then we interpolate between these point pairs.
![20,000 points for Blitzer and Cooper face curves 20,000 points for Blitzer and Cooper face curves](http://blog.wolframalpha.com/data/uploads/2013/05/Screen-Shot-2013-05-29-at-8.34.50-PM.png)
These are the lines of interpolation between the point pairs.
![Lines of interpolations between the pairs for Blitzer and Cooper plots Lines of interpolations between the pairs for Blitzer and Cooper plots](http://blog.wolframalpha.com/data/uploads/2013/06/Screen-Shot-2013-06-04-at-4.27.40-PM.png)
Using the just-calculated transition and boundary points, we can quickly generate relief plots of their faces.
![Relief plots of Blitzer and Cooper Relief plots of Blitzer and Cooper](http://blog.wolframalpha.com/data/uploads/2013/05/Screen-Shot-2013-05-30-at-1.01.40-PM.png)
And here again is a transition between the two faces.
![Transition between Blitzer and Cooper curves Transition between Blitzer and Cooper curves](http://blog.wolframalpha.com/data/uploads/2013/05/Screen-Shot-2013-05-29-at-8.37.06-PM.png)
The following interactive version allows us to change the transition parameter and connects the resulting interpolating point set.
![Transition between Blitzer and Cooper curves Transition between Blitzer and Cooper curves](http://blog.wolframalpha.com/data/uploads/2013/05/Screen-Shot-2013-05-30-at-5.40.12-PM.png)
Or we could use a drawing of Jay Leno.
![Jay Leno curve Jay Leno curve](http://blog.wolframalpha.com/data/uploads/2013/05/Screen-Shot-2013-05-29-at-8.38.30-PM.png)
Here is again the nearest curve segment plot of its defining line segments.
![Nearest curve segment plot of Leno Nearest curve segment plot of Leno](http://blog.wolframalpha.com/data/uploads/2013/05/Screen-Shot-2013-05-29-at-8.39.08-PM.png)
Here are two modified interactive “line drawings” of Jay. In the first graphic, the line numbers, line lengths, and line angles can be changed interactively.
![Interactive line drawings of Leno Interactive line drawings of Leno](http://blog.wolframalpha.com/data/uploads/2013/05/Screen-Shot-2013-05-29-at-8.39.51-PM.png)
![Interactive line drawings of Leno Interactive line drawings of Leno](http://blog.wolframalpha.com/data/uploads/2013/05/Screen-Shot-2013-05-29-at-8.40.30-PM1.png)
We can also braid tubes along our curve segments. Or depict a more prickly Leno made from thousands of little arrows.
![Leno with braid tubes along curve segments and prickly Leno made from thousands of little arrows Leno with braid tubes along curve segments and prickly Leno made from thousands of little arrows](http://blog.wolframalpha.com/data/uploads/2013/05/Screen-Shot-2013-05-29-at-8.41.13-PM.png)
And here is his portrait rotated in 3D along a snail-shell-like curve.
![Leno 3D along a snail-shell-like curve Leno 3D along a snail-shell-like curve](http://blog.wolframalpha.com/data/uploads/2013/05/Screen-Shot-2013-05-29-at-8.42.00-PM.png)
We continue with some variations of Lady Gaga.
![Variations of Lady Gaga curve Variations of Lady Gaga curve](http://blog.wolframalpha.com/data/uploads/2013/05/Screen-Shot-2013-05-29-at-8.42.38-PM.png)
She surely would not want to be displayed as a uniform thin, plain blue curve. So, let’s broaden and color the line segments.
![Colorized Lady Gaga curve Colorized Lady Gaga curve](http://blog.wolframalpha.com/data/uploads/2013/05/Screen-Shot-2013-05-29-at-8.43.26-PM.png)
The next graphic is made with 50,000 randomly placed and colored ngons. The size and the opacity of the ngons are a function of the distance to the nearest point of one of the curves that make the face sketch.
![Plot of Lady Gaga with ngons Plot of Lady Gaga with ngons](http://blog.wolframalpha.com/data/uploads/2013/06/Screen-Shot-2013-06-04-at-4.31.39-PM.png)
And here are two calls to ListContourPlot with the points of Lady Gaga’s curves. We select the points for the plot randomly from a rectangular array of points according to distance-dependent probability distributions. The right image we color according to her infamous meat dress.
![ListContourPlot of Lady Gaga ListContourPlot of Lady Gaga](http://blog.wolframalpha.com/data/uploads/2013/05/Screen-Shot-2013-05-29-at-8.44.46-PM.png)
Using the polygons from the left graphic and round corners, we obtain the following pebble-stone-like images.
![Pebble-stone-like images of Lady Gaga Pebble-stone-like images of Lady Gaga](http://blog.wolframalpha.com/data/uploads/2013/05/Screen-Shot-2013-05-29-at-8.45.25-PM.png)
Two more variations on Lady Gaga—cones and cylinders randomly placed along the defining curves embedded in 3D.
![More variations on Lady Gaga curve using cones and cylinders More variations on Lady Gaga curve using cones and cylinders](http://blog.wolframalpha.com/data/uploads/2013/05/Screen-Shot-2013-05-29-at-8.46.15-PM.png)
Next, we import the image of a feather.
![Feather image Feather image](http://blog.wolframalpha.com/data/uploads/2013/05/Screen-Shot-2013-05-29-at-8.47.30-PM.png)
By randomly re-coloring this feather, we can place colored feathers along line segments of the curve. The sizes of the feathers are determined by the size of the original curve segment.
![Colored feathers along line segments of the Lady Gaga curve Colored feathers along line segments of the Lady Gaga curve](http://blog.wolframalpha.com/data/uploads/2013/05/Screen-Shot-2013-05-29-at-8.48.28-PM.png)
![Colored feathers along line segments of the Lady Gaga curve Colored feathers along line segments of the Lady Gaga curve](http://blog.wolframalpha.com/data/uploads/2013/05/Screen-Shot-2013-05-29-at-8.49.15-PM.png)
We can make similar images for other curves, not just for people, and also for fictional characters (for example, for Tinky Winky).
Here is a 3D picture of Tinky Winky.
![3D image of Tinky Winky 3D image of Tinky Winky](http://blog.wolframalpha.com/data/uploads/2013/05/Screen-Shot-2013-05-29-at-8.49.50-PM.png)
And in the next image, we carry out an inversion on Tinky Winky.
![Inversion on Tinky Winky Inversion on Tinky Winky](http://blog.wolframalpha.com/data/uploads/2013/05/Screen-Shot-2013-05-30-at-12.58.05-PM.png)
![Inversion on Tinky Winky Inversion on Tinky Winky](http://blog.wolframalpha.com/data/uploads/2013/05/Screen-Shot-2013-05-29-at-8.51.01-PM.png)
Or we could use Miss Piggy.
![Miss Piggy curve Miss Piggy curve](http://blog.wolframalpha.com/data/uploads/2013/05/Screen-Shot-2013-05-29-at-8.51.47-PM.png)
And we can use the points from less densely sampled segments to make a Voronoi tessellation of the data.
![Voronoi tessellation of Miss Piggy Voronoi tessellation of Miss Piggy](http://blog.wolframalpha.com/data/uploads/2013/06/Screen-Shot-2013-06-04-at-4.34.21-PM.png)
![Voronoi tessellation of Miss Piggy Voronoi tessellation of Miss Piggy](http://blog.wolframalpha.com/data/uploads/2013/05/Screen-Shot-2013-05-29-at-8.53.34-PM.png)
Let’s contract Miss Piggy’s curves recursively.
![Contract Miss Piggy's curves recursively Contract Miss Piggy's curves recursively](http://blog.wolframalpha.com/data/uploads/2013/05/Screen-Shot-2013-05-29-at-8.54.28-PM.png)
![Contract Miss Piggy's curves recursively Contract Miss Piggy's curves recursively](http://blog.wolframalpha.com/data/uploads/2013/05/Screen-Shot-2013-05-29-at-8.54.40-PM.png)
And the next image interpolates between the curve points and the curve points mapped to the nearest point on a larger, all-enclosing circle.
![Interpolates between the curve points and the curve points mapped to the nearest point on Miss Piggy curve Interpolates between the curve points and the curve points mapped to the nearest point on Miss Piggy curve](http://blog.wolframalpha.com/data/uploads/2013/05/Screen-Shot-2013-05-29-at-8.56.04-PM.png)
Next, we will charge (electrically) Miss Piggy and calculate the resulting electric field from the charged discretized curve segments. Here is the electric field of a charged line segment.
![Charge (electrically) Miss Piggy Charge (electrically) Miss Piggy](http://blog.wolframalpha.com/data/uploads/2013/05/Screen-Shot-2013-05-29-at-8.59.16-PM.png)
These are the lines of equal field-strength magnitude.
![ListPlot3D of Miss Piggy ListPlot3D of Miss Piggy](http://blog.wolframalpha.com/data/uploads/2013/05/Screen-Shot-2013-05-29-at-8.59.50-PM.png)
Or, we can make use of a parametrization of Dilbert.
Here is Dilbert with spheres of radii that are proportional to the distance to the nearest curve points. The left graphic uses randomly placed spheres and the right graphic uses spheres with centers on a square grid.
![Parametrization of Dilbert Parametrization of Dilbert](http://blog.wolframalpha.com/data/uploads/2013/05/Screen-Shot-2013-05-29-at-9.00.45-PM.png)
Having a Dilbert curve at hand, what would be more natural than to unite it with a Hilbert curve, the well-known space-filling curve?
![Hilbert curve Hilbert curve](http://blog.wolframalpha.com/data/uploads/2013/05/Screen-Shot-2013-05-29-at-9.02.47-PM.png)
We imprint the Dilbert curve into the Hilbert curve by elevating the points near to the Dilbert curve.
![Imprint the Dilbert curve into the Hilbert curve Imprint the Dilbert curve into the Hilbert curve](http://blog.wolframalpha.com/data/uploads/2013/05/Screen-Shot-2013-05-29-at-9.03.40-PM.png)
And here is a logo curve transformed (pun intended) into a 3D plot.
![Logo curve transformed into a 3D plo Logo curve transformed into a 3D plo](http://blog.wolframalpha.com/data/uploads/2013/05/Screen-Shot-2013-05-29-at-9.04.35-PM.png)
There are many more real and fictional celebrities that we could sketch and modify. Here are three. We encode their names. Do you recognize them? Click here for the spoiler.
![Curves for fictional and real celebrities Curves for fictional and real celebrities](http://blog.wolframalpha.com/data/uploads/2013/05/Screen-Shot-2013-05-29-at-9.06.28-PM.png)
![Curves for fictional and real celebrities Curves for fictional and real celebrities](http://blog.wolframalpha.com/data/uploads/2013/05/Screen-Shot-2013-05-29-at-9.08.20-PM.png)
And here is a fictional character. Again, click for the spoiler.
![Fictional character curves Fictional character curves](http://blog.wolframalpha.com/data/uploads/2013/05/Screen-Shot-2013-05-29-at-9.09.01-PM.png)
Instead of drawing the curves, we draw many (about twenty-five thousand) osculating circles at points from the defining curves to obtain a natural bubble environment.
![Fictional character curve with osculating circles Fictional character curve with osculating circles](http://blog.wolframalpha.com/data/uploads/2013/05/Screen-Shot-2013-05-29-at-9.09.46-PM.png)
Yet another possible curve usage is the making of coloring pages. The next input implements the mapping of a randomly selected Pokémon figure into a polygon.
![Pokémon curves for coloring pages Pokémon curves for coloring pages](http://blog.wolframalpha.com/data/uploads/2013/06/Screen-Shot-2013-06-04-at-4.15.19-PM.png)
And here is a possible arrangement of Pokémon characters to be colored.
![Pokémon curves for coloring pages Pokémon curves for coloring pages](http://blog.wolframalpha.com/data/uploads/2013/05/Screen-Shot-2013-05-29-at-9.11.58-PM.png)
Some apply some unconventional coloring.
![Pokémon curves colored Pokémon curves colored](http://blog.wolframalpha.com/data/uploads/2013/05/Screen-Shot-2013-05-29-at-9.12.39-PM.png)
We’ve had our fun with people and fictional characters. But before having more fun with them in animations, let’s do some more mathematics related to curves. For example, we could use the curves to do a bit of complex analysis. Let’s start with a curve that approximates the letter π.
![Pi curve Pi curve](http://blog.wolframalpha.com/data/uploads/2013/05/Screen-Shot-2013-05-29-at-9.14.11-PM.png)
In the next graphic, we map the plane into the complex plane and plot the argument of the modular function inverse elliptic nome. The dense set of singularities on the natural boundary of analyticity of the inverse elliptic nome gives the intricate fine structure that we see along the outline of π.
![Map the plane into the complex plane and plot the argument of the modular function inverse elliptic nome Map the plane into the complex plane and plot the argument of the modular function inverse elliptic nome](http://blog.wolframalpha.com/data/uploads/2013/05/Screen-Shot-2013-05-29-at-9.15.13-PM.png)
Next, we form a rational function in z based on the Fourier series.
![Rational function in z based on the Fourier series Rational function in z based on the Fourier series](http://blog.wolframalpha.com/data/uploads/2013/05/Screen-Shot-2013-05-29-at-9.16.04-PM.png)
The rational function evaluated at z = exp(i φ) traces out the letter π. For z = R exp(i φ), we obtain different-looking curves. Similarly, rational functions and, after normalization, even polynomials could be used for people curves, shape curves… So, if we need polynomials for some curve applications, we can always construct them from the trigonometric sine sums.
![Plotting Pi curves Plotting Pi curves](http://blog.wolframalpha.com/data/uploads/2013/05/Screen-Shot-2013-05-29-at-9.16.43-PM.png)
In the next graphic we form a polynomial of degree 128 with simple roots along the outline of π.
![piZeroPoly piZeroPoly](http://blog.wolframalpha.com/data/uploads/2013/05/Screen-Shot-2013-05-29-at-9.17.57-PM.png)
Here is a plot of the curves of constant real and imaginary parts of the last polynomial.
![Plot of the curves of constant real and imaginary parts of piZeroPoly Plot of the curves of constant real and imaginary parts of piZeroPoly](http://blog.wolframalpha.com/data/uploads/2013/05/Screen-Shot-2013-05-29-at-9.19.08-PM.png)
Let’s carry out another complex analysis example. We know that with a conformal map, we can map any nice, single-connected region of the complex plane to the unit disk. And in many instances, a series approximation of the conformal map will give good results. For instance, here is the exact map that maps a square to a disk. It’s a bit complicated and contains Jacobi elliptic functions.
![squareToDiskMap squareToDiskMap](http://blog.wolframalpha.com/data/uploads/2013/05/Screen-Shot-2013-05-29-at-9.20.05-PM.png)
The series approximation is quite simple.
![Series approximation for squareToDiskMap Series approximation for squareToDiskMap](http://blog.wolframalpha.com/data/uploads/2013/05/Screen-Shot-2013-05-29-at-9.20.49-PM.png)
And visually, the series with only the two leading terms already gives a reasonable approximation of the map.
![Visualize series approximation for squareToDiskMap Visualize series approximation for squareToDiskMap](http://blog.wolframalpha.com/data/uploads/2013/05/Screen-Shot-2013-05-29-at-9.21.23-PM.png)
So, let us to try to find complex maps that map person A into person B. Because we cannot independently map the exterior boundaries and interior features, the mapping will definitely not be perfect. But watching the algorithm that tries to minimize the difference between person A and person B carrying out the conformal map on person A or B is entertaining at least. So we implement the finding of such a conformal map. Here are eight pairs of persons to be mapped.
![Complex maps that map person A into person B Complex maps that map person A into person B](http://blog.wolframalpha.com/data/uploads/2013/05/Screen-Shot-2013-05-29-at-9.22.55-PM.png)
![Complex maps that map person A into person B Complex maps that map person A into person B](http://blog.wolframalpha.com/data/uploads/2013/05/Screen-Shot-2013-05-29-at-9.23.18-PM.png)
![Complex maps that map person A into person B Complex maps that map person A into person B](http://blog.wolframalpha.com/data/uploads/2013/05/Screen-Shot-2013-05-29-at-9.23.30-PM.png)
![Complex maps that map person A into person B Complex maps that map person A into person B](http://blog.wolframalpha.com/data/uploads/2013/06/Screen-shot-2013-06-04-at-10.44.33-AM.png)
Let’s solve some partial differential equation calculations with the Newton curves to honor the co-inventor of differentiation. In preparation, let’s consider the 2D Fourier series of the curves that define Newton’s face, which we constructed in the last blog post.
![Isaac Newton curve Isaac Newton curve](http://blog.wolframalpha.com/data/uploads/2013/05/Screen-Shot-2013-05-29-at-9.25.46-PM.png)
We will rescale the curves to fit into [0,1] X [0,1] and use the (unnormalized) 2D Fourier basis functions ψk, m = sin(k π x) sin(m π y). Effectively, we want to approximate a Dirac delta function along the defining curves and the zero function anywhere else.
![Approximate a Dirac delta function along Isaac Newton curve Approximate a Dirac delta function along Isaac Newton curve](http://blog.wolframalpha.com/data/uploads/2013/05/Screen-Shot-2013-05-29-at-9.26.32-PM.png)
We calculate the 2D Fourier coefficients using numerical integration. We will calculate quite a few coefficients, namely 2002.
![Calculate the 2D Fourier coefficients on Isaac Newton curve Calculate the 2D Fourier coefficients on Isaac Newton curve](http://blog.wolframalpha.com/data/uploads/2013/05/Screen-Shot-2013-05-29-at-9.27.24-PM.png)
To assemble the Fourier approximations, we use a tensor product grid in the x,y plane for efficiency. The function xyArray takes an optional argument “FourierCoefficientMultiplicator” -> value that we will use in a moment.
![Assemble Fourier approximations for Isaac Newton curve Assemble Fourier approximations for Isaac Newton curve](http://blog.wolframalpha.com/data/uploads/2013/05/Screen-Shot-2013-05-29-at-9.28.32-PM.png)
This is the resulting Fourier approximation of the 2D curves shown in 3D.
![Fourier approximation of the 2D curves shown in 3D for Isaac Newton curve Fourier approximation of the 2D curves shown in 3D for Isaac Newton curve](http://blog.wolframalpha.com/data/uploads/2013/05/Screen-Shot-2013-05-29-at-9.29.18-PM.png)
The next plot shows how the (scaled) function values increase with an increasing number of Fourier modes taken into account. We see that we need many more Fourier coefficients for a good-looking image than we needed Fourier modes for the curves themselves.
![ListContourPlot3D with Isaac Newton curve ListContourPlot3D with Isaac Newton curve](http://blog.wolframalpha.com/data/uploads/2013/05/Screen-Shot-2013-05-29-at-9.30.00-PM.png)
Remembering the separation of variables method to solve partial differential equations, we can use the Fourier coefficients to straightforwardly obtain the time-dependent solutions of the wave equation and the heat equation. The above shown Fourier expansion is the initial conditions at t=0.
Here is the time-evolved version of Newton’s face under the wave equation. (We assume vanishing initial velocities everywhere.)
![Time-evolved version of Newton's face under the wave equation Time-evolved version of Newton's face under the wave equation](http://blog.wolframalpha.com/data/uploads/2013/05/Screen-Shot-2013-05-29-at-9.30.53-PM.png)
And here is the time-evolved version of Newton’s face under the heat equation–it seems most suited for Halloween.
![Time-evolved version of Newton's face under the heat equation Time-evolved version of Newton's face under the heat equation](http://blog.wolframalpha.com/data/uploads/2013/05/Screen-Shot-2013-05-29-at-9.31.56-PM.png)
And if Newton’s face were a microparticle and would obey the Schrödinger equation, then quickly the localized face would flow apart and after a short time would look so:
![If Newton's face were a microparticle and would obey the Schrödinger equation If Newton's face were a microparticle and would obey the Schrödinger equation](http://blog.wolframalpha.com/data/uploads/2013/05/Screen-Shot-2013-05-29-at-9.32.39-PM.png)
We now end our advanced calculus applications of the curves.
With a bit more effort, we can try to animate some of the curves instead of just constructing static images. For instance, we could take three closed curves and morph them. This is done here using a pig, a unicorn, and a yeti silhouette.
![Pig, unicorn, and yeti silhouette Pig, unicorn, and yeti silhouette](http://blog.wolframalpha.com/data/uploads/2013/05/Screen-Shot-2013-05-30-at-2.45.08-PM.png)
We first normalize the curve in size and then form the superposition chimera cpig curvepig + cunicorn curveunicorn + cyeti curveyeti.
![Pig, unicorn, and yeti silhouette Pig, unicorn, and yeti silhouette](http://blog.wolframalpha.com/data/uploads/2013/05/Screen-Shot-2013-05-30-at-2.45.29-PM.png)
![Pig, unicorn, and yeti silhouette Pig, unicorn, and yeti silhouette](http://blog.wolframalpha.com/data/uploads/2013/05/Screen-Shot-2013-05-30-at-2.46.36-PM.png)
![Pig, unicorn, and yeti silhouette Pig, unicorn, and yeti silhouette](http://blog.wolframalpha.com/data/uploads/2013/05/Screen-Shot-2013-05-29-at-9.34.52-PM.png)
Above we had fun with people’s faces; we used some curves to solve partial differential equations, so let’s now do some physics, especially mechanics.
Assuming a flexible Barack Obama, we could model the defining curves as discretized elastic springs with harmonic nearest neighbor forces. We also assume a coupling from the end of each line segment to the beginning of the next line segment (the complex-valued connections in the parametrizations). The resulting mechanical system is described by Newton’s equation of motion m X“(t)=F(X(t)), where X(t) is the vector of the positions of all the points on the curve segments. Of special interest for a mechanics class are the eigenmodes of the resulting mechanical system, generalizing the eigenmodes of the linear chain.
![Model the defining curves as discretized elastic springs with harmonic nearest neighbor forces Model the defining curves as discretized elastic springs with harmonic nearest neighbor forces](http://blog.wolframalpha.com/data/uploads/2013/06/Screen-Shot-2013-06-04-at-4.08.05-PM.png)
![Model the defining curves as discretized elastic springs with harmonic nearest neighbor forces Model the defining curves as discretized elastic springs with harmonic nearest neighbor forces](http://blog.wolframalpha.com/data/uploads/2013/05/Screen-Shot-2013-05-29-at-9.36.13-PM.png)
![Model the defining curves as discretized elastic springs with harmonic nearest neighbor forces Model the defining curves as discretized elastic springs with harmonic nearest neighbor forces](http://blog.wolframalpha.com/data/uploads/2013/05/Screen-Shot-2013-05-29-at-9.36.26-PM.png)
![Model the defining curves as discretized elastic springs with harmonic nearest neighbor forces Model the defining curves as discretized elastic springs with harmonic nearest neighbor forces](http://blog.wolframalpha.com/data/uploads/2013/05/Screen-Shot-2013-05-29-at-9.36.35-PM.png)
Or we can get a bit crazier with the animations: let’s marry two curves (each in its 2D plane) in 4D. First we select two shapes, say π and the hammer and sickle symbol.
![Marry two curves in 4D Marry two curves in 4D](http://blog.wolframalpha.com/data/uploads/2013/05/Screen-Shot-2013-05-29-at-9.39.14-PM.png)
Then we form a two-dimensional surface in a four-dimensional space. The four coordinates of the surface are {cπ,x(s),cπ,y(s), c hs,x(t), chs,y(t)}, where {cπ,x(s), cπ,y(s)} is the parametrization of the pi curve and {c hs,x(t), chs,y(t)} is the parametrization of the hammer and sickle curve. We then look at this surface by projecting it into a three-dimensional subspace specified by rotations in the four-dimensional space.
![Marry two curves in 4D Marry two curves in 4D](http://blog.wolframalpha.com/data/uploads/2013/05/Screen-Shot-2013-05-29-at-9.40.52-PM.png)
![Marry two curves in 4D Marry two curves in 4D](http://blog.wolframalpha.com/data/uploads/2013/05/Screen-Shot-2013-05-29-at-9.41.28-PM.png)
![Marry two curves in 4D Marry two curves in 4D](http://blog.wolframalpha.com/data/uploads/2013/05/Screen-Shot-2013-05-29-at-9.41.40-PM.png)
We could do something similar with two faces and amalgamate them into a Janus-type 4D object. The resulting surface will look quite intricate, and we encourage the reader to find some appropriate pairs of people to unit in higher dimensions.
We end today’s blog post with a curve that is nearly begging to be animated: Psy’s dance.
![Psy's dance Psy's dance](http://blog.wolframalpha.com/data/uploads/2013/05/Screen-Shot-2013-05-29-at-9.43.23-PM.png)
We do not go to great length with character animations here. Instead, we just rotate parts of his arms and legs at the elbow and knee joints. To achieve a more realistic Gangnam dance animation, we would have to add rotations around the hip.
![Psy's dance Psy's dance](http://blog.wolframalpha.com/data/uploads/2013/05/Screen-Shot-2013-05-29-at-9.44.07-PM.png)
![Psy's dance Psy's dance](http://blog.wolframalpha.com/data/uploads/2013/05/Screen-Shot-2013-05-29-at-9.44.18-PM.png)
![Psy's dance Psy's dance](http://blog.wolframalpha.com/data/uploads/2013/05/Screen-Shot-2013-05-29-at-9.44.40-PM.png)
In the next blog post in this series, we will look at laminae, meaning curves together with their insides. For their constructions, quite different mathematical techniques will be used.
To interact with the examples above, first, download the Wolfram CDF Player. Then, download this post as a Computable Document Format (CDF) file.
No comments:
Post a Comment