Heart Curves

by Undome Tinwe

Rating: teen
Tags: Rarity, Romance, Slice of Life, Alternate Universe, Human, Twilight Sparkle, My Little Pony: Friendship is Magic
Length: 4434

Twilight tutors Rarity on polar coordinate systems and parametric equations.

Twilight tutors Rarity on polar coordinate systems and parametric equations.

Pre-requisites: first-year college calculus or equivalent (basic knowledge of functions and derivatives).

Published 2020-08-17 20:40:00 UTC
Last updated 2020-08-17 20:40:00 UTC

Expressions of Love

"Twilight Sparkle, what is the meaning of this?" Rarity demanded as she was led into the bedroom. "You should know very well that I am not that kind of lady."

Twilight rolled her eyes as she set down her backpack. "This is what you asked for, right? When you said you wanted to go somewhere private where we could be just the two of us?" She reached into her bags and pulled out a large white book.

"Yes, so that we could enjoy one another's company," Rarity retorted. "Not engage in other acts."

A sigh slipped out from between Twilight's lips. "Rarity," she said patiently. "You missed today's calculus lecture because of that fashion seminar, and it's hard to catch up once you start falling behind. It's important that you understand the material from the lecture."

"Well, excuse me for wanting to spend some time with my girlfriend doing something fun," Rarity huffed, crossing her arms and pouting.

Twilight smiled and set down the book on a nearby table. "Learning is always fun!"

"Only you would say something of that sort and mean it with all your heart." Despite the teasing, a smitten smile played on Rarity's lips. "Very well, if Fate has ordained that I must love such a dutiful student, then who am I to refuse her whims?"

"It's just a lesson on representations of functions." Twilight reached out and wrapped her arms around her girlfriend, part of her still revelling in awe at how it was appropriate for her to do so, when not even six months ago she could only dream of sharing a moment like this with her. "We can go do your type of fun afterwards."

Delight and mischief sparkled in Rarity's eyes. "I'll hold you to that, my darling dearest."

They shared a quick kiss that made Twilight's heart flutter for a moment before she tamped down hard on her feelings and focused on the task at hand. "Alright, so the lecture today covered alternative methods for representing phenomena that don't fit well into the types of functions we've learned so far."

Rarity groaned. "Wonderful. The one lecture I miss and we get introduced to something completely different than what we've been studying all semester."

"Don't worry," Twilight replied, "it's not as different as it'll seem at first, and a lot of the existing stuff we've learned still applies. I'll be there to walk you through every step." She grasped Rarity's hand and placed it on the open textbook.

"Of course." Their hands lingered together for a moment before Rarity smiled. "There's no finer mind in the world that I would entrust my education to. After all, I've already entrusted my heart into your keeping, no?"

"Remind me to ask you for help next time I have a literature assignment due," Twilight teased back.

"It would be my pleasure," Rarity replied. "Now, shall we begin this lesson so that I can show you just how much I love my girlfriend afterwards?"

A thoughtful expression crossed Twilight's face as she considered Rarity's words. "Hmm, I don't see why we can't do both," she said, a knowing smile playing at her lips as inspiration struck. "I think you'll find this lesson pretty fun once we get going." She took out her pad of graph paper and wrote out two sets of equations on them.

The first looked simple enough, though Twilight knew Rarity would not know what the variables represented:

r = 1 - \cos(\theta)

The next would look more familiar, but be oddly split, and she couldn't wait to explain how this one worked to Rarity.

\begin{eqnarray} x & = & 16 \sin^3 t \\ y & = & 13 \cos t - 5 \cos(2t) - 2 \cos(3t) - cos(4t) \end{eqnarray}

She showed her creations to Rarity, who stared at them with a puzzled expression. "The first equation looks simple enough, though that is an odd choice of variable names. As for the others, I didn't think we were covering three-dimensional calculus so soon?"

"We're not, and the variable names are very deliberate," Twilight replied. "Sometimes, it doesn't make sense to model something using a Cartesian coordinate system — that is, using xy-coordinates — when another formulation makes the math a lot easier.

"Sometimes, it makes more sense to talk about the position of something relative to a central point. Like, say we're dancing." A pause as Twilight reconsidered her words. "Okay, let's say you're dancing — since my dancing is better modelled by Brownian motion — and doing one of those really graceful pirouettes you like to do so much."

"You enjoy them too," Rarity pointed out. "Don't think I don't notice your eyes on me, dear."

