Today is Valentine's Day. So, we are going to draw some hearts, and then send them all to our lovers. Of course, we are going to do it by coding and math. This is what we are going to accomplish today:
The outline of a heart is a path of points $(x,y)$, which are given by the following parametric equations:
for $-\pi\leq t\leq \pi.$. Here, $(x_c,y_c)$ is the center of the heart. You can change the location of the heart by changing $(x_c,y_c)$. We implement the above parametric equations in SIMO as a function like the following one:
Now, you can run the function above with center $(0,0)$ to produce the following heart. This heart has only 30 path points, and therefore is not very smooth. You can make it smoother by increasing the number of path points.
Next, we need to duplicate this heart many times with different centers $(x_c,y_c)$. The centers are in fact path points on a bigger heart. The first part of the following code generates path points of the bigger heart. We need to scale it up 10 times bigger than the normal heart. These path points will serve as the centers of the smaller hearts, which will be drawn in the for-loop. It loops through each of the path points of the bigger hearts, and each of them is the center point of a smaller heart.
If you run the above script, you will get the following:.
Finally, you can save the plot as an image using the menu on the plot in SIMO. Then, you can find the saved picture in the Photos app on your iPhone or iPad. You may want to do some editing like cropping and filters. Finally, you can send it to your lover! Happy Valentine's Day!