- Owlcation
*»* - Miscellaneous
*»* - Drawing Hearts on a Graphing Calculator

# Drawing Hearts on a Graphing Calculator

There are many ways to draw a heart on a graphing calculator, but the best technique is with either parametric equations or polar coordinate equations, since you can trace out the shape of symmetric heart with a single function. Parametric equations have the form {x(t), y(t)} and polar equations have the form r(θ).

It is also possible to draw a heart on a graphing calculator using rectangular coordinate equations of the form y = f(x). However, you have to piece together several different functions and figure out where they intersect. This is more work, and the results are not as smooth.

The TI-84 is the most commonly used graphing calculator, but these heart equations will work for any graphing calculator model, even an online graphing calculator. If you use an online graphing calculator, you can print your heart designs to make coloring pages, or save the images as a png, jpg or gif files. *No advanced mathematical knowledge is needed to draw these heart equations;* they are "plug-and-chug" ready to input on a graphing calculator. All you need to do is change the "Mode" settings to parametric or polar and possibly adjust the viewing window settings.

The heart graphs below were made using the free online graphing calculators FooPlot and Desmos, and equations I came up with by trial and error.

## Preliminary: Working With Your Graphing Calculator

To graph these equations, you need switch the default function entry method to parametric or polar coordinates. To switch it on a TI-84 graphing calculator, hit the "Mode" key and highlight "PAR" or "POL" on the screen, then hit enter and quit.

Now when you hit the "Y=" key to enter your equations, you should see X1T= and Y1T= for parametric coordinates, and r1= for polar. The "X,T,θ,n" key provides the independent variable you need to input the function -- T for parametric and θ for polar. Press the "Window" key change the range for T and θ; the defaults are 0 to 2π.

## Parametric Heart Equations: Basic Formulas

Click thumbnail to view full-sizeWith parametric equations, the x-coordinate and y-coordinate of every point on the curve is given by a function of another variable, usually called t. To make heart-shaped curves in parametric coordinates, x(t) and y(t) need to be periodic functions, such as trig functions. This ensures that the curve will close on itself. To make an upright heart, use equations of the form

x(t) = A*sin(t) + B*sin(2t) + C*sin(3t) + ...

y(t) = D*cos(t) + E*cos(2t) + F*cos(3t) + ...

where A, B, C, D, E, F, ... are some coefficients that can be positive or negative. If you play around with the coefficients you can get it to curve the way you want. Some examples of parametric heart equations are shown in the gallery above. You can vary the coefficients in these equations to see how the shape of the heart changes.

To make a heart with woven or spiralling effects, you need to include terms of the form sin[(p/q)t] and/or cos[(p/q)t], where p/q is a rational number that is not an integer. If you include these terms, you also need to change your viewing window so that t ranges from 0 to 2qπ. The default window setting is 0 ≤ t ≤ 2π.

To make a lopsided or asymmetric heart, include cosine terms in the equation x(t), and/or sine terms in the equation y(t).

## Polar Heart Equations: Basic Formulas

Click thumbnail to view full-sizeAs with parametric heart equations, polar heart equations also require periodic functions to ensure that the curve ends where it begins. To make an upright heart in polar equations, you should use equations with the basic trigonometric form

r(θ) = A + Bsin(θ) + Csin(3θ) + D*|cos(θ)| + E*cos(2θ),

where A, B, C, D, and E are numbers that can be positive or negative. If you vary the coefficients you will get different heart shapes.

To get a concave S-curving point like some of the hearts in the gallery above, the equation needs a term of the form |cos(θ)|^F, where F is some non-integer, for example, F = 0.5. The expression |cos(θ)|^0.5 is the same as the square root of |cos(θ)|. A variety of basic equations are shown in the heart equation gallery above.

## Special Effects Heart Equations in Polar Coordinates

Click thumbnail to view full-sizeTo make hearts with decorative effects, you have to vary the basic forms. For example, to trace out a woven heart, you need a term of the form sin[(p/q)θ] or cos[(p/q)θ], where p/q is a rational number that is not an integer. The larger the denominator q, the more threads in the weave. The larger the value of p, the tighter the weave. In order for your graphing calculator to trace out the full heart, you must set the θ window value to 0 ≤ θ ≤ 2qπ.

To make a heart with a jagged or fuzzy border, add terms of the form G*sin(nθ) or G*cos(nθ), where G is a relatively small compared to the other coefficients, and n is larger than 30.

To make a lopsided or asymmetric heart, insert terms of the form sin(even*θ) and/or cos(odd*θ), where "odd" and "even" are some odd and even integers.

The double heart in the last image is generated from the |sin(2θ)| terms included in the equation.

Play around with different equation forms to see what other kinds of interesting heart curves you can draw on a graphing calculator.

## Rectangular Coordinates Heart

To make a heart in rectangular or Cartesian coordinates, you need to patch together lines and arcs of curves, such as parabolas, circles, ellipses, or hyperbolas. The heart will look best if the straight line segments are tangent to the curves where they meet, thus you might have to use some calculus to figure out the right equation.

With a circular arcs, you don't need calculus to match up the various curves, you can use basic properties of circles. For example, if you draw a line from the center of a circle to the circumference -- a radius -- the tangent line at that point on the circumference is perpendicular to the radius.

Using this fact, you can make a simple heart by affixing two half circles to adjacent sides of a square, choosing the radius of the circles equal to the side lengths of the square. One example is shown in the image above, along with its five equations.

One tricky aspect of constructing hearts with rectangular coordinate functions is that a function can only pass through one y value for each x value. So if you are using circles, you have to separately enter the top and bottom halves. Another tricky part is figuring out what the radii of the circles should be and where the centers are. If you know the radius r and the center point (a, b), then the top and bottom halves of the circle are given by the equations

y upper = sqrt[ r^2 - (x-a)^2 ] + b

y lower = -sqrt[ r^2 - (x-a)^2 ] + b