ApplyToRows - Maple Help

DataSets[Builtin][Reference]

 ApplyToRows
 create a Matrix of transformed data with algebraic expressions

 Calling Sequence ApplyToRows(ref, aexp1, aexp2, ..., aexpN)

Parameters

 ref - reference to built-in data aexp1, aexp2, ..., aexpN - algebraic expressions where the indeterminants are column names of ref as Maple names

Description

 • The ApplyToRows command creates Matrix of transformed data.
 • The number of columns is equal to the number of algebraic expressions. The number of rows is equal to the number of rows in ref.
 • The value of the $i,j$-th entry is the $j$-th algebraic expression evaluated with the column names substituted for the values in those columns in the $i$-th row of ref.
 • Time series data in the reference object are treated as their newest value when using this command.

Examples

 > $\mathrm{with}\left(\mathrm{DataSets}\right):$
 > $\mathrm{ref}≔{\mathrm{Reference}\left("Builtin","Country"\right)}_{\left["Canada","USA"\right],\left["CO2 Emissions","Population"\right]}$
 ${\mathrm{ref}}{≔}\left[\begin{array}{ccc}{\mathrm{Country \left(Name\right)}}& {\mathrm{CO2 Emissions}}& {\mathrm{Population}}\\ {\mathrm{Canada}}& {\mathrm{TimeSeries 537193.498}}& {\mathrm{TimeSeries 39.23}}\\ {\mathrm{USA}}& {\mathrm{TimeSeries 5254279.285}}& {\mathrm{TimeSeries 340.976}}\end{array}\right]$ (1)

Find the CO2 emission per person in Canada or the USA

 > $\mathrm{ApplyToRows}\left({\mathrm{ref}}_{\left["Canada","USA"\right]},\frac{\mathrm{CO2 Emissions}}{1000000\mathrm{Population}}\right)$
 $\left[\begin{array}{c}{0.01369343609}\\ {0.01540952819}\end{array}\right]$ (2)

To also have the absolute CO2 emissions in the first column

 > $\mathrm{ApplyToRows}\left({\mathrm{ref}}_{\left["Canada","USA"\right]},\mathrm{CO2 Emissions},\frac{\mathrm{CO2 Emissions}}{\mathrm{Population}}\right)$
 $\left[\begin{array}{cc}{537193.498}& {13693.43609}\\ {5.254279285}{×}{{10}}^{{6}}& {15409.52819}\end{array}\right]$ (3)

Compatibility

 • The DataSets[Builtin][Reference][ApplyToRows] command was introduced in Maple 2015.