y1 = x | x<3
y2 = -(x+3) | x3 and x<5
y3 = 1/2*x | x 5
m
Note that this method does not define a single, piece-wise continuous function. Instead, it defines
several functions that, when plotted simultaneously, give the appearance of a single function.
(Credit to Fabrizio)
[4.7] Graphing piece-wise defined function with a unit step function
This is another method to plot piece-wise continuous functions. The advantage to this method is that
the piece-wise function is defined as a single function, and can easily be integrated, differentiated, or
combined with other functions.
First, define the unit step function u(t) as
u(t)
func
when(t<0,0,1)
endfunc
Electrical engineers know this as the unit step function; mathematicians call it Heaviside's step
function.
You can use the unit step function to 'turn on' various graph segments. This is done by multiplying the
function by the appropriate unit step function:
1. For x > x1, use u(x - x1)
2. For x1 x x2, use u(x - x1) - u(x - x2)
[[
3. For x < x1, use u(x1 - x)
For example, suppose we have three functions f1(x), f2(x) and f3(x). f1(x) is used for x < -1, f2(x) is
used for -1 < x < 2, and f3(x) is used for x > 2. Use the unit step function to define the complete
function like this:
y1(x) = f1(x)*u(-1 - x) + f2(x)*[u(x - (-1)) - u(x - 2)] + f3(x)*u(x - 2)
(Credit to TipDS)
[4.8] Plot functions that return lists
You can define functions in the Y= Editor that return lists, and the elements of those lists will be
graphed as separate plots. For example, suppose function f1() is defined as
f1(x)
Func
return {x^2,x^3}
EndFunc
then, in the Y= Editor define
4 - 7