beautypg.com

Apple Newton Works Graphing Calculator User Manual

Page 38

background image

Performing operations on lists

You can perform any operation on a list of numbers. If multiple lists are used in an
operation, they must be the same length. The following are some examples of simple
operations done with lists:

Operation

Example

Result

Addition

[1,2] + 3

[4,5]

[1,2] + [3,4]

[4,6]

3 + [1,2,[3,4]]

[4,5,[6,7]]

Subtraction

[1,7,1] – [2,3,1]

[–1,4,0]

[6,7] – 3

[3,4]

Multiplication

3 * [4,5]

[20,25]

[1,2,[3,4]] * [4,5,6]

[4,10,[18,24]]

Division

[3,4,5]/2

[1.5,2,2.5]

[4,5,6]/[2,3,4]

[2,1.6667,1.5]

Simple functions

[2,3]^2

[4,9]

log([1,10])

[0,1]

The above functions perform operations on each element in the list. Other functions
perform operations on the entire list—for example sum([list]). For more information
on lists and functions, see Chapter 2, “Using Functions and Variables.”

Using variables with lists

You can assign a list to a variable and perform operations on that variable.
For example:

a=[1,2,[3,4]]

3+a -> [4,5,[6,7]]

For more information on variables, see “Using Variables” in Chapter 2.

38

Chapter 4