# Implicit plotter

Plotting solutions of implicit functions is not trivial. Yet, it is the most general way of plotting things, since all functions can be written in the implicit form .

Try typing any function into the text input above and it will plot . If you wanted to plot , just type in since the equal sign is not supported. Any JavaScript function of variables x, y would work, even Boolean-valued ones (such as inequalities). Common functions such as sin, cos, tan, exp, pow, min, max, abs, log, atan, asin, acos, atan2 are supported. The pipe | is interpreted as absolute value. For better speed, do exponentiation using pow instead of ^. Please note that this uses Function in JavaScript, meaning that whatever you type into that text input will be executed as JavaScript on your browser, so be careful not to paste suspicious code into it.

# 1Implementation details

I implemented this recursive subdivision implicit plotter using random sampling. It works by randomly sampling points to test if there are points where as well as in a square region. If so, it subdivides the region into four quadrants and continues. This program plots solutions in the square and . White areas are likely not to contain solutions, orange areas can possibly contain solutions, and blue areas definitely contain solutions. This demo is implemented in JavaScript using Web Workers to divide the computation among four threads, and may not work on old or inferior browsers.

The advantage of using random sampling is that, with high probability, it will converge towards the correct plot of arbitrary pathological functions. The disadvantage is that it is slow and we are never sure if it is actually correct.

This plotter does not test for divergence, so it cannot distinguish between diverging asymptotes and zeros.

# 2Examples of interesting functions FIGURE 1 , a pathological function that oscillates extremely rapidly in the “checkerboard” regions. Most software such as Wolfram Alpha struggle with plotting this.