Graphing a Piecewise Function Calculator
Write each piece with a condition: condition ? value_if_true : value_if_false.
How to write a piecewise function
Use the pattern condition ? A : B. For f(x) = −x when x < 0 and x² otherwise, type x<0?-x:x^2. For three pieces, nest them: x<-1?1:x<2?x:4.
How to type functions
Use x as the variable, ^ for powers, and sin, cos, tan, asin, acos, atan, sqrt, abs, exp, ln (natural log), log (base 10), pow, floor, ceil, round, min, max, pi and e. Use brackets for clarity, for example (-x)^2.
Results are estimates for general information only. Found a mistake? Report an error.
Frequently asked questions
How do I write three pieces?
Nest the conditions: x<-1?1:x<2?x:4 means 1 when x<-1, x when -1≤x<2, and 4 otherwise.