# 3D Surface Plotter

This demo allows you to enter a mathematical expression in terms of x and y. When you hit the calculate button, the demo will calculate the value of the expression over the x and y ranges provided and then plot the result as a surface. The graph can be zoomed in by scrolling with your mouse, and rotated by dragging around. Clicking on the graph will reveal the x, y and z values at that particular point.

The table below lists which functions can be entered in the expression box.

Expression | Description |
---|---|

sin(x) | The sine of x in radians |

cos(x) | The cosine of x in radians |

tan(x) | The tangent of x in radians |

asin(x), acos(x), atan(x) | The inverse of the three trigonometric functions listed above |

sqrt(x) | The square root of x (for positive x only) |

log(x) | The natural logarithm of x |

pow(x, y) | The power of x to the y |

You can also apply certain constraints/inequalities to the graph. If, for
example, you wanted to show the funtion \(x^2\) - \(y^2\) but only in areas
where \(x\) is greater than \(y\), you would enter "if (x > y, x*x - y*y)" in
the expression box. You can also enter a third option which will be plotted if
the first condition is not met - for example "if (x > y, x*x - y*y, x)" will
plot \(x^2\) - \(y^2\) in all areas where \( x \) is greater than \( y\), and
\(x \) in all areas where x is *not* greater than y.

The resolution slider can be used to increase the number of data points displayed on the graph, which gives a smoother final result, but since this needs more computational power, you may notice a slight decrease in frame rate when interacting with the graph.

Every time you hit the "Calculate" button, the URL updates with your current settings meaning you can share a link directly to a graph of your choice without having to keep typing in the settings.

Please note, if your surface includes complex numbers, only the real part will be plotted.