Piecewise-Defined Functions

Scientific Notebook allows you to define functions that are described by different expressions on different parts of their domain. You can evaluate, plot, differentiate, and integrate these functions.

Note that there are strict conditions concerning the piecewise definition of functions. They must be specified in a three-column matrix with at least two rows, with the functional values in the first column, ``if'' or ``if'' in the second column, and the range condition in the third column. Also, the matrix must be fenced with a left brace and no right delimiter, as in the following examples. It is advisable to enter the range conditions in order of increasing range.

$\blacktriangleright$ To form the matrix

1.
From the Brackets itbpF0.3009in0.288in0.0701inbrackets1.wmf list, choose itbpF0.2361in0.3719in0.0701inlbrace.wmf for the left bracket and the dashed vertical line itbpF0.2465in0.3719in0.0899indashline.wmf for the right bracket. (The dashed vertical line does not normally appear in the printed document. It appears on screen as a dashed red line only when View + Helper Lines is turned on.)

2.
Click itbpF0.3009in0.3009in0.0701inmatrix.wmf or choose Insert + Matrix.

3.
Set the numbers for Rows (number of conditions) and Columns (3).

4.
Click OK.

Functions should be entered as in the following examples. (When entering such functions, check Helper Lines on the View submenu, to see important details.)

$\blacktriangleright$ To define a piecewise-defined function

1.
Type the function values in a matrix enclosed in brackets as described.

2.
Leave the insertion point in the function definition.

3.
Click itbpF0.3009in0.3009in0.0701innewdef.wmf or, from the Define submenu, choose New Definition.

You can then choose Evaluate to get results such as f (- 1) = 1, f (${\frac{{1}}{{2}}}$) = 2, f (2) = 1, h(- 1) = 1 and


f(x) = $\displaystyle \left\{\vphantom{
\begin{array}{ccl}
x+2 & \text{if} & x<0 \\ ...
...undefined} & \text{if} & x=1 \\
2/x & \text{if} & 1<x
\end{array}
}\right.$$\displaystyle \begin{array}{ccl}
x+2 & \text{if} & x<0 \\
\func{undefined} ...
...
\func{undefined} & \text{if} & x=1 \\
2/x & \text{if} & 1<x
\end{array}$

Note    To operate on piecewise-defined functions, such as to evaluate, plot, differentiate, or integrate such a function, you can make the definition and then work with the function name f or the expression f (x). You can also place the insertion point in the defining matrix to carry out such operations.

$\blacktriangleright$ To plot a piecewise-defined function

1.
Define a function f (x) as described above.

2.
Select the expression f (x) or f or select the defining matrix.

3.
Click itbpF0.3009in0.3009in0.0701in2dplot.wmf or choose Plot 2D + Rectangular.

For piecewise-defined functions that are not continuous, the choices of the expression f (x) or only the function name f, can have different results. For the function y = g(x) defined above, which is not continuous, you can plot with or without vertical connecting lines by using either the expression g(x) or the function name g to generate the plot.

itbpFU2.2684in1.5056in0ing(x)piecews4.wmfitbpFU2.2684in1.5056in0ingpiecews5.wmf

See Plotting Defined FunctionsDM6-4.tex#Plot piecewise-defined function for guidelines to plotting piecewise-defined functions.