Function

What do you want to graph? Create a parametric function in JavaScript. Name it f(). For each input value t, between 0 and 1, f() returns a point like { x: 1, y: -0.08333333 }. You can do one time setup before defining f(). See the examples and additional instructions, below.

Inputs

You can access these sliders from inside your code. The name of each slider is written next to it in blue. The samples will update immediately as you move the slider.

Output

The first image shows your function tracing out the path. The second image shows how well each approximation matches the original. The table details the progress in the second image.

If you see a dark red or pink line, that means that there's a problem drawing the red line. If you see these extra lines, the normal solution is to ramp up the support.sampleCount.

Circles Amplitude
Using
Adding
Available

More Information

My take on the classic problem.

Complex Fourier Series

In this context “complex” means 2 dimensional. This page will convert any function into a series of circles, called a Fourier series. Add the circles back together to get the original function. Circles (or sines and cosines) are often essential because they easier to use than the original function.

This page lets you explore the Fourier series for a function. You can see how well the series approximates the original function, and how quickly it converges. And you can tweak the function and its parameterization to see the result.

The input to this page is a parametric function written in JavaScript. Your function takes one input, t, and returns a point. As t goes from 0 to 1, your function will trace out a path.

Different functions can trace out the same path. These are called different “parameterizations.” The small, light blue dot traces out the results of your function as t increases at a constant rate. The red dot always moves at a constant speed, as a point of comparison.

The “Square” and “Square with Easing” examples show two parameterizations of the same shape. The former uses the simplest parameterization where the small blue dot is always moving at a constant speed. In the latter example the blue dot slows down around each of the corners, like a physical object would have to, speeding up through the straightaways. The latter example converges faster than the former, perhaps because sharp corners are difficult for a Fourier series, and this function spent more time around those trouble spots.

References

JavaScript Support

You have access to all of JavaScript. You also have access to a variable called support which provides access to the following:

Examples