Wolfram Computation Meets Knowledge

Ducks on a Pond 3D Gifting with the Wolfram Language

Ducks on a Pond: 3D Gifting with the Wolfram Language

Last year I sent my wife, Julia, a 3D-printed heart pendant. Then I wondered what I should give to her as a birthday gift this year. More precisely, what should I build to express my love?

In my opinion, love is mutual and love is interactive. A couple can feel each other, take care of each other and affect each other. It is bidirectional, not just one way. Well… I don’t know much about love or how to visualize interactive love. But I do know there are plenty of interference phenomena in physics.

So, I am going to describe in detail how my new jewelry is mathematically designed and prototyped using the 3D-rendering features in the Wolfram Language.

Heart Shape

To start, I needed to download a heart curve—this first heart curve is dedicated to my first lady!—from Wolfram|Alpha or MathWorld:


Next, I set the parameter to 17 (unit: millimeter) to determine the overall size of the jewelry:


Then I used ImplicitRegion to fill the enclosed region. Unfortunately, I had to break the heart in pieces with BoundaryDiscretizeRegion for the sake of numeric computation:

firstHeartCurve =  ImplicitRegion

Wave Surface

Next, I used the code from “Wave Interference,” authored by Stephen Wolfram at the Wolfram Demonstrations Project, to create a visual effect of pond ripples with interference. This added dynamics to my final design.

This one-liner expresses the source of the wave with simplicity and elegance:


The patterns of the two sources of wave interference were exactly what I wanted to express. I carefully tuned the wave parameters, source position, amplitude and frequency so the waveform fit properly in the heart region:


Then I used ParametricPlot3D and RegionFunction to combine the wave surface and heart shape. This resulted in something that looks like a little swimming pond:

waveSurface = ParametricPlot3D

Key Roles

In China, the Mandarin duck (鸳鸯) symbolizes eternal love and companionship. Regardless of each individual bird’s versatile avian mobility, the couple never acts alone and always shares good times with each other when cruising in the pond or sky.

Mandarin ducks

To sculpt the duck with exact detail probably takes decades of training in fine art. Paul Abbott’s magic duck, from the 2010 Wolfram One-Liner Competition, reminds me of an effective minimalist representation of the same idea. The spherical-coordinates duck is lovely, and it’s now the joker card in the official Wolfram Language playing cards:

Joker playing card

I used the same code here and tuned the first parameter for the plot range to 0.1 instead of 0. The bird’s beak resembles the actual beak on the duck after this modification:


The eyeless duck, the result of a pure-math abstract shape, is coincident with one of Shakespeare’s best phrases: “love is blind.”


In very nerdy terms, the position and orientation of the two ducks are like the initial conditions for a pursuit curve problem. It is a combination of a 3D plot function and geometric transformation function on the 3D objects.

I generated the ducks from the parametric equations on parameterized spherical coordinates:

duckMale = SphericalPlot3D

Then I generated the basic graph element from the 3D objects:

duckMalePolygon = MeshPrimitives

I also adjusted the positions and directions of the ducks:

duckGraphics = Graphics3D

Finally, I attached the ducks to the wavy base. The actor and actress were ready!



After I refined the 3D model in an STL editor, I imported it back to the Wolfram Language to render the 3D version with some realistic lighting effects:

duckMale = CloudImport

I extracted the basic 3D objects:

duckMalePoly = MeshPrimitives

In an older version of Mathematica, the 3D graphics will probably look like this:


MaterialShading was introduced in 12.3. This powerful feature can quickly create a more metallic effect. In my particular case:

  • The male duck is more colorful in nature, so I gave it a golden coating. (It will seem shinier later.)
  • The female duck looks gray. In nature, female animals don’t usually appear as bright as males. I built the female duck in silver, and left it with high surface roughness and no polishing. Later, nature will take over, and the silver surface will oxidize and become darker.
  • The wave plate was made in silver as well, but polished to decrease roughness, until it had a mirror or water-surface reflection effect.

Clothing, camera and lighting were now ready:


Jewelry Prototype

Using a similar method and process described in my Wolfram Community post “Love Heart Jewelry I: 3D Printing of Parametric Region,” my jewelry was brought to life. Silver is a good material to present fluids, as the pattern of interference waves is clear and shining. It is very relaxing to see the duck couple play casually together with the wave:

Jewelry prototype

One more thing worth mentioning is the difference between traditional 2D jewelry and 3D jewelry. Traditional jewelry usually looks good from just one viewpoint, such as from the front. But 3D jewelry is full of love stories from all different viewpoints because the mathematically generated surface keeps the physics right and tight.

Jewelry pictures

Now only one question remains: what will I create for my wife next year?

Frederick Wu is a certified senior engineer and works at Shanghai Micro Electronics Equipment (Group) Co., Ltd. He started using Mathematica in 2000 and is an active member of the Wolfram Demonstrations Project and Wolfram Community. He is also the author of Manipulate at Mathematica, published by Tsinghua University Press in 2010.

Get full access to the latest Wolfram Language functionality with a Mathematica or Wolfram|One trial.


Join the discussion

!Please enter your comment (at least 5 characters).

!Please enter your name.

!Please enter a valid email address.

1 comment

  1. Amazing… Mathematica and Mathematics everywhere and for everyone