Twilight shrugged. "It's socially acceptable for me to admire my girlfriend, and I intend to make full use of that privilege. Anyways, so during a pirouette, you have one centre point that basically remains constant while you spin. Now, if I wanted to describe the pattern traced out by your centre of gravity relative to that stationary point, then I could write it in terms of some complicated equations with x and y of the form f(x,y) = g(x,y), which might be very difficult to work with. But with the right reformulation, you can make the expressions much more tractable."

She took out her pen and began drawing a pair of axes on the paper. "In real life, we rarely give locations using an absolute set of rectangular coordinates. Where would you say the physics library is relative to our current location?"

"Dear, not all of us have memorized the exact location of every single library on campus," Rarity said dryly.

"The closest hairdresser's, then," Twilight asked instead.

Without hesitation, Rarity immediately replied, "Sassy's is half a mile south-east of here, down Meadowbrook Lane."

"And you say I have unhealthy fixations," Twilight muttered under her breath. "Okay, so, do you notice what two values you used to specify the relative location?"

Instead of an answer, Twilight felt warm lips press against her cheek. "My love," Rarity said as she pulled away, leaving Twilight feeling warm and fuzzy. "As much as I appreciate your approach, I would like to be done with this lesson in a reasonable amount of time."

"Fine," Twilight grumbled, though it was hard to be annoyed at Rarity when she was pressed against her. She marked a point on the grid and drew a line towards it, labelling it as followed:

"There," she said, pointing to the diagram. "A lot of the times, we give locations in terms of distance and direction, or angle, from a central point. We can do the same in math, and we usually denote the distance as r and the angle as \theta. For example, consider the point (r,\theta) = (0.5, \pi/4). This represents a point 0.5 distance away from the centre at a 45 degree angle:"

"From there, we can start writing functions in terms of these two variables:"

r = f(\theta)

"And we can plot points in the same was we could for y=f(x) where we plug in various values of \theta and compute the values of r to plot."

Twilight paused to give Rarity the chance to absorb everything. "So instead of moving from left to right when plotting a function, we move around in a circle?" her girlfriend asked, and Twilight's heart leapt at how well she was following along.

"Exactly!" she said, nodding enthusiastically. "So, if you have something like this, how would you go about plotting it?" She wrote down another equation.

r = 1 + \frac{\theta}{\pi}

Rarity stared the equation for a second before taking the pen from Twilight's hand, their fingers brushing together and sending an electric thrill down Twilight's spine.

"Well, one should start at the beginning, no?" Rarity said, writing down the first expression. "As in our previous lessons, if I compute a few points, the pattern should become clear."

"Very good!" Though Rarity always denied it, Twilight knew how much she enjoyed being praised by her, and took the opportunity to enjoy the light blush staining her cheeks in response to her words. "You definitely have the right idea. So, what sample values do you think would be good to pick?"

"Since these are angles, I suppose I could try going up 45 degrees each time at first," Rarity mused.

"That works," Twilight replied. "Remember that you're using radians here, though."

"Ah, of course." Rarity bit her lip as she scribbled down some conversion factors. "So that would be... increasing by \pi / 4 each time?"

Twilight nodded. "Exactly."

In short order, Rarity had written out the list of points to plot: (1,0), (5/4,\pi / 4), (3/2,\pi / 2), (7/4,\pi / 4), (2,\pi), (9/4,5\pi / 4), (5/2,3\pi / 2), (11/4,7\pi / 4), (3,2 \pi)

She paused as she reached the last number. "Hmm, 2\pi and 0 are the same angle, are they not? Isn't the rule of functions that each value must be unique?"

"Yup." A grin spread out across Twilight's face. "That's a very good observation. Usually, we bound the range of values for \theta as either between -\pi and \pi or between 0 and 2\pi to prevent this issue. However, there's technically nothing wrong with having the values overlap since you still have a unique value of r for every value of \theta, even if it represents the same angle. For now, let's define the domain of \theta as [0,2\pi). Now, how do you plot these points?"

"The first value in the pair are the distances, and the second are the angles." Rarity grinned smugly. "I do know how to work with such numbers, given my line of work."

It always surprised Twilight how good Rarity's geometric intuition was. Her work in fashion allowed her to approximate angles and distances very well, and in short order, without the aid of a ruler, she had drawn out the points in question.

Her eyes lit up in recognition of the shape being produced. "Of course," she whispered, "if you move farther out from the centre as you rotate, then that creates a spiral!" With a graceful flourish, she drew the full function.

Clapping would probably have been a bit too patronizing, but Twilight still gave Rarity a hug because she could. "I knew you'd be a natural at this," she said. "Okay, why don't we try this one now?"

r = 1 - \cos(\theta)

