Lists

Working with Lists

In HP48/49 a list is a set of numbers, letters, symbols, etc delimited by { }

Example:
{ 1 2 3 4 5 }
{ A B C D E }
Use of lists is very useful to make tables, statistical calculus and others.
Syntax of lists commands are presented below, after the bar.

1)    +
The operator + is used to catenate lists. For add lists use ADD

Example:
Catenates {1 2 3 4} to the list {5 6 7 8 9 }

{1 2 3 4}
{5 6 7 8 9 }
+

Result: {1 2 3 4 5 6 7 8 9 }

Operator + works also with strings catenating lists.

Example:
{a b c d}
{1 2 3 4}

+

Result:
{a b c d 1 2 3 4 }

2)   ADD
Is a command for add lists. It is different of the operator +

Example:
Add the list { 1 2 3 4 5 } to the list { 6 7 8 9 10 }

{ 1 2 3 4 5 }
{ 6 7 8 9 10 }
ADD

Result: {7 9 11 13 15 }

ADD also sums a constant to a list

Example:
{ 1 2 3 4 5 }
5
ADD

Result: {5 7 8 9 10 }

3)
Subtracts a constant from a list, element by element.

Example:
Subtract 5 from the list {2 3 4 5 6 }
{2 3 4 5 6 }
5

Result:
{-3 -2 -1 0 1}

The operator "" also works with lists:

Example:
{2 3 4 5 6 }
(1 3 2 4 7}

Result:
{1 0 2 1 -1}

4)
Divide the list, element by element.

Example:
Divide the list {2 3 4 5 6 } by 5

{2 3 4 5 6 }
5

Result:
{ .4 .6 .8 1 1.2}

5)   x
Multiplies a list by a constant.

Example:
Multiplies the list {2 3 4 5 6 } by 5

{2 3 4 5 6 }
5
x

Result:
{ 10 15 20 25 30}

6)   Other Functions

You can use functions like Sin(x) , Sqrt(x), X^Y and others built in functions to lists.
The syntax is :
{ a1 a2 a3 a4 ...an }
Function

Example:
Calculate the sine of the list { 2 3 4 5 6 }

{ 2 3 4 5 6 }
[SIN]

Result:
{ 0.90930 0.14112 -0.75680 -0.95892 -0.27942 }

(using FIX 5 and angle mode RAD)

7)   Using Your Own functions
You can also use your own functions to the list.
The syntax is :
{ a1 a2 a3 a4 ...an }
Your Function

First of all you need create a function. You can make it using DEFINE

Example:
Create the function f(x)=X^2+X + 5
Write in level 1:
a) 'F(X)=X^2 - - X - - 5' and press [ENTER]
b) press [DEF]        (DEF stands for DEFINE - the magenta function for the the [STO] key)

Now type,
{2 3 4 5 6 } and press
F

Result:
{ 11 17 25 35 47 }

Note:
you must use - - instead of + or HP will catenate lists returning a wrong result.

Example:
If you define a function as 'F(X)=X^2 + X + 5' it will catenate:
X^2 + X + 5
that is,

{2 3 4 5 6 }x{2 3 4 5 6 } = {4 9 16 35 36}
catened with {2 3 4 5 6 } = {4 9 16 35 36 2 3 4 5 6 }
and catened with {5} that results:{4 9 16 35 36 2 3 4 5 6 5}

Other operators like , , x , , and logs are not affected by catenation of lists as happens with +.
Always + is used it catenates and not add lists.

8)    Commands of the MATH LIST Menu

9)   LIST

Subtracts the previous element in the list (an-1) from the element (an).
{a1 a2 a3 a4 a5 .... an}
[LIST]

Result:
{ a2-a1 a3-a2 a4-a3 a5-a4}

The order of the resultant list is N - 1, where N is the number of elements of the list.

Example:
{ 5 8 10 15 22}
[LIST]

Result :
{ 3 2 5 7 }

10)   LIST
Sum all elements of the list

Example:
{ 2 3 4 5 6}
[ LIST]

Result: 20

11)   LIST
Multiplies all elements of the list

Example:
{ 2 3 4 5 6}
[ LIST ]

Result:720

12)   SORT
sort the elements of a list

Example:
{ 9 4 3 6 0 }
[ SORT ]

Result:{ 0 3 4 6 9 }

13)   REVLI
Return the reverse of a list

Example:
{ 1 2 3 4 5 6}
[ REVLI ]

Result:{ 6 5 4 3 2 1 }

 If one has not given everything, one has given nothing. - Georges Guynemer