convert/pwlist - Maple Programming Help

Home : Support : Online Help : Programming : Data Types : Conversion : convert/pwlist

convert/pwlist

convert a piecewise function to a list

 Calling Sequence convert(piecewise, pwlist, x)

Parameters

 piecewise - piecewise expression pwlist - literal name x - (optional) name; specify variable

Description

 • A piecewise expression, such as $\left\{\begin{array}{cc}{f}_{1}& \mathrm{cond1}\\ {f}_{2}& \mathrm{cond2}\\ \mathrm{...}& \mathrm{ }\end{array}\right\$, is converted into an ordered list $\left[{f}_{1},{t}_{1},{f}_{2},{t}_{2},\mathrm{...},{f}_{n},{t}_{n},{f}_{n+1}\right]$ which represents the piecewise-defined function:

${f}_{i}\mathrm{when}{t}_{i-1}

 Here, ${t}_{0}=-\mathrm{\infty }$ and ${t}_{n+1}=\mathrm{\infty }$ are implicit.
 • The variable x can be stated as an extra argument to the convert function.  If x is not stated then the variable name is deduced if there is exactly one name appearing in the expression.

Examples

 > $f≔\mathrm{piecewise}\left(-1
 > $\mathrm{convert}\left(f,\mathrm{pwlist},x\right)$
 $\left[{0}{,}{-1}{,}{{x}}^{{3}}{,}{0}{,}{\mathrm{sin}}{}\left({x}\right){,}\frac{{\mathrm{\pi }}}{{2}}{,}{1}{+}{\mathrm{cos}}{}\left({x}\right)\right]$ (1)
 > $g≔\mathrm{piecewise}\left(x<1,a-x,1\le x,\mathrm{ln}\left(x\right)\right):$
 > $\mathrm{convert}\left(g,\mathrm{pwlist},x\right)$
 $\left[{a}{-}{x}{,}{1}{,}{\mathrm{ln}}{}\left({x}\right)\right]$ (2)