"Hmm," Rarity said. "What should the domain of \theta be here?"

Twilight grinned playfully. "Does it matter?"

"Whatever do you mean, darl— oh!" A look of surprise crossed her face. "The angle only appears in the cosine, so it must repeat itself with every rotation!"

"Exactly! Though, just because the angle is inside the cosine or sine terms doesn't mean it's periodic like this. For example, consider: r = 1 - \cos(\frac{\theta}{3}). What happens when you plug in \theta=0 and \theta=2\pi?"

"Well, \cos(0) and \cos(\frac{2\pi}{3}) aren't the same, so I see your point," Rarity said.

"Right, so what would be the condition so that you only need to do one cycle?" Twilight asked.

Rarity took a moment to think about her answer. "The distance would have to be the same when the angle is 0 and 2\pi?" she finally guessed.

"That's a necessary condition, but not sufficient," Twilight replied. "Like, it has to be true for, say, \theta=\frac{\pi}{2} and \theta=\frac{5\pi}{2} too. Or \theta=\pi and \theta=3\pi." She waited a moment to see if Rarity would pick up on the pattern.

After a few seconds of thought, she suddenly perked up. "Oh, the value needs to be the same when you add 2\pi!"

"It needs to be periodic with a period of 2\pi, yes," Twilight said. "So, back to the equation. There's another trick here that we can use to make this easier to plot. Do you remember the trigonometric identities for cosine with negative angles?"

"Do you mean the one where the cosine of an angle is equal to its negative, dear?"

"Yup," Twilight replied, writing out the equation. "\cos(\theta) = \cos( - \theta). And if the value is the same for positive and negative angles, then that means..."

"The top and bottom are reflections of one another!" Seeing Rarity's excitement lifted Twilight's heart, and she took a moment to appreciate the combination of a teacher's satisfaction and a lover's joy at seeing their beloved grow. "So we only need to plot half of the values."

"And what would the general pattern of that look like?"

Rarity began drawing a new set of axes as she spoke. "The cosine is 1 when the angle is 0, and -1 when the angle is \pi. We're subtracting, so this means that the distance increases as the angle does, starting at 0 and ending at 2. I suppose this is another spiral, then?"

"For the first half, yes." Twilight grabbed the pen and began drawing. "This one's hard to get exactly without computing a bunch of points, so I'll just draw out the first half for you and you can complete it." Butterflies fluttered in her stomach as her hand struggled to stay steady. Would Rarity find this corny? She would probably find it corny and cliched and trite. It was dumb.

She was committed, though. Her shaking hand traced through the shape despite her doubts, and when she lifted it up, her breath stilled in her throat as she waited for Rarity to realize what she'd done.

Rarity's eyes widened as she no doubt completed the shape in her mind. "Twilight, is that a—?"

"It's called a cardioid," Twilight quickly explained, trying to hide her insecurity with a rapid-fire lecture. "It's called that because it kinda looks like a heart, or at least the popular symbol for one, which doesn't actually looks all that much like a human heart. Actually, this isn't even that great of a heart— you can do a lot better with parametric equations, or even just a simple conic-section style expression."

She paused to take a breath, and waited for Rarity to awkwardly move the conversation along. This had been a stupid idea. All she had to do was teach the lesson to Rarity and then she could let Rarity make the grand romantic gestures, instead of trying to improvise one herself and looking like a fool.

Instead of looking uncomfortable, though, Rarity's smile lit up the room as a playful fire lit her eyes. "Oh? Miss Sparkle, are you asking me to join half of your heart to mine?"

"It's really corny, I know," Twilight said, bowing her head in shame. "You don't have to if you don't want to."

A finger brushed against her chin before firmly lifting it up so that she was forced to look her girlfriend in the eyes. "Twilight," Rarity said firmly. "I think it's a wonderfully creative way to express our love, and one that's uniquely yours."

"R-Really?" It was hard to shake the belief that Rarity was just sparing her feelings, and Twilight's doubts still dwelled in her heart, weighing it down.

"Darling," Rarity said, the utter sincerity and love in her eyes drilling deep into Twilight's soul, "I love you, because of who you are, and this gesture is exactly the sort of thing that led me to fall for you in the first place. I adore the brains behind your beauty, and how you see things the rest of the world is blind to. Never lose that, my love."

It was impossible not to believe her words when they were spoken with such passion, and Twilight allowed herself to smile. "Heh, I guess you could've had anyone on campus, but you picked me."

"And don't you ever forget that, dear," Rarity said playfully. "Now then, shall we?" She picked up her pen once again, and with a single stroke, completed the cardioid.

