Seq - Maple Help

 Seq
 a parallel implementation of seq

 Calling Sequence Seq( f, i = m..n ) Seq( f, i = m..n, step ) Seq( f, i = 1..n, step ) Seq( f, i = x ) Seq( f, i in x ) Seq( i = m..n, step ) Seq[ tasksize = s ]( ... )

Parameters

 f - (expression) any expression i - (name) m,n - (numeric) values to range over x - (expression) step - (numeric) (optional) s - (optional, posint) maximum task size

Description

 • The Seq command is a parallel implementation of the seq command. For a complete description of the calling sequences of Seq see the seq help page.
 • Seq is implemented using the Task programming model.
 • Seq attempts to determine how to divide the input into separate tasks to spread the work across all available cores.  However in some situations Seq may not choose the optimal size.  In particular a small number of long running tasks may not be spread evenly over all threads.  In this case, you can specify the maximum task size using the tasksize option. Seq will divide the input into tasks that compute at most tasksize elements within a single task.

Examples

 > $\mathrm{with}\left(\mathrm{Threads}\right):$
 > $\mathrm{Seq}\left({i}^{2},i=1..5\right)$
 ${1}{,}{4}{,}{9}{,}{16}{,}{25}$ (1)
 > $\mathrm{Seq}\left(\mathrm{sin}\left(\frac{\mathrm{\pi }i}{6}\right),i=0..6\right)$
 ${0}{,}\frac{{1}}{{2}}{,}\frac{\sqrt{{3}}}{{2}}{,}{1}{,}\frac{\sqrt{{3}}}{{2}}{,}\frac{{1}}{{2}}{,}{0}$ (2)
 > $\mathrm{Seq}\left(x\left[i\right],i=1..7\right)$
 ${{x}}_{{1}}{,}{{x}}_{{2}}{,}{{x}}_{{3}}{,}{{x}}_{{4}}{,}{{x}}_{{5}}{,}{{x}}_{{6}}{,}{{x}}_{{7}}$ (3)
 > $X≔\left[\mathrm{Seq}\left(i,i=0..6\right)\right]$
 ${X}{≔}\left[{0}{,}{1}{,}{2}{,}{3}{,}{4}{,}{5}{,}{6}\right]$ (4)
 > $\left\{\mathrm{Seq}\left({i}^{2}\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}\mathbf{mod}\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}7,i=X\right)\right\}$
 $\left\{{0}{,}{1}{,}{2}{,}{4}\right\}$ (5)
 > $Y≔\left[\mathrm{Seq}\left({i}^{2},i=X\right)\right]$
 ${Y}{≔}\left[{0}{,}{1}{,}{4}{,}{9}{,}{16}{,}{25}{,}{36}\right]$ (6)
 > $\left[\mathrm{Seq}\left(\left[X\left[i\right],Y\left[i\right]\right],i=1..\mathrm{nops}\left(X\right)\right)\right]$
 $\left[\left[{0}{,}{0}\right]{,}\left[{1}{,}{1}\right]{,}\left[{2}{,}{4}\right]{,}\left[{3}{,}{9}\right]{,}\left[{4}{,}{16}\right]{,}\left[{5}{,}{25}\right]{,}\left[{6}{,}{36}\right]\right]$ (7)
 > $\mathrm{Seq}\left(i,i="Hello"\right)$
 ${"H"}{,}{"e"}{,}{"l"}{,}{"l"}{,}{"o"}$ (8)
 > $\mathrm{Seq}\left(i,i="a".."f"\right)$
 ${"a"}{,}{"b"}{,}{"c"}{,}{"d"}{,}{"e"}{,}{"f"}$ (9)
 > [Seq( i, i=0..-infinity )]; C := proc( f, x )    local i;    [Seq( coeff( f, x, i ), i=0..degree(f,x) )]; end proc;
 $\left[\right]$
 ${C}{≔}{\mathbf{proc}}\left({f}{,}{x}\right)\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathbf{local}}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{i}{;}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}\left[{\mathrm{Threads}}{:-}{\mathrm{Seq}}{}\left({\mathrm{coeff}}{}\left({f}{,}{x}{,}{i}\right){,}{i}{=}{0}{..}{\mathrm{degree}}{}\left({f}{,}{x}\right)\right)\right]\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathbf{end proc}}$ (10)
 > $C\left(2x-4+{x}^{3},x\right)$
 $\left[{-4}{,}{2}{,}{0}{,}{1}\right]$ (11)