Tell me more ×
Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

It's not really a typical math question. Today, while studying graphs, I suddenly got inquisitive about whether there exists a function that could possibly draw a heart-shaped graph. Out of sheer curiosity, I clicked on Google, which took me to this page.

The page seems informative, and I am glad to learn certain new things! Now I am interested in drawing them by my own using Mathematica. So my question is: is it possible to draw them in Mathematica? If yes, please show me how.

share|improve this question
The following links may be useful to you: xahlee.org/SpecialPlaneCurves_dir/Cardioid_dir/cardioid.html demonstrations.wolfram.com/… There is also a differential geometry with mathematica book you may want to look up if the links don't give you what you are looking for. – WWright Nov 27 '10 at 19:41
1  
Duck-shaped heart: SphericalPlot3D[Log[u] + Sin[v], {u, 0, 2 Pi}, {v, 0, 2 Pi}] – Yaroslav Bulatov Nov 28 '10 at 2:22

5 Answers

up vote 14 down vote accepted

For the fifth function in the link you mentioned (which I thought it was the most similar to a heart):

PolarPlot[(Sin[t]Sqrt[Abs[Cos[t]]])/(Sin[t]+7/5)-2Sin[t]+2, {t, 0, 10}]

Similarly, using W|A:

alt text

share|improve this answer
3  
Now that's love – bobobobo Nov 27 '10 at 20:05
By the way, I couldn't paste the address to W|A into a link (maybe some character is breaking the <a> tags). However, the same code for Mathematica works in W|A. – Robert Smith Nov 27 '10 at 20:44
1  
For links to WA you have to replace the square brackets with parenthesis – belisarius Feb 28 '11 at 4:23
Like this wolframalpha.com/input/… – belisarius Feb 28 '11 at 4:26
@belisarius: I didn't know that. Thanks :-) – Robert Smith Feb 28 '11 at 5:24

You can plot the Taubin's heart surface using ContourPlot3D

ContourPlot3D[(2 x^2 + y^2 + z^2 - 1)^3 - (1/10) x^2 z^3 - y^2 z^3 == 0, {x, -1.5, 1.5}, {y, -1.5, 1.5}, {z, -1.5, 1.5}, Mesh -> None, ContourStyle -> Directive[Red, Opacity[0.8]]]

I would post a image but it won't let me because I don't have reputation.

EDIT:

alt text

share|improve this answer
1  
+1, it's excellent. – Quixotic Nov 28 '10 at 10:12

Consider the map $T \colon \mathbb R^2 \rightarrow \mathbb R^2, \ (x,y) \mapsto (x, y+ \sqrt{|x|})$. With a little examination, you can see that this will define a warping on the plane that will map the unit circle to a heart shaped curve: alt text

So if you know that a parametrization for the circle is $(\cos(t),\ \sin(t)),\ t\in [-\pi,\pi]$, then the parametrization for its heart-shaped image would be $(\cos(t),\ \sin(t) + \sqrt{|\cos(t)|}),\ t\in [-\pi,\pi]$. You can plot the curve with the following Mathematica code:

ParametricPlot[{Cos[t], Sin[t] + Sqrt[Abs[Cos[t]]]}, {t, -Pi, Pi}]
share|improve this answer

A somewhat late addition (I only found my yellowed notebooks containing these just now):

$$\left(2(1+\cos\,\varphi)\sin^3 t\qquad 2\cos\,\theta\;\sin^2 t \sin\,\varphi+\sin\,\theta\cos\,t\left(\cos\,2t-2\cos\,\varphi\;\sin^2 t-3\right)\right)^T$$

is a two-parameter family of curves that generate heart shapes for some values of $\theta$ and $\varphi$. They were derived from projections of a skewed version of the nephroid.

Here for instance is the case $\theta=\pi/4,\quad \varphi=\pi/2$:

heart

share|improve this answer

This is really about plotting polar plots, parametric plots and implicitly defined functions in Mathematica.

This is the info on how to draw polar plots

http://mathworld.wolfram.com/PolarPlot.html

Parametric plots

http://reference.wolfram.com/mathematica/ref/ParametricPlot.html

This provides info on implicit plots

http://grosz.math.txstate.edu/~dhaz/prob_sets/LTs09cal1lab8.pdf

share|improve this answer
Am not getting how to plot the second and third graph in that page. – Quixotic Nov 27 '10 at 19:25
@Debanjan: Second is just an implicit plot, check out the link in my answer. Third is a parametric plot, reference.wolfram.com/mathematica/ref/ParametricPlot.html – Timothy Wagner Nov 27 '10 at 19:30

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.