Twilight felt something settle in her heart as Rarity lifted the pen, a completeness that left her feeling fulfilled and loved. "Perfect," she said. "You're picking this up really quickly."

"I have a wonderful teacher," Rarity teased before leaning in for a kiss.

"Only the best for a wonderful student," Twilight teased back when they broke apart again. "Okay, so, here's the next part of the lesson: switching back to rectangular coordinates. If I give you a point in polar form, how would you determine the x and y coordinates of it?"

Rarity looked back at the old diagrams from the beginning of the lesson. "If we have an angle and a distance, we can always model this as a right-triangle, no?" She added some extra markings on the picture.

"Right, and then?" Twilight asked.

"If I recall my identities correctly, then we should have x = r \cos(\theta) and y = r \sin(\theta)."

"That's exactly it. Good job, Rarity." Twilight wrote out the equation of the cardioid again.

r = 1 - \cos(\theta)

"So, with this equation, we can plug in the value r into the expressions to get:"

\begin{eqnarray} x & = & (1 - \cos(\theta))\cos(\theta) \\ y & = & (1 - \cos(\theta))\sin(\theta) \end{eqnarray}

"Oh my," Rarity murmured as she squinted at the equations. "That's quite unwieldy. And you still haven't removed the angle from the expression."

"I haven't," Twilight admitted, "and you're right that it's really messy. This is why we use different coordinate systems to represent different things, because sometimes it's a lot easier in one system than another. And what we have now is an example of a parametric system of equations, because there's a parameter \theta here that defines both values. And by plugging in different values of theta, we can get a series of (x,y) points that let us graph the full curve. As a simple example, consider this set of equations:"

\begin{eqnarray} x & = & 1 + t \\ y & = & -t \end{eqnarray}

"What happens when you increase the value of t by one unit?"

"Well," Rarity replied, "the value of x would increase by one, and the value of y would decrease by the same amount."

"And that means that if I were to calculate all the possible points generated by this system, what shape would I get?"

"A line?" Rarity guessed.

Twilight nodded. "A line, yes. Most of the time when we use parametric equations, we also want the parameter to mean something. So if we let t be time, this can represent a trend where something is going up, and something else is going down." She quickly sketched out the function to illustrate her point.

"Now, let's go back to the equations at the beginning. We can also write x and y in function notation— that is, as x(t) and y(t)— to make it easier to talk about them sometimes, like this:"

\begin{eqnarray} x(t) & = & 16 \sin^3 t \\ y(t) & = & 13 \cos t - 5 \cos(2t) - 2 \cos(3t) - cos(4t) \end{eqnarray}

She still felt a little nervous about what she was asking Rarity to do, but Rarity's earlier talk had burned away a lot of her reservations, so she chose to go through with her plan. "Why don't you try plotting this one out for t \in [0,2\pi]?"

"Very well." Rarity picked up the pen and began studying the equation. "Since these are all trigonometric functions, I daresay there might be some form of symmetry that may help."

Twilight kept quiet, waiting for Rarity to figure it out herself despite her own urgent need to blurt out the answer and praise Rarity for being such a quick learner.

Soon enough, she was rewarded by Rarity's expression brightening. "Ah, we have the same pattern for y from before where t and 2\pi - t yield the the same value for y, but we have that the value of x for t is the negative of that value when the parameter is equal to 2\pi - t. Which means that the image is reflected on the y-axis!"

Rarity beamed at her discovery, causing Twilight to smile in response. "Wow, you're really picking up on this quick," She said, writing down in equations what Rarity has just said:

\begin{eqnarray} x(t) & = & -x(2\pi-t) \\ y(t) & = & y(2\pi-t) \end{eqnarray}

"Are you sure you don't want to switch to a science major?" she asked afterwards with a smirk.

An emphatic shake of Rarity's head was her response. "I think this is quite enough for now, thank you very much. So, I suppose the next step will be rather tedious?"

"It's good practice." There wasn't really much more to say before Rarity began painstakingly plotting out points on the curve. It took her about two-thirds of the way through before she realized what she was drawing and tried to hide her smile. When she finally finished, she connected all the points on the right side and showed her work to Twilight:

"Well, Miss Sparkle, would you care to complete the other half of my heart?" she asked, and Twilight's grin grew so wide it hurt.

"It would be my pleasure," she replied with a giggle, picking up her pen and drawing the remainder of the curve.

"There, now the two halves of our hearts are one," Rarity said, sighing contentedly. "I love you, Twilight Sparkle."

