Visualizing the Fourier Series For Curves
Author
Mukilan Karthikeyan
Title
Visualizing the Fourier Series For Curves
Description
Visualizing the Fourier Series For Curves
Category
Essays, Posts & Presentations
Keywords
URL
http://www.notebookarchive.org/2019-08-0gjg3ug/
DOI
https://notebookarchive.org/2019-08-0gjg3ug
Date Added
2019-08-01
Date Last Modified
2019-08-01
File Size
279.87 kilobytes
Supplements
Rights
Redistribution rights reserved



WOLFRAM SUMMER SCHOOL 2019
Visualizing the Fourier Series For Curves
Visualizing the Fourier Series For Curves
By: Mukilan Karthikeyan
Mentor: Jermey Sttration-Smith
Introduction
Introduction
The goal of the project is to generate visualizations for how the Fourier series creates approximation of curves. The end result is a function that is able to generate two different graphics to show using circles to represent the trigonometric waves used in the Fourier series. A Fourier series in calculus is the summation of trigonometric waves in order to represent an approximation of a curve. Since the Fourier series uses trigonometric functions which are created by the rotation of a circle, it is possible to link together multiple rotating circles and recreate the curve.
Initial Attempts
Initial Attempts
Creating the Functions
Creating the Functions
I went through many iterations of my code an restarted on a new approach three times. The hardest part of this project was getting the information from the functions to be in a certain format so that it could be displayed in a cohesive manner. This issue rose form creating a generalized function that would work for most if not all scenarios.
Approach One
Approach One
At first I tried to create multiple helper functions to manipulate the information and create it modular. The code below takes in a radius list, frequency list, and the number of circles needed, and then creates the nested list that is used for the moving objects in the graphics. The function is then called multiple times (I at that time had not optimized by code to run quickly) and used them to create list of Graphics Primitives. This one of the more developed versions of this method where the user physically inputs the amplitude and radii of the waves used to generate the desired function.
Approach Two
Approach Two
Although the previous method works, it is hard to know exactly if you are creating the desired function, Which means that you need to know what the radii/amplitudes and frequency where before you used this function.Hence my second approach.This approach was more of a function that would be built as an addition to the previous method.The new addition included a function built around the inbuilt function "FourierSeries" that took in function, variable, and number of terms as inputs and returned the equation of the approximation of the function as complex numbers.I had to use the inbuilt function "ComplexExpand" to get the equation in terms of Sine and Cosine.If the input function was even, then the Sine terms would cancel, and if the function is odd, then the Cosine terms canceled out.
Function Definitions
Function Definitions
I have two different categories of functions with pairs of functions in each category; One function works for even functions while the other works for odd ones. Both functions work in a very similar manner and the only difference is that the occurrences of sine and cosine are reversed.
The Different Frequencies
The Different Frequencies
I used a pair of functions called “FourierCosCoefficient” and “FourierSinCoefficient” in order separately get the radii of the circles. Then the many variables are used to artificially stitch together the coefficients and the frequencies; the code is using a discrete Fourier Transform, thus allowing me to artificially generate the frequencies used. Then the artificially generated Fourier series is used to generate coordinates. In the beginning I had the x coordinates to be in terms of Cosine and y coordinates in terms of Sine which caused the rotating parts to move in the counter clockwise direction. This function then creates individual moving plots which are then combined with the circles through the “Show” function to give the illusion that the circles are creating the plots.
The Reason For the Function Names
The Reason For the Function Names
Code Even Functions
Code Even Functions
Code Odd Functions
Code Odd Functions
Circle Chains
Circle Chains
The Final Function
The Final Function
Some Example Tests
Some Example Tests
In[]:=
fourierCircleCookBook[x^2,x,5]
In[]:=
fourierCircleCookBook[Sin[x]+2Sin[3x]+3Sin[6x],x,10]
In[]:=
fourierCircleCookBook[Sin[x],x,1]
In[]:=
fourierCircleCookBook[x^3+x^2,x,5]
Extension Development
Extension Development
Non circle chain (unblended circles): In Development


Cite this as: Mukilan Karthikeyan, "Visualizing the Fourier Series For Curves" from the Notebook Archive (2019), https://notebookarchive.org/2019-08-0gjg3ug

Download

