Data Set Functions - Overview

The functions discussed here are all under the Data dropdown button, except for the financial ones which are in the Mony list.

In addition to the memories M1 ñ M100, Napier also has a separate Data Set memory that can store up to 1000 values which can be manipulated inside Napier and read and written to text files. Since Napier stores all values including time as floating point numbers, the Data Set can be used for any value set.

The Data Set can be edited, sorted, entries added, multiplied, raised to a power of another value, and individual items used in other calculations. It can be averaged, both arithmetic and geometric, used in statistical functions, analyzed for percentiles, and used to calculate periodic portfolio returns given a series of balances. It also can be used to hold a series of cash flows to do Net Present Value and Internal Rate of Return calculations.

The Data Set can also be accessed from VBScript and can be saved and read back from files separately from the whole state. This allows you to keep several different sets of data and work on them in the same environment.

Data Entry, View, Edit

There are two main ways to load the Data Set from inside Napier, using the DataIn key, and entering a comma separated list of values then executing the DSto function.

DataIn Key

This is exactly the same as the ENTER key, but the results of each evaluation are appended onto the bottom of the Data Set. The information box will show you what Data Set entry you just entered and the value.

As with the ENTER key, if you are evaluating an expression which changes each time it is evaluated, repeatedly tapping DataIn will repeat the previous command as long as you donít edit the command.

Tab Separated Data List and the DSto Function

You can enter multiple values if you separate them with a comma, then either append them to the Data Set with the DataIn key, or replace the entire Data Set with the entries in the command box by using the DSto function. If you use the DataIn key, the result shown as an answer is the count of entries added to the Data Set.

 

Viewing the Data Set, DView and DEdit

With up to 1000 entries, it gets hard to remember them all, so DView will display a scrolling list of values. If you want to edit the entries, use the DEdit function, which will put a comma separated list of entries into the command box so you can edit them, then put them back into the Data Set with DSto.

Deleting the Data Set, DDel

To delete all entries, use DDel, but you canít reverse it, so be careful. In the File menu list, you can save the Data Set separately from the rest of the calculator state in a named file.

All The Data Set Functions

These are the functions under the Data dropdown:

DView

 

 

Show data elements

Data

 

 

Data(index) = item at index

 

The first item is at index = 1

 

The last item is at DCnt

DEdit

 

 

Load the Data Set into the

 

command line for editing.

 

Items are comma separated, Can

 

be edited, added or deleted

 

After edit, reload  with DSto

DSto

 

 

Replace data with comma sep list

 

This deletes all current data

 

and replaces it with the comma

 

separated list in command line

DCnt

 

 

Count of data items

Index

 

 

Index(val) = closest item index

DDel

 

 

Deletes all data elements

 

Irreversibly deletes entire Data Set

DAdd

 

 

Add answer to all items

 

Uses current answer

 

from command line and

 

changes entire Data Set

DMul

 

 

Multiply all items by answer

 

Uses current answer

 

from command line and

 

changes entire Data Set

DPow

 

 

Raise items to answer power

 

Uses current answer

 

from command line and

 

changes entire Data Set

SortA

 

 

Sort data ascending

 

Changes entire Data Set

SortD

 

 

Sort data descending

 

Changes entire Data Set

Max

 

 

Max value in data items

Med

 

 

Max value in data items

MinD

 

 

Min value in data items

Avg

 

 

Arith average of data items

GAvg

 

 

Geo average of data items

 

Product of all items to the

 

1/count power

AvDev

 

 

Avg of abs deviations from mean

DProd

 

 

Product of data items

DSum

 

 

Sum of data items

PctlR

 

 

PctlR(value)

 

 = percentile rank in data

 

The percentile of the

 

value relative to the data

PctlV

 

 

PctlV(pctl)

 

 = value rel to data

 

The value in the data for

 

the input percentile

Kurt

 

 

Kurtosis of Data Set

Skew

 

 

Skew of Data Set

StdDev

 

 

StdDev of data items

SqDev

 

 

Sum of Sqs of deviations from mean

SumSq

 

 

Sum of sq of data items

Var

 

 

Variance of data items

Financial Functions that use the Data Set

These functions are under the Mony drop down key.

DNPV

 

 

DNPV(i) = Data set NPV

 

i: int rate. NPV of Data Set

 

values as flows at reg intervals

 

for an investment, value are +

 

for flows in, - for flows out

 

i is %, eg 8.5% is 8.5

DIRR

 

 

Data set IRR

 

IRR using the Data Set

 

values as flows at reg intervals

 

for an investment, value are +

 

for flows in, - for flows out

 

DIRR value is %, eg 8.5 = 8.5%

DTRtn

 

 

Total return on data percents

 

Data set should contain a set of

 

periodic returns. This calculates

 

the total return over all periods

 

Entries are %, eg 8.5% is 8.5

DARtn

 

 

Geo avg of data percents

 

Data set should contain a set of

 

periodic returns. This calculates

 

the geometric average return

 

Entries are %, eg 8.5% is 8.5

D2Rtn

 

 

Convert Data Set to

 

returns for each period. Set is

 

sequential balances at regular

 

periods, eg monthly, daily

 

This replaces all the data with

 

returns as %, eg 8.5% is 8.5

D2Bal

 

 

Convert Data Set to

 

balances for each period.

 

Answer is starting amount

 

Data set is sequential returns

 

at regular periods, eg monthly

 

Returns are %, eg 8.5% is 8.5

 

This replaces all the data with

 

balances for each period

 

 

 

Using RCnt

Under the Misc dropdown key, youíll find a function named RCnt which holds the repeat count. This is the count of the number of times ENTER or DataIn has been tapped between changes to the command box. This can be useful when working with the Data Set. If you use RCnt as the argument to the Data function, each time you tap ENTER without changing the command, the next Data Set value will be retrieved.

This can also be used with the value memories. As mentioned above, you can access the memories using the form M(n) where n is the number of the memory to retrieve. If you enter M(RCnt), then repeatedly tap ENTER, Napier will step through the value memories.

You can also use RCnt to generate a series of values. For example, if you want to see a set of small angle sin values, you could enter the expression:

Sin(.01 * RCnt)

Then tap DataIn repeatedly. This will append the series of sin values to the Data Set, starting at angle .01 and increasing by .01 for each entry. If you tap ENTER instead, youíll get the same results, they just wonít be saved anywhere, except for the last 10 in the automatically saved answer history list.

If you have a set of data such as grades or annual returns for a set of stocks, you can get the percentile rank of each in turn by entering the expression:

PctlR(Data(RCnt))

Then tap ENTER repeatedly to see the percentile value for each entry in turn. Whatís happening is that the Data(RCnt) inner expression returns each successive entry in the Data Set, which then is used by the PctlR function as the value to get the percentile for. You can use DataIn for this too, the percentile values will be appended to the end of the existing values in the Data Set.