"I love you too, Rarity," Twilight replied, snaking one arm over to embrace her girlfriend. They held each other for a few moments, basking in their love and mutual admiration for one another before Twilight regretfully disentangled herself from her. "We're almost done now. One last thing?"

"Oh? And what's that?" A similar regret was reflected in Rarity's eyes, but she soldiered on regardless with somewhat lessened enthusiasm.

"Finding the slope of the curve at a given point," Twilight said. "So, we know that the slope is equal to the derivate \frac{dy}{dx}, but since x and y aren't directly connected, we need to use the chain rule:"

\frac{dy}{dx} = \frac{dy}{dt} \frac{dt}{dx}

"And in order to get \frac{dt}{dx} we can use the fact that:"

\frac{du}{dv} = \frac{1}{\frac{dv}{du}}

"Therefore, we have:"

\frac{dy}{dx} = \frac{dy}{dt}\frac{1}{\frac{dx}{dt}} = \frac{dy/dt}{dx/dt}

"So for the heart curve, the slope is:"

\frac{dy}{dx} = \frac{dy/dt}{dx/dt}

\frac{dy}{dx} = \frac{-13 \sin(t) + 10 \sin(2 t) + 6 \sin(3 t) + 4 \sin(4 t)}{48\sin^2(t)\cos(t)}

"And at, say t=\pi/4, we can say that the slope is:"

\frac{dy}{dx} = \frac{-13 \sin(\pi/4) + 10 \sin(\pi/2) + 6 \sin(3\pi/4) + 4 \sin(pi)}{48\sin^2(\pi/4)\cos(\pi/4)} \approx 0.298

"I see," Rarity said. "That seems simple enough, as long as one treats the derivatives as if they were fractions."

Twilight winced at that. "It's... probably fine to do that for a lot of things," she reluctantly said, "but they really aren't fractions, and trying to use a trick like that is going to mess you up at higher levels. But, I guess if you don't plan on going much further, it's fine." She would take the victories she could get, and try not to think about how many students were abusing notation in the name of convenience.

"Pragmatism has its uses, dear," Rarity said. "So, is that all?"

Twilight nodded. "Yeah. There's questions in the problem set that will help you get a better intuition for these representations, but that covers all of the concepts. Good job understanding all of it."

"As I said, you do a wonderful job at teaching." Rarity's expression grew serious. "I really must thank you for this, dear. I appreciate the effort you make for me, and everything you've done without asking for anything in return. It's quite generous of you to offer your time like this."

Now it was Twilight's turn to blush. "It's nothing, really," she said softly. "I enjoy spending time with you, and I'm always happy to teach."

"And I must say I'm quite enjoying being your student," Rarity replied. "I know what some of the others say about my academic abilities, and I'm grateful that you never condescend to me during your lessons. You make me feel as if I'm actually capable of mastering this material."

"You are!" Twilight said sincerely. "Anyone who says otherwise has no idea what you're really like. And you've done a lot to help me get out of my shell too!"

"Thank you for the vote of confidence, dear." Mischief glinted in Rarity's eyes. "And now that we've finished the lesson, shall we adjourn to the bed and engage in other romantic activities?"

Twilight raised an eyebrow. "What did you have in mind?"

"Oh, I just picked up the new Daring Do book and I was wondering if you'd like for us to read it together?" Rarity said casually, and then laughed as Twilight immediately squealed with joy.

"Really? Where is it?"

Rarity stood up and walked towards her bags. "Over here, my love," she said, withdrawing the book and walking over towards the bed. "Now, let's see if I can find my own way into your heart."

Author's Note

As some of you might know, I have an interest in edutainment aimed at an older audience. It's recently occurred to me that one could use a slow-burn College AU romance setting to deliver the entire contents of a university course in the shape of a shipfic, and I've been playing around with that possibility. This is a bit of a test run, to see what kind of difficulties one might encounter when trying to write such a fic, and I will say that it's been a good learning experience.

For one thing, if I do go through with the idea of a longfic, it probably won't be for an introductory calculus course, since a lot of that topic is mechanical/algorithmic and boring. I'm thinking algorithmic analysis/complexity might be a good topic, but fimfic doesn't really have a good way to format algorithms. Another possibility would be to shift over into physics and try a course on electromagnetism, which has a good mix of math and concepts, but it's been quite a while since I've studied that topic, so I'd likely need a refresher myself. Regardless, I hope you all enjoyed this fic and if you have any suggestions as to what might be an interesting course, or if you'd like to see a similar one-shot on a different topic you're struggling to be interested in without it being taught by Twilight Sparkle, please let me know in the comments!