Math ToolsAvailable now

Function Plotter

Type any math expression and see the graph plotted instantly.

Press Enter or click Plot — pick examples below to explore

x fromto
Pick an example to explore

Tap any card — graph updates, then edit the formula yourself

Straight lines — change numbers to tilt or shift

Try making small changes

Load any example above, then tweak the formula to see what happens.

Move graph up/down
Add or subtract a number at the end
Flip upside down
Put a minus sign in front
Stretch/squash horizontally
Multiply x inside the formula
Change the power
x**2 = U-shape · x**3 = S-shape · x**4 = wider U
Quick reference
+ − * / — add, subtract, multiply, dividex**2 — squared  ·  x**3 — cubed  ·  x**0.5 — square rootsin cos tan tanh — trigonometric functionssqrt abs ln exp max min — other functionse ≈ 2.718 (Euler's number)  ·  pi ≈ 3.14159x > 0 ? x : 0 — conditional (ternary) expression

About this tool

Type any formula in x and press Plot — the graph renders instantly in your browser with no server round-trip. Supports sin, cos, sqrt, ln, exp, powers, and the constants e and pi. Switch to the AI/ML tab to explore 17 annotated presets covering activation functions (ReLU, sigmoid, GELU, Swish), loss functions (MSE, MAE, Huber, hinge), and statistical distributions — each with key points marked on the graph and a plain-English explanation.

How to use

  1. Type a mathematical expression in x into the input field, for example sin(x) or x**2 − 3.
  2. Set the x-axis range using the min and max fields, then press Enter or click Plot.
  3. Switch to the AI/ML tab and tap any activation or loss function preset to plot it with annotated key points and an explanation.

Related Tools

FAQ

What mathematical functions can I use?

sin, cos, tan, tanh, asin, acos, atan, sqrt, abs, log (base-e), log2, log10, ln, exp, pow, floor, ceil, round, sign, min, max. Constants: e (Euler's number ≈2.718) and pi (≈3.14159). Use ** or ^ for powers — for example x**2 or x^2 both give a parabola.

What is ReLU and why is it the most used activation function?

ReLU (Rectified Linear Unit) is defined as max(0, x) — it outputs x for positive inputs and 0 for negative inputs. It is the default activation in most deep learning models (ResNet, VGG, CNNs) because it is cheap to compute, does not have vanishing gradients for positive inputs, and creates sparse activations where many neurons output exactly zero.

What is the difference between Sigmoid, Tanh, and GELU activation functions?

Sigmoid squashes input to (0, 1) and is used for binary classification outputs, but suffers from vanishing gradients in hidden layers. Tanh squashes to (−1, 1) and is zero-centred, making it better for hidden layers in RNNs and LSTMs. GELU (Gaussian Error Linear Unit) is the current default in Transformer models like GPT and BERT — it is smooth, non-monotonic, and empirically outperforms both for language tasks.

What is the difference between MSE loss, MAE loss, and Huber loss?

MSE (L2 loss, x²) squares errors, so large errors dominate — it is ideal when outliers are genuine mistakes. MAE (L1 loss, |x|) treats all error magnitudes equally, making it robust to outliers. Huber loss combines both: quadratic for small errors and linear for large ones. The δ parameter controls the boundary. Huber loss is used in DQN reinforcement learning and Faster R-CNN object detection.

Why is the Gaussian bell curve important in machine learning?

The Gaussian (normal) distribution describes random variation and appears wherever many independent factors contribute to an outcome. In ML it underlies linear regression noise models, Xavier and He weight initialisation, the latent space of variational autoencoders (VAEs), and Gaussian process models. The Central Limit Theorem guarantees that averages of many random variables converge to a Gaussian, making it the default assumption for unexplained noise.

How does the Laplace distribution connect to L1 regularisation?

From a Bayesian perspective, placing a Laplace prior on neural network weights is mathematically equivalent to adding an L1 (Lasso) regularisation penalty to the loss function. The Laplace distribution has a sharp peak at zero and heavy tails, which encourages many weights to be driven to exactly zero — producing sparse, interpretable models.

Can I plot two curves at once?

Yes. Click '+ Add a second curve' below the main formula input to reveal a second input. The first curve is drawn in indigo, the second in rose. This is useful for comparing two activation functions side by side or for plotting a full circle as top and bottom halves (for example sqrt(25−x**2) and −sqrt(25−x**2)).

What happens at undefined points like 1/x near x=0?

The plotter skips undefined or infinite values — the curve simply breaks at those points rather than drawing an incorrect line through infinity.