Example 1 — Evaluation & continuity
\[ f(x)= \begin{cases} x^2, & x<1\\ 2x+1, & x\ge 1 \end{cases} \] \(f(0)=0\), \(f(2)=5\). At \(x=1\): \(\lim_{x\to1^-}f=1\), \(\lim_{x\to1^+}f=3\), \(f(1)=3\). Not continuous at \(1\).
Define a piecewise function \(f(x)\), evaluate it at a point, and see the exact LaTeX formula and a quick plot.
f).2*x+1, condition x < 0 or 0 <= x && x <= 5.< <= > >= == !=, logical && or and, || or or.
sin(x), abs(x), sqrt(x), constants pi, e.A Piecewise Function Calculator is a math tool that evaluates functions defined by multiple rules over different intervals of the input variable. Unlike single-formula functions, a piecewise function switches formulas at breakpoints (e.g., \(x=0\), \(x=1\), etc.). The calculator identifies which interval a given \(x\) belongs to, applies the matching formula, and returns the numerical result. Beyond evaluation, it checks continuity at breakpoints by comparing left- and right-hand limits, reports whether the function is continuous at a point, and—when rules are differentiable—computes derivatives on each interval. It can also integrate by summing definite integrals across subintervals. All formulas here are written in LaTeX so they display responsively when you load MathJax or math.js on your page.
Piecewise definitions model real behavior: taxes with brackets, absolute value, saturation/threshold systems, and many physics or economics laws. A typical form is:
\[ f(x)= \begin{cases} f_1(x), & x \in I_1 \\ f_2(x), & x \in I_2 \\ \vdots & \vdots \\ f_k(x), & x \in I_k \end{cases} \]
The calculator normalizes intervals (open/closed endpoints), handles missing powers, and applies exact comparisons at breakpoints. For continuity at \(x=c\), it checks whether
\[ \lim_{x\to c^-} f(x) \;=\; \lim_{x\to c^+} f(x) \;=\; f(c). \]
If derivatives are requested, it returns \(f'(x)\) on each interval and tests differentiability at \(c\) via matching one-sided derivatives. For integrals, it partitions the domain of integration at each breakpoint and sums the results. Results are presented step-by-step for clarity and verification.
Piecewise definition: \[ f(x)=\sum_{i=1}^{k} f_i(x)\,\mathbf{1}_{I_i}(x), \qquad \mathbf{1}_{I_i}(x)= \begin{cases} 1,& x\in I_i\\[2pt] 0,& \text{otherwise} \end{cases} \]
Continuity at \(c\): \[ f \text{ is continuous at } c \iff \lim_{x\to c^-} f(x)=\lim_{x\to c^+} f(x)=f(c). \]
Derivative: \[ f'(x)= \begin{cases} f_1'(x), & x\in \operatorname{int}(I_1)\\ \vdots & \vdots\\ f_k'(x), & x\in \operatorname{int}(I_k) \end{cases} \quad\text{and}\quad f' \text{ at } c \text{ exists if } \lim_{x\to c^-} f'(x)=\lim_{x\to c^+} f'(x). \]
Definite integral across breakpoints: \[ \int_{a}^{b} f(x)\,dx = \sum_{i=1}^{k} \int_{[a,b]\cap I_i} f_i(x)\,dx. \]
\[ f(x)= \begin{cases} x^2, & x<1\\ 2x+1, & x\ge 1 \end{cases} \] \(f(0)=0\), \(f(2)=5\). At \(x=1\): \(\lim_{x\to1^-}f=1\), \(\lim_{x\to1^+}f=3\), \(f(1)=3\). Not continuous at \(1\).
\[ g(x)= \begin{cases} -x, & x<0\\ x, & x\ge 0 \end{cases} \Rightarrow g'(x)= \begin{cases} -1, & x<0\\ 1, & x>0 \end{cases} \] Derivative does not exist at \(0\) (one-sided derivatives differ).
\[ h(x)= \begin{cases} 1, & 0\le x<2\\ x, & 2\le x\le 4 \end{cases} \] \(\displaystyle \int_{0}^{4} h(x)\,dx=\int_{0}^{2}1\,dx+\int_{2}^{4}x\,dx=2+\frac{4^2-2^2}{2}=2+6=8\).
A function defined by different formulas on different intervals of the domain with specified breakpoints.
Compare left and right limits and the defined value at the point; if all match, the function is continuous.
Yes. It respects \( <, \le, >, \ge \) so evaluation and continuity tests reflect endpoint choices.
It compresses multiple rules into one expression for cleaner algebra, limits, and integrals.
It returns interval derivatives and checks one-sided derivatives at breakpoints to decide differentiability.
Yes. The tool splits the integral at each breakpoint and sums the results from all applicable intervals.
Yes. It converts \(|x|\) into a two-piece definition and proceeds with evaluation, limits, or derivatives.
The first matching rule is used; you should avoid overlaps or adjust ranges for an unambiguous definition.
Yes. With MathJax or math.js loaded, LaTeX equations reflow responsively on phones and tablets.