Math & Science
Free Online Graphing Calculator
Plot 2D functions, explore variables with sliders, and export SVG graphs.
Loading Utility…
Graphing Calculator Guide · 10 min read
Graphing Calculator Guide: Plot Functions, Sliders & SVG Export
How Function Plotting Works
A graphing calculator doesn't evaluate a function symbolically — it samples it numerically. For every horizontal pixel on the canvas, the calculator converts that pixel's x-coordinate to a graph value using the current zoom and pan, evaluates f(x) using the mathjs expression compiler, converts the result to a screen y-coordinate, and connects adjacent valid points with line segments.
This pixel-by-pixel sampling has important implications:
Vertical asymptotes appear as near-vertical lines or sharp breaks rather than clean gaps. When adjacent y-values differ by more than the canvas height, the renderer lifts the pen — but steep slopes near an asymptote can still render as a near-vertical stroke. tan(x) near ±π/2 is the most common example.
Discontinuous functions like floor(x) (staircase) or sign(x) (returns ±1) show a rendered jump at each discontinuity — which is mathematically correct, not a rendering bug.
Sampling resolution is one point per CSS pixel. At high zoom levels the curve becomes a series of visible line segments between sample points. This is the resolution limit of pixel-based sampling, not an expression error.
Expression Syntax Reference
The calculator uses mathjs to evaluate expressions. x is the horizontal axis variable. a and b are controlled by the sliders panel.
Arithmetic and powers
| Expression | Meaning |
|---|---|
x^2 |
x squared |
x^3 - 2*x + 1 |
cubic polynomial |
1 / x |
hyperbola — asymptote at x = 0 |
x % 3 |
modulo — creates a repeating sawtooth pattern |
sqrt(x) |
square root, real only for x ≥ 0 |
nthRoot(x, 3) |
cube root — handles negative x correctly |
Trigonometric functions
| Expression | Notes |
|---|---|
sin(x), cos(x) |
period 2π in radians |
tan(x) |
vertical asymptotes at ±π/2, ±3π/2, … |
asin(x), acos(x) |
domain restricted to [-1, 1] |
atan(x) |
full domain, range (-π/2, π/2) |
Switch to DEG mode in Graph Settings for degree inputs. sin(90) = 1 in DEG, but sin(90) ≈ 0.894 in RAD.
Exponential and logarithmic
| Expression | Notes |
|---|---|
exp(x) |
e^x |
log(x) |
natural log — undefined for x ≤ 0 |
log(x, 10) |
base-10 logarithm |
log2(x) |
base-2 logarithm |
Rounding and special functions
| Expression | Notes |
|---|---|
abs(x) |
absolute value — V-shape with vertex at origin |
floor(x) |
staircase function — round down |
ceil(x) |
round up |
sign(x) |
returns -1, 0, or +1 |
Common composite patterns with slider variables
a * sin(b * x) # amplitude a, frequency b
x^2 + a*x + b # quadratic — explore roots via discriminant
exp(-a * x^2) # Gaussian bell curve — a controls width
1 / (1 + exp(-a * x)) # sigmoid / logistic curve
a * x / (1 + abs(x)) # bounded linear with asymptotes at ±a
Multiplication must be explicit. Write 2*x, not 2x. Write a*(x+1), not a(x+1). mathjs requires the * operator — implicit multiplication is not supported.
Variable Sliders: Seeing Parameters Live
The Variables panel exposes live sliders for a and b (range −10 to +10, step 0.1). As you drag, every function referencing that variable re-evaluates and the canvas redraws in real time.
Exploring the quadratic discriminant
x^2 + a*x + b
The discriminant is a² − 4b. Drag b from a large positive value downward. The parabola drops until it touches the x-axis at exactly b = a²/4 (one repeated root), then crosses it (two real roots). The roots emerging from a tangent point is the quadratic formula made visual.
Gaussian width — probability and signal processing
exp(-a * x^2)
Large a = narrow, tall peak. Small a = wide, flat curve. This bell shape appears in normal distributions, Gaussian image filters, optical beam profiles, and quantum wave packets. Dragging a from 0.1 to 5 shows the concentration effect intuitively.
Logistic / sigmoid curve
1 / (1 + exp(-a * x))
a controls steepness. At a = 1 you get the standard sigmoid used in logistic regression. At a = 10 the curve approximates a step function — a threshold decision boundary. This is the activation function of the output layer in binary classification neural networks.
Multi-Function Overlay
Click + in the Functions panel to add additional functions. Each renders in a distinct color on the same coordinate system.
Function and its numerical derivative
sin(x)
(sin(x + 0.001) - sin(x)) / 0.001 # ≈ cos(x)
The peaks of the derivative align with the zero crossings of the original — the slope of sin(x) is zero at its maxima and minima, which is where cos(x) is also zero. This is the fundamental theorem of calculus made visible without any symbolic computation.
Taylor series convergence
sin(x)
x - x^3/6 + x^5/120 # 5th-order expansion
x - x^3/6 + x^5/120 - x^7/5040 # 7th-order expansion
Near x = 0 all three curves overlap — the approximations are accurate at the expansion point. Zoom out to x = ±8 to watch the polynomial approximations diverge while sin(x) stays bounded. This is radius of convergence made tangible.
Linear vs. Logarithmic Scale
Switch axis scale in Graph Settings → Scale Mode.
Linear scale (default) places values at equal distances. Use it for polynomials, trig functions, and any function where x and y span a small uniform range.
Log scale compresses large value ranges — equal multiplicative ratios map to equal screen distances. A decade (×10 change) occupies the same width whether it's 1→10 or 1,000→10,000.
| Function type | Best scale | Why |
|---|---|---|
Exponential exp(a*x) |
linear-x, log-y | becomes a straight line; slope = growth rate |
Power law x^n |
log-log | becomes a straight line; slope = exponent n |
| Frequency response (Bode) | log-x, linear-y | frequency in decades, standard convention |
| Polynomial, trig | linear-linear | small uniform range; log adds no insight |
| Population or financial growth | linear-x, log-y | straight line when growth rate is constant |
Important: Log scale is undefined for values ≤ 0. The renderer silently skips those regions — the curve simply doesn't appear where the axis would be undefined.
Key Points: Roots and Intercepts
The calculator automatically finds and marks:
- Y-intercept: the value of
f(0), shown as a labeled circle on the y-axis. - Roots (x-intercepts): where
f(x) = 0, found by sampling 100 x-values across the visible viewport, detecting sign changes, and refining each crossing with 8 iterations of bisection (approximately 0.1% accuracy).
Key points update as you pan and zoom — only roots in the current viewport are shown. Plotting x^2 - 2 will mark roots at approximately ±1.414, confirming √2 without solving analytically.
Limitation: bisection only finds roots where the function changes sign. Tangent roots where the curve touches zero without crossing — like (x-1)^2 at x=1 — have no sign change and won't be detected.
SVG Export for Publications and LaTeX
Click Download to export the current canvas view as a scalable vector graphic. SVG preserves mathematical curve quality at any print size — from a journal figure at 3×3 cm to a poster at A1.
Before exporting:
- Frame the viewport to exactly the region you want — the export captures the current view.
- Set meaningful axis labels in Graph Settings (e.g.,
tfor time,vfor velocity). - Enable minor gridlines if readers need to estimate precise coordinate values.
- Use Reverse Contrast if the figure will be printed on white paper — dark backgrounds consume a lot of ink.
Where SVG is used:
- LaTeX: import with the
svgpackage or convert to PDF viainkscape --export-pdf - Google Slides / PowerPoint / Keynote: insert as image — scales without pixelation
- Academic journals: most accept SVG or PDF vector figures; convert with Inkscape or a browser print-to-PDF
Accessibility Settings
Reverse Contrast: inverts the color scheme — useful when a projector washes out the default rendering or when printing on white paper to minimize ink usage.
Minor Gridlines: adds subdivision lines between major grid intervals, helpful for reading precise coordinate values from a published figure.
Lock Viewport: prevents accidental pan or zoom while dragging parameter sliders — useful when you want the view held steady during a live demonstration.
Axis Labels: rename x and y to meaningful variable names in Graph Settings. Labels appear on the canvas and are embedded in the SVG export.
Privacy: Fully Local Computation
Every expression is evaluated inside your browser using the mathjs library. No expression, graph data, or variable value is ever transmitted to a server. The tool has no backend — it is a fully static client-side application.
This matters when graphing proprietary engineering transfer functions, pre-publication research data, financial projections, or any expression that shouldn't be logged or cached by a third-party service.
Compare this to Desmos, GeoGebra, or Wolfram Alpha — all of which send your input to their servers for evaluation. Here, disconnecting from the internet after page load has zero effect on functionality.
Comparison with Other Graphing Tools
| Feature | This tool | Desmos | GeoGebra | Wolfram Alpha |
|---|---|---|---|---|
| No signup required | ✓ | ✓ | ✓ | ✓ |
| Fully offline after load | ✓ | ✗ | partial | ✗ |
| SVG export | ✓ | PNG only | ✓ | paid plan |
| Variable sliders | ✓ | ✓ | ✓ | ✗ |
| Log/linear scale modes | ✓ | ✓ | ✓ | ✓ |
| Expressions not sent to server | ✓ | ✗ | ✗ | ✗ |
| Minor gridlines | ✓ | ✗ | ✓ | ✗ |
| Accessibility (contrast, braille) | ✓ | partial | partial | ✗ |
| No installation | ✓ | ✓ | ✓ | ✓ |
The primary differentiators are complete expression privacy, SVG export without a paid plan, and the accessibility settings (reverse contrast, braille input mode) that most browser-based alternatives omit.
Frequently Asked Questions
Everything you need to know about the Graphing Calculator and how your data is handled.
- What function syntax does the graphing calculator support?
- Enter functions using standard mathematical notation: x^2 for x squared, sqrt(x) for square root, sin(x), cos(x), tan(x) for trigonometric functions, exp(x) or e^x for the natural exponential, log(x) for base-10 logarithm, and ln(x) for natural logarithm. Combine these freely: sin(x)^2 + cos(x)^2, 2*x^3 - 3*x + 1, or e^(-x^2) for a Gaussian curve. Multiplication must be explicit — write 2*x, not 2x. Parentheses control grouping as in standard algebra.
- How do variable sliders work for exploring function parameters?
- Add a parameter (like a, b, or k) to your function instead of a fixed number — for example, a*sin(b*x). The calculator detects undefined variables and creates a slider for each one. Drag the slider to change the parameter value and watch the curve update in real time. This is ideal for visualizing how amplitude (a), frequency (b), phase shift, and vertical translation affect a function shape — the key to understanding function transformations in precalculus and calculus courses.
- How do I export a graph for use in a paper or LaTeX document?
- Click the SVG Export button to download the current graph view as a Scalable Vector Graphics file. SVG is resolution-independent — it looks sharp at any size from a small thumbnail to a large poster, making it the ideal format for academic papers, LaTeX documents (using the \includegraphics command), Figma, and presentation slides. For LaTeX specifically, convert the SVG to PDF using Inkscape (inkscape --export-pdf=graph.pdf graph.svg) and include it with \includegraphics[width=\linewidth]{graph.pdf}.
- Can I plot multiple functions on the same graph?
- Yes. Click "Add Function" to add additional function inputs. Each function is rendered in a distinct color on the same coordinate plane, making it easy to compare behaviors — for example, plotting f(x) = x^2 and g(x) = 2x + 1 to find their intersection visually, or plotting sin(x), sin(2x), and sin(3x) to demonstrate frequency harmonics. You can show or hide individual functions by toggling them, and each function's color can be customized for presentation clarity.
- What expression syntax does the graphing calculator support?
- The calculator uses mathjs expression syntax. You can write sin(x), cos(x), tan(x), x^2, sqrt(x), log(x), exp(x), abs(x), floor(x), and composite expressions like a*sin(b*x) + 2. Variables a and b are controlled by the sliders panel.
- How do I plot multiple functions at the same time?
- Click the + button in the Functions panel to add a new function input. Each function gets a unique color. All functions render on the same canvas so you can compare behaviors directly — useful for overlaying a function with its derivative or comparing two models.
- Can I use degrees instead of radians?
- Yes. Open Graph Settings and switch the angle mode from RAD to DEG. All trigonometric functions (sin, cos, tan) will interpret their input in degrees instead of radians.
- How do I export the graph as an SVG?
- Click the Download button in the toolbar. The canvas is serialized to a high-resolution SVG file that scales to any print size without quality loss — suitable for LaTeX documents, academic papers, and engineering reports.
- Is this a Desmos alternative?
- It covers the core use cases: multi-function plotting, zoom/pan, variable sliders, and log scale. It runs entirely client-side with no account required and no data sent to any server — making it suitable for internal or sensitive expressions that shouldn't be logged by a third party.
- Does the graphing calculator work offline?
- Yes. Once the page has loaded, all computation runs in your browser using the mathjs library. No network requests are made when evaluating or plotting expressions.
- Why does my function show a strange spike or break at certain x values?
- Spikes or breaks usually indicate a discontinuity or vertical asymptote. For example, tan(x) has asymptotes at ±π/2. The renderer detects large jumps between adjacent y-values and lifts the pen, but very steep curves near asymptotes can still appear as near-vertical lines rather than clean gaps.
- Why does x^(1/3) not work for negative x values?
- JavaScript's power operator treats fractional exponents as complex for negative bases and returns NaN. Use nthRoot(x, 3) instead — it correctly returns the real cube root for negative inputs.
Common Use Cases
- Visualizing derivatives and integrals for calculus homework
- Creating scalable vector graphs for LaTeX and academic papers
- Exploring function transformations with interactive parameter sliders
- Teaching mathematical concepts in the classroom
- Sanity-checking engineering transfer functions
- Comparing multiple function behaviors on the same plot
- Physics simulations and curve fitting
- Quick function visualization without installing software