^{®} HelpPersonal Edition 5.0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||

topaccolades.com | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||

Welcome to Numipulator from TopAccolades Ltd. Numipulator enables you to develop games, puzzles and other graphical applications without your having to write programs that specify a set of instructions, which you would have to do in most computing languages. You will still be writing programs, but you do so using a language that is possibly the simplest programming language in existence. At its heart, it is an advanced numerical manipulator and calculator, suitable for business, education and home use. Crucially, it enables you to carry out calculations not only on individual numbers but on lists of numbers, to determine properties of lists of numbers, including statistical functions, and to manipulate lists of numbers. Graphical interfaces The graphical output for an application always consists of a grid of graphics cells. There are two graphical interfaces that both make use of a grid. The simplest is the Animation Zone, which allows no direct user interaction but has a nine-button square game keypad that the user can press (e.g. to select a directional arrow). The other grid, the Graphics Formatter, allows the user to click/tap on individual cells to provide interaction. The key to developing graphical output, in both cases, is the mapping of numbers to format (including colour, border and, in some cases, shape, character, emoji or image), to be displayed in the cells of the grid. In the simplest graphical interface, the Animation Zone, the number 1 is mapped to a white square, 2 to a black square, 3 to a red square, 4 to a green square, 5 to a blue square, and so on up to 20, which is mapped to a beige square. So, the list of numbers 5, 1, 3, 4 would be displayed in the interface as four square cells with borders: a blue one, a white one, a red one and a green one. Larger numbers can be used to specify millions of different colours. Overall, the cell displays of the graphical output of any application in the Animation Zone are derived from one input list of numbers, all of which are format codes. For a 10x10 grid, the input list must have 100 numbers in it, while a 20x20 grid must have an input list with 400 numbers in it. Note: negative format codes result in borderless squares, while 0 results in a borderless black cell (useful for background). The Graphics Formatter is more complex and has, as inputs, two lists of numbers of the same length. The first represents a list of values, while the second represents a list of format codes. With this, each pair of cells from the two lists together define the display of the corresponding cell in the grid (e.g. the display of the 3rd cell in the grid is determined by the 3rd value in the list of values and the 3rd format code of the second list). So, the pair of numbers -54.2 and 5 displays the value -54.2 on a blue background. In this example, the format code is the same as that used for the Animation Zone, but many other codes are also available with the Graphics Formatter. With these additional codes, the 0-20 colour-related codes already described are still used, but this time to represent the foreground and background colours of certain characters, shapes, emojis or images. In addition, simple output mapping may be used to specify that certain text, or even nothing, be displayed instead of the simple number value, e.g. -2 might be mapped to the word Month, so that the word Month would be displayed in the output instead of -2. Overall, the resuting interface can display numbers, text, characters, emojis and other images, or simple colour. Numerical manipulation and calculation Clearly, the lists of numbers that are inputs to the Animation Zone or Graphics Formatter must come from somewhere. Individual calculations and manipulations are specified in numipulation boxes. Most of these are laid out in a grid-like fashion, and each of these has a reference name, e.g. A1 or L3 - similar to those found in spreadsheets. A reference name may be an input to any other numipulation box (or graphical formatter), enabling you to string together many calculations and manipulations in order to achieve your desired output, including specifying the output formats, all in one calculation, which can be triggered by pressing the = button (as with a calculator). The inputs to these numipulation boxes are either simple numbers or lists of numbers, or certain text that represents a number or a list of numbers, including pi (meaning π), keypad (representing the number of the key tapped on the keypad), or text/characters that are defined by the programmer to be mapped to numbers in inputs, e.g. A mapped to -1, B mapped to -2, through to Z mapped to -26, which enables letters to be used in inputs instead of certain numbers, so that the input number list A P P L E S O R A N G E is taken to be the number list -1 -16 -16 -12 -5 -19 -15 -18 -1 -14 -7 -5, if this proves useful, as it might do in word/letter games. All the calculations and manipulations are designed to operate only on numbers or lists of numbers, and to have as their output either a number or a list of numbers. The numbers in a list are separated by any number of spaces, commas, colons, semicolons, returns, tabs or comments {text within curly brackets like this}. Numipulator has no functionality to handle text (apart from the input/output mapping). The function or operation to be applied to these inputs (if any) is selected by the programmer from a drop-down list. This makes program development very straightforward and, together with the flexible approach to the inputting of numbers in lists, makes the Numipulator programming language very simple to learn, with little awkward syntax to be encountered. As well as being used to produce graphical output, these numipulation boxes can also be used to carry out numerical calculations and manipulations that you might normally carry out with a spreadsheet or other specialist application. It includes trigonometric functions, statistical functions, conversions (weight, distance, time, etc.), and functionality for solving quadratic and simultaneous equations. It supports the transfer of numerical data from a complete spreadsheet table or worksheet into one of its list inputs, and enables a formatted output list to be copied and pasted back into a spreadsheet worksheet, through its text-based Table Formatter. Numipulator and a spreadsheet working together can be a powerful combination. Processing engine, repetitions and state Unless you are programming a static puzzle, your program will need to handle dynamic graphics and user interaction. In some cases, a change in the graphics presented can be triggered by user interaction, e.g. clicking on a particular cell of the Graphics Formatter (in games or puzzles such as Peg Solitaire or Sudoku), while in others you will want the graphics to change even without user interaction (games such as the old Space Invaders game, where a player must interact with a constantly changing graphical interface). To handle the latter (and also the former), Numipulator incorporates a processing engine that enables you to perform a sequence of calculations using the numipulation boxes, rather than just one. In every cycle, the numipulation boxes are evaluated, as are the inputs to the graphical interfaces. These repetitions continue until a specified comparison between two number values succeeds, e.g. A1 > 0. After each cycle, the start of the next cycle can be delayed for a certain time (this can be specified as the evaluated output of a numipulation box). This delay time can be used to speed up or slow down the game speed; it also provides a time for the player to respond to the new graphics display in the Graphics Formatter. Most games and puzzles will need to incorporate some concept of state, e.g. the positions of pieces on a board, or the score. In Numipulator, this is implemented using special memory numipulation boxes, where an output from one cycle is transferred, by the processing engine, to become an input in the next cycle. Style of programming The style of programming found in Numipulator is called declarative programming, as the results of all outputs are declared, or specified (through its inputs and selection of function/operation to be applied), and you don't write programs that tell the computer how to go about executing the program: there is no provision for writing procedures or instructions about how the evaluation is to be carried out, and the language does not make use of variables, whose values can change during an evaluation. The mapping of inputs and outputs is also declarative, being specified by simple mapping statements. The main style of programming could also be described as programming with functions. Apps, numiplets and standalone apps The above functionality enables you to develop fairly sophisticated games, puzzles, utilities and business applications. You can save these as apps that run within the Numipulator environment. Each app is a complete Numipulator set-up: a set of definitions or specifications, mappings and settings. These Numipulator set-ups, called Numiplets, can be saved, either as simple text files or in local storage, if your browser supports this. With local storage, and a browser that allows actions to be carried out when you exit Numipulator, your current set-up is also saved automatically when you exit Numipulator as the Current Saved Numiplet, ready for automatic reloading when you open it again. You can also create standalone apps from your graphical Numiplets that should run in any browser, using the Numipulator Standalone Maker app. You can share these with others, maybe on your own website, by emailing them, or in some other way. Numipulator provides many built-in Numiplets, some business-related, some demonstrations, but mostly games or puzzles. We suggest you try these early on to help you to see and understand the power of Numipulator. Important You are strongly encouraged to save Numipulator locally, on your local PC or device, as this will give you improved performance and also allow you to use Numipulator when you're offline. The best way to obtain a local copy is to download it from www.numipulator.com. Alternatively, save it as a simple web page from the open Numipulator page (Numipulator consists of a single HTML file only). For example, with Chrome on a Windows PC, bring up the Save As... box (right mouse click or Ctrl-S), then choose the type as 'Web Page, HTML only(*.htm.*.html)' (not as Web Page, complete or any other option), and save to an appropriate folder. Similarly, on a Mac, save it with format Webpage, HTML Only. When you wish to use Numipulator again, just open the downloaded file in a suitable browser. The main components of Numipulator are numipulation boxes. These are modelled on the way you probably first learned to carry out addition, subtraction and so on at school. There, you probably laid out a simple calculation something like this:
That is, the inputs were placed underneath each other, a line was drawn, and the result was put underneath. The operation to be carried out was also made clear (+, or addition, in this case). A numipulation box is essentially a computerized version of this. For example, a numipulation box for carrying out simple operations on two numbers, such as addition and subtraction, looks like this:
The components of this are as follows: - At the top is a general description of the type of numipulation box - in this case Number Operation.
- The next two lines (in this case) are input fields, with labels.
- The next line normally consists of a drop-down list, from which you can select the operation (or function in other cases) to be carried out. The text shown in this may refer to the input labels, as in this case. This operation field separates the inputs from the result.
- Below this line is a result or output field, which also has a label (A1 in this example). This label is the reference name of the numipulation box - a key feature, as discussed later. Note: this field is also referred to as the reference field
- On the bottom line, with a yellow background, is a note field, in which you can add some text describing the output (or inputs);
- Also on the bottom line are two buttons, one green and one red:
- The green i button may be pressed after a calculation to summarize the inputs, their values and the output value. The information supplied is as given by the Values button, but just for this box. This enables you to see the output value (before any rounding), which is particularly useful for Common Numbers and Lists, where the output value is not shown in the box;
- The red X button clears the input and output values of the box, and changes the function/operation selection back to its default. Note: you will be asked to confirm this action.
Once the inputs have been entered, and the operation selected, the = button (Calculate) may be pressed; the result is shown in the result field (as shown above). The great advantage of this layout when compared to a calculator is that once the calculation has been carried out you see, or have access to, not only the result but also the inputs and the operation carried out. You won't feel the need to repeat the calculation just in case you entered the wrong numbers or pressed the wrong operation key. And because the standard layout has five Number Operation numipulation boxes, each, by default, ready for a different operation (+, -, X, / and %), in order to carry out the operations commonly found on a calculator you don't even have to select the operation from a drop-down list - just choose the box already displaying this operation. This layout also provides considerable advantages when compared to a spreadsheet. Most importantly, you don't have to enter a formula just to multiply two numbers together. In fact, with Numipulator, you don't have to enter formulae at all - just select the operation to be carried out (although you can choose to define your own expressions in Row X and elsewhere). Furthermore, the operation remains visible in the box, whereas on a spreadsheet the formula is not generally displayed - only its resulting value. There are many types of numipulation box, some simpler, some more complex than the Number Operation box. When the = button is pressed, all the calculations are carried out and the results put into the results fields. Note: to display Help specific to a particular type of numipulation box, click on the numipulation box heading, or type name, (e.g. the words 'Number Operation') at the top of the numipulation box. This will open up the Help page in the Information Zone and move to the beginning of the relevant section of the page. You can also get relevant Help for other features by clicking on other headings including: 'Constants and Internal Values', 'Repetitions', 'Table Formatter', 'Graphics Formatter' and 'Animation Zone'. This is an area near the top of the page which is opened when you request further information or output, e.g. Help, Getting Started, Notes, Values and Flow. To close this, just tap on its Close button. You may also tap the Open button in this to display the contents in a new window (whether this happens depends on your browser/device). These buttons are found down the left side of the page. They should remain in this position even when the page is scrolled, so should always be available. ▲ : Make the whole page visible (but not necessarily the Information Zone), and scroll to the top of the page. Help : Open this Help page in the Information Zone. IM : Initialize Memories: for every Memory Number or Memory List, replace the text in the mem field with the text in the init field, unless the init field is empty. Clear : Clear/Reset All (clear all inputs and outputs, set the number of numipulation boxes for each A-Z type to the default 5, and set operation selections and most other settings (inc. rounding and separator) back to their defaults). Note: You will be asked to confirm this action, but in case you accidentally delete data, all your settings are saved in the Main Output window towards the bottom of Numipulator. Notes : Show, in the Information Zone, the reference name and accompanying note for any numipulation box that has a note defined. Values : Show, in the Information Zone, the definitions, values and notes for numipulation boxes and other fields involved in the last calculation, in the order of evaluation. Flow : Show, in the Information Zone, the relationships between all defined numipulation boxes and other fields, in a top-down fashion. Save : Save current set-up to local storage, as Current Saved Numiplet, or, if local storage is unavailable, show the current set-up in the Information Zone ready for saving to a text file. = : Calculate (carry out one set of calculations). Start : Initialize memories, then start a series of repetitions, as defined by the Repeat until condition. Go : Start, or continue, a series of repetitions, as defined by the Repeat until condition (with no memory initialization). Stop : Stop a series of repetitions at the end of this cycle and display the results so far. The Number Operation numipulation box deals only with numbers. Others deal with numbers and lists of numbers, or just with lists. Most people are familiar with lists of numbers. After or during shopping, we may want to add up the total of everything we've bought from a number of shops; or, we may want to look through a list of prices and select the most or least expensive or check how many items we bought. Numipulator differs from calculators and spreadsheets in that lists are handled as core object types, which can be manipulated as a whole. Lists, whether as inputs or results in numipulation boxes, are always shown as multiline text areas, in contrast to numbers, which are shown as single-line text fields. One of the simplest types of numipulation box that handles lists is the List Function to Number box. This takes a list as its input and produces a number as its result.
This numipulation box lets you easily find out several simple properties of the list, such as the sum of all its values, the number of items, the minimum, the maximum, or the average. For the more statistically-minded, it also lets you calculate properties such as the median, first quartile, variance or standard deviation. In many cases, lists are handled item by item. This makes Numipulator very convenient for handling many numbers when you wish to carry out the same operation on each. So, for example, the Items Operation numipulation box carries out the same operation on corresponding items in two lists to give the resulting list, as shown in the first example below. If the second list consists of just one item, it will carry out the same operation using this number on each of the items in the first list, as shown in the second example below.
In some cases, a list consists of a set of parameters for an operation. So, for example, the List Generation numipulation box with numbers 1, 3, 8, 11 in the input field and a selected operation of 'Integers p1->p2' generates a list of integers for each pair of numbers, i.e. from 1->3 and 8->11 in the input list, giving a result list 1, 2, 3, 8, 9, 10, 11.
Putting in a number into a number field
is straightforward. Just type or paste a single number into the field.
This may be an integer (whole number), negative number, a decimal fraction (e.g.
3.25, 4.01 or .2), or an e-notation number (e.g. 2.4e+3, which means 2.4X10 A list is simply a sequence of numbers separated by one or more of the following: space, tab, paragraph (newline or carriage return), comma (,), semicolon (;) or colon (:). Note: your browser will probably not allow tabs to be entered when typing, but you can paste in lists that use tab-separated items. So, the list of numbers 1, 2, 3 may be entered in a list field as, for example:
This makes Numipulator input straightforward, as the numbers may be copied from many other applications, such as spreadsheets, in their native format and then pasted into the list field. Although the list field is small, you may paste a very large table from a spreadsheet into it; it won't be easy to see, but it will be there. The different types of separator also enable you to format your inputs, if you wish; in the List Generation example above, the two pairs are shown on different lines, while the two members of each pair are separated by a comma and space, so that the pairs of parameters stand out. Comments A list, or even a number, field may also include comments. A comment begins with an opening curly bracket, {, and ends with the next closing curly bracket, }. The comment is treated as a separator, but is otherwise ignored. Although lists and numbers are the only core object types in Numipulator, some numipulation boxes are designed to perform operations on or transformations of a table. In such cases, the input table is always defined by two inputs: a list and a number (a positive integer). - The list (given the identifier la) always represents the values in the cells of the table, laid out along the rows (starting at the top row and always going left-to-right).
- The number (given the identifier ncols) always represents the number of columns in the table;
So, the input table 1 2 3 4 would be represented by la=1, 2, 3, 4, 6, 3, 2, 7, 8, 9, 0, 1 and ncols=4 The number of rows in the table is, of course, implied by la and ncols. Because the only core object types in Numipulator are lists and numbers, a table cannot be the result of a numipulation box. However, the list of cell values can, of course, be given as the result. So, for example, if the above input table had its rows and columns transposed in an operation, giving the table 1 6 8 the result would be given as the list of cell values (starting at the top row and always going left-to-right): 1, 6, 8, 2, 3, 9, 3, 2, 0, 4, 7, 1 Note: Numipulator uses the number of columns as a parameter (rather than number of rows) because tables of data in spreadsheets are generally designed to have a fixed number of columns, but a variable number of rows, so, when handling a table, the number of columns is generally a given. Numipulator bases its handling of a table where la is an empty list accordingly, i.e. treating the input table as still having a given number of columns, but no values in these (i.e. 0 rows). So, if la=L0 (representing an empty list, as discussed later) and ncols=3, the sums of its columns would be 0, 0, 0 (3 columns, each with a sum of 0), while the sums of its rows would be L0 (an empty list, as there are no rows). Note: Numipulator also provides a single Table Formatter, a Graphics Formatter and an Animation Zone. These take a list of numbers and format the list as a table (the Table Formatter allows you to specify a certain number of rows or columns, with the numbers laid out either horizontally or vertically). These, however, are not numipulation boxes and their outputs cannot be used as inputs to any numipulation box. They are for displaying results only. Numipulator's simple syntax does not allow lists to have sublists; only numbers are allowed as elements of a list. This means that you cannot directly represent lists with sublists, such as you might find in other languages (e.g. Javascript), of the form [[27, 28], [], [29, 30, 31, 32]], which is a list having 3 sublists, the first with 2 elements, the second with 0 elements (an empty list), the third with 4 elements. Such lists/sublists can be useful for storing data of different lengths. Instead, it allows a special type of number list, a structured list or SList, to be used, where the number of items in a "sublist" is placed before the elements of the sublist. So, the above example can be specified as 2 27 28 0 4 29 30 31 32, where a number in red here represents the number of items following (note that no items follow the 0). There are special functions (all of whose names begin with SList:) that allow the creation of SLists, the accessing of the contents of specified "sublists", and the lengths of the "sublists". These can be found in List Function to List, List Operation and List & List Operation numipulation boxes. Use of reference names in input fields You can, of course, just enter numbers or lists of numbers into the input fields and treat Numipulator as a powerful, easy-to-use calculator. But to get the most value from it, you need to make use of reference names. These allow you to specify that the resulting value of one numipulation box should be used as input to another numipulation box. In this way, complex calculations can be carried out with one press of the = (Calculate) button. The value of a numipulation box during a calculation is defined as: - the result of the operation in the box, if there is one (which will be shown in the result or reference field);
- the value defined by the reference field of the box, i.e. its input, if there is no operation in the box (e.g. Common Number or Memory Number).
As a simple example, if you bought something for 25.30 and sold it for 37.15, and you had to pay 20% tax on the difference, you could calculate the tax due using two Number Operation numipulation boxes, where the difference (A1) is an input to A2, which calculates 20%:
The reference name for a numipulation box whose value is a number may, of course, also be used in a list. So, for example, if the set-up included A1 and A2 as above, an input list might be defined as 42.36, A2, 53, where the value of A2, i.e. 2.37, is the second item. The reference names for lists may also be entered into other fields. There are three cases to consider: 1) Simple reference of one list for another list input. This specifies that the value, or result, of G3 should be used as the input. 2) Combination of reference names and/or numbers In these cases - and 1) is just a simple case of this - the items of the lists referred to are inserted as items of the input list. So, if G3 had a value 5, 6, 7, while A2 had a value 49 and G4 had a value 34, 35, 36, then the input list would be 46, 5, 6, 7, 49, 34, 35, 36. 3) A list reference name as input to a number field The reference name of a numipulation box that has a list value may also be specified as the value of a number input field. In this case, the number taken as the input is the first item on the list. So, if G3 has a value 5, 6, 7, and G4 has a value 34, 35, 36 and you enter G3 and G4 as the inputs of a Number Operation addition, the result would be 39 (i.e. 5 + 34). This feature makes Numipulator very flexible and has two main uses: a) You can use numipulation boxes concerned with operations on items of a list to handle single numbers. Several numipulation boxes are concerned with operations on items of a list. For example, as well as Number Operation numipulation boxes concerned with the addition, subtraction, and so on, of simple numbers, there are also Items Operation boxes dealing with the same operations on corresponding items in a list. A list may, of course, have just one item, so you could put individual numbers into each of the input fields of an Items Operation box and have a result that is also a list with a single number. The ability to use reference names of lists in inputs to number fields means that you can effectively treat Items Operation numipulation boxes as additional Number Operation boxes (and others similarly) if you find the need. Because of this feature, Numipulator does not include individual number-only versions of some of its more complex numipulation boxes (Measure Conversions or If-Then-Else boxes, for example); the list versions supplied can be freely used to handle single numbers. b) You can operate on the first item of a list without any intermediate step If you know that you're interested only in the first item of a list (maybe you've already sorted it in descending order and want to operate only on the largest number), you can specify the list as the input to a number field, without needing explicitly to extract the first number. Common Numbers and Common Lists Frequently, you will want to carry out some calculations on the same number or list (which you already know, and don't need to calculate), or you will just want to enter your input data, numbers or lists in some convenient locations. The Common Number and Common List numipulation boxes, found in rows D and E, are available for this purpose. These have input fields only and no separate output/result field. Enter the number or list in the only field of these boxes (apart from Note, of course) and refer to it as input to any other numipulation boxes. There are also wider Common Number boxes (called Num1 and Num2) and wider Common List boxes (called List1 and List2) near the Table Formatter. These are particularly suitable for entering data where you wish to include comments, or make use of the wider note field. Many of the built-in Numiplets make use of these, as they are close to the Table and Graphics Formattters and Animation Zone. Note: You can also enter reference names in these input fields, but you will not see the resulting value displayed in the box. It will continue to display the reference name(s). Pressing the green 'i' button to the right of the note, will show you the value, if you wish to see it, following a calculation. So, if you wanted to calculate the difference between the maximum and minimum values of list 3 2 4 6 5 7, enter this in Common List E1. You could then enter E1 as the input of C1 and select Maximum value, and also as the input of C2 and select Minimum value, and enter C1 and C2 as inputs of A1, with the Subtract operation selected. The results would be: C1=7 Note: this is by way of example; you could calculate the difference between the maximum and minimum values more easily by entering the list as input to C1 and selecting Range. Ensuring you enter the correct reference name The numipulation box you wish to refer to may be some way away from the box in which you're entering its reference name. It is easy to forget the reference name or mistype it. Numipulator provides two facilities to help you: Transfer of reference name using the asterisk If you click on the reference name of a numipulation box, i.e. on the bold, white name to the right of the reference field, this reference name is remembered by Numipulator. It is also shown in the Selected Name field, in the middle near the top of the page. At any time after that (until you click on a different reference name), if you click on the asterisk (*) to the left or below an input field (list or number), the reference name will be inserted into the field. The mode of insertion differs for number fields and list fields: - for number fields, which can take only one value, the reference name replaces any existing input value;
- for list fields, which can take any number of values, the reference name is added at the end of any existing values.
Showing notes It is good practice, when undertaking complex calculations, to enter a note in each numipulation box, to remind yourself of what the value refers to, e.g. Co-ordinates of X; Initial Amount; Interest Rate; or Price List. To help you quickly see which reference name you should be entering, you can press the Notes button on the left; this will display the reference names and accompanying note of each numipulation box with a note in the Information Zone. Underneath the main rows of numipulation boxes is a box labelled Constants and Internal Values. This lists the built-in unchangeable values you can use, namely pi, e* and L0 (that's L-zero not L-oh). It also contains the name of a list called now that is concerned with the date and time, and click, which indicates whether a mouse-click has occurred in the Graphics Formatter, and keypad, which is associated with the Animation Keypad. These are reference names that can be used like any other reference name, i.e. you can enter them in input fields and you can click on the names in the Constants and Internal Values box to put the reference name into memory ready for placing in input fields via the asterisks. The first two, pi and e*, represent the well-known mathematical constants π, approx. 3.142, and e (the base of natural logarithms), approx. 2.718. We use e* rather than e to free the single letter up for textual outputs. The third item, click, has only two possible values, 1 or 0. In any calculation cycle, its value is 0 unless a mouse-click has occurred and been acknowledged in the Graphics Formatter just before this cycle, in which case it has the value 1. The fourth, keypad, has 10 possible values: 0-9. If the Animation Keypad has been clicked since the beginning of the previous cycle, it will be set to value represented by the click. If no such click has been made, it will be set to 0. The last, L0, represents the empty list, i.e. a list with no items (think of it as the list equivalent of the number 0 - a list with zero items). This symbol is also output in a result field if the result is a list with no items. For example, if you use a Find All numipulation box to find all the items in list 10, 20, 30, 40, 50 that are greater than 60, Numipulator will, of course, find no items. Rather than leave the result field blank, the result L0 is output. You can also enter it as an input in list fields (see later for why you might want to do this). If, however, you enter it in a number field, the calculation will result in an error message in the result field, since an empty list has no first item that can be used in the calculation. The fifth item, now, is a list of numbers associated with the time and date. The values on the list are calculated at the beginning of a calculation cycle (i.e. as soon as an = button has been pressed, or at the beginning of each repetition cycle). The list contains 8 items, all referring to the local date/time determined at this moment (according to the user's computer). The example below assumes the date is August 29, 2023, and the time is 10:14:57 (i.e. 57 seconds after 10:14am) Date Format: The date in YYYYMMDD format, i.e. 20230829 The value of now would be: 20230829, 2023, 8, 29, 10, 14, 57, 1693300497784 Remember: This value is evaluated once and once only in each calculation cycle: at the beginning. Many numipulation boxes have, as one of their list inputs, a list that is to be treated as a set of individual items. If there is only one of these, the length of the item list determines the length of the resulting list, since the operation is carried out for each item on the list of items in turn, and the individual results determine the output. The label of such a list is always given in square brackets, e.g. [a] or [b]. The descriptions of the operations that can be selected generally refer to the letter inside the brackets. So, for example, a Count numipulation box has two input lists, la and [b]. A typical operation that can be selected is Items on la < b. Given an input list la = 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 and a list of items, [b] = 12, 5, 0, the result would be 10, 4, 0 (i.e. 10 items < 12, 4 items < 5 and 0 items < 0). Several types of numipulation box carry out operations or comparisons on the corresponding items of two or more lists. For example, the Items Operation box takes two lists and carries out simple operations such as addition or subtraction on the corresponding items. So, we saw above that in such a numipulation box, if the first list contains items 2, 4, 6, 8 and the second 3, 4, 5, 6, then selection of the Add operation results in the list 5, 8, 11, 14. Clearly, for this to work the operation has to have the same number of items to work on. But, in fact, as seen in the second Items Operation example earlier, we can have several items on the first, but only one on the second. This is because Numipulator allows cycling of items, as explained next. If there is more than one list of items, one of these - and it's always the top one - is treated as the primary item list, and given a single quote after its name to denote this, e.g. [a]'. All others are treated as secondary item lists, and given a double-quote after their names to denote this, e.g. [b]". The primary item list determines the number of operations carried out, since the operation is carried out on each of its items in turn. The secondary items are taken one at a time to be used in these operations; if the end of a secondary item list is reached but there are still items in the primary list to be dealt with, items are selected from the beginning of the secondary list again. That is, the secondary items are cycled to match the primary items. To demonstrate, suppose the primary list, [a]', has values 2, 4, 6, 8 - that is, 4 items. Let's look at what happens if a secondary item list has 1, 2, 3, 4 or 5 items in it. - if [b]" has one item = 10, then it is treated as the list 10, 10, 10, 10
- if [b]" has two items = 10, 20, then it is treated as the list 10, 20, 10, 20
- if [b]" has three items = 10, 20, 30, then it is treated as the list 10, 20, 30, 10
- if [b]" has four items = 10, 20, 30, 40, then it is treated as the list 10, 20, 30, 40
- if [b]" has five items = 10, 20, 30, 40, 50, then it is treated as the list 10, 20, 30, 40 - i.e. any surplus items are ignored
The common cases, where there is just one item on a secondary item list or the same number as on the primary item list, can be seen to be special cases of this general approach to handling more than one item list. Parameters and excess parameters Several numipulation boxes (List Generation, Range Selection, Table Operation and Formula) have a list input where the list is treated as a list of parameters. The label for such a list always begins p1,p2 . The operation selected includes information about the number of parameters expected (e.g. Integers p1->p2 implies 2 parameters; p1 random ints p2->p3 implies 3 parameters). In all cases, the list may include more than one set of these parameters. So, for example, an input list 2, 5, 8, 12 for Integers p1->p2 would yield a result 2, 3, 4, 5, 8, 9, 10, 11, 12 (i.e. integers 2->5 followed by integers 8->12). If the number of parameters in the input list is not a whole number multiple of the number of parameters expected, any excess ones are ignored. So, for example, if the input list to Integers p1->p2 were 2, 5, 8, 12, 14, the last number 14 would be ignored and the result would be the same as for an input list 2, 5, 8, 12. Mostly, the sets of parameters are considered as independent, and the result list consists of the results based on the first set of parameters, followed by the results based on the second set of parameters, and so on - as shown for the Integers p1->p2 example above. With Range Selection, however, the sets of parameters are considered all together, and only one set of results is produced. The label of the parameter list denotes this using the character '|' (read it as OR) as a separator between the sets of parameters: p1, p2
| By default, when list results are displayed, the items on the list are separated by a paragraph, i.e. each item on a new line. You may choose to change this by clicking on a different radio button under Output Separator for Lists in the Settings box towards the bottom of the Numipulator page. You can choose to have items separated by a paragraph, a comma, a semicolon, a space, a comma+space, a semicolon+space, or a tab. All list result displays will use the selected separator. Most of the numipulation boxes are laid out as a table. As standard, Numipulator has 5 columns. The following description is essentially for a 5-column layout. The rows are A, B, C ... Z, while the columns are 1, 2... 5. The reference names of the boxes are derived from their positions in the tables: A1, A2, A3, A4, A5 Note: There are 25 rows: there is no row I. The general layout is that the more commonly-used or more easily understood numipulation boxes are towards the top. So, the operations or functions normally found on a simple calculator are in rows A and B, while simple functions of lists, e.g. summing up the items, are found in row C. Memory Number and Memory List, are in rows Y and Z - close to the Repetitions area, as they are generally used with repetitions. There are also two other numipulation boxes, which are wider than others, just below row Z, on either side of the Constants and Internal Values box. These are a Formula box and an Equation Solver box. The expectation is that these will normally be used for single calculations, hence there is only one of each. At the end of each row of boxes (A-Z) are two buttons: a + and a -. Pressing the + button adds a new row of 5 boxes of the same type under the current row, with appropriate reference numbers, e.g. A6 - A10. There is no theoretical limit to the number of additional boxes. Pressing the - button removes the last row of boxes, although you may not have less than one row of 5 boxes. Note that you will be asked to confirm deletion of a row of boxes. Near the top of the Numipulator page, on the right, is a drop-down menu of the sections of the page (except for the Information Zone), including the individual rows of the main table. Selecting one of these hides the sections between the menu area at the top and the selected area, so that the selected area is near the top. You may restore the hidden sections, and move to the top of the page, by pressing the white up-arrow on a black background to the left of the menu, or the white up-arrow at the top of the main buttons on the left. Numipulation boxes - types and operations Please note that the following symbols for number comparison are used in some
of the descriptions below: These take two numbers as inputs and produce a number as a result. Important: The Calculator and Expression functions found in List Function to Number enable multiple operations to be performed rather than just one (see also the Calculator list and Expression list functions in List Function to List, and the Calculator (a Op Num...) and Expression (a Op Num...) functions in Items Coded Operations). Add: a+b Simple addition of a and b. Example: a=5, b=2: Result=7 Subtract: a-b Simple subtraction of b from a. .Example: a=5, b=2: Result=3 Multiply: aXb Simple multiplication of a and b. Example: a=5, b=2: Result=10 Divide: a/b Simple division of a by b. Example: a=5, b=2: Result=2.5 %: aXb/100 Result is b% of a. Example: a=150, b=10: Result=15 % add: a+(aXb/100) Result is a + b% of a. Example: a=150, b=10: Result=165 (150+15) Note: this is useful for taking a base price (a) and determining price including tax, at rate b%. Power: a^b Result is a Round a to b dec. pl. Round a to b decimal places. Example: a=2.3467, b=2: Result=2.35. Div: a DIV b Integer division (results for non-integer inputs undefined): the number
of times a can be divided by b, possibly leaving a remainder. The above examples deal only with positive integers. But what about negative numbers? There are several ways of handling DIV and MOD (see below) for negative numbers - and they give different results. Numipulator takes the following approach: a DIV b is a/b rounded down to the nearest integer below (whether a and b are positive or negative). 7 DIV 3 = 2 (2.33 rounded down to 2); Mod: a MOD b Modulo, or integer remainder obtained by subtracting (a DIV b)Xb from
a. Results for non-integer inputs are undefined. a MOD b = a - (a DIV b)Xb in all cases, so 7 MOD 3 = 1 (7-(2X3)); Perm: a!/(a-b)! Number of permutations of b items from a set of a distinct items ( Note: as with factorials generally, these numbers can be very large and may return Infinity or some other error. Comb: a!/b!(a-b)! Number of combinations of b items from a set of a distinct items ( Note: as with factorials generally, these numbers can be very large and may return Infinity or some other error. Random int a->b The result is a pseudorandom integer between a and b (inclusive). Check (1/0): a<b If a<b, the result is 1, otherwise the result is 0. Other Check (1/0):....operations are similar. If the check is true, the value 1 results; if not, the value 0 results. Logic (1/0): a AND b If both a and b are not zero, the result is 1, otherwise the result is 0. Logic (1/0): a OR b If either a is not zero, or b is not zero, or both are not zero, the result is 1, otherwise the result is 0. Logic (1/0): a XOR b If one of a or b is zero while the other is not zero, the result is 1, otherwise the result is 0. Logic (1/0): a NAND b If both a and b are not zero, the result is 0, otherwise the result is 1. Logic (1/0): a NOR b If either a is not zero, or b is not zero, or both are not zero, the result is 0, otherwise the result is 1. Logic (1/0): a XNOR b If one of a or b is zero while the other is not zero, the result is 0, otherwise the result is 1. Index: [a,b] 10 cols For a table with 10 columns, the result is the index or list position of the item at row a column b. This is designed to be useful when using the 10 column wide default visible area of the Graphics Formatter. Row: Index a, b cols For a table with b columns, the result is the row in which the element with index a (the ath element) would be found in that table. Col: Index a, b cols For a table with b columns, the result is the column in which the element with index a (the ath element) would be found in that table. These take one number as an input and produce a number as a result. As with Number Operations, the Calculator... and Expression... functions found elsewhere allow more than one function to be applied, and also a mixture of operations and functions. Square The number multiplied by itself, i.e. a Square Root The (non-negative) square root of the number, i.e. a +/-: aX-1 Change sign (multiply by -1). Example: a=-5.6: Result=5.6. Example: a=5.6: Result=-5.6. Absolute value If a>=0, then result=a. If a<0, then result=aX-1. Round to nearest int. Round to the nearest integer. If the decimal fraction = 0.5, round to
next highest integer. Round to 1 dec. pl. Round to 1 decimal place. Multiply a by 10, round this to nearest
integer, then divide by 10. Round to 2 dec. pl. Round to 2 decimal places. Multiply a by 100, round this to nearest
integer, then divide by 100. Nearest int. <= a Round to the nearest integer less than or equal to the number.
(Sometimes called the floor function). Nearest int. >= a Round to the nearest integer greater than or equal to the number.
(Sometimes called the ceiling function). Reciprocal: 1/a 1 divided by a. Example: a=5: Result=0.2. Example: a=0.2: Result=5. Increment: a+1 Result=a+1. Example: a=-3. Result=-2. Example: a=3: Result=4. Example: a=2.5: Result=3.5. Decrement: a-1 Result=a-1. Example: a=-3. Result=-4. Example: a=3: Result=2. Example: a=2.5: Result=1.5. Log base 10 Result=logarithm Log base e Result=logarithm Antilog base 10 Result=10 Antilog base e Result=e Factorial: a! The factorial of a number is defined only for non-negative integers, i.e. for
0, 1, 2, 3, 4, etc. The factorial of a where a >= 1 is aXa-1Xa-2......X1. Sine (rads), Cosine (rads) and Tangent (rads) These trigonometric functions generate the sine, cosine and tangent of angles
expressed in radians. Arcsine (rads), Arccosine (rads) and Arctangent (rads) These trigonometric functions generate an angle, expressed in radians, whose
sine, cosine, or tangent, respectively, is the input number. The number of
solutions to these is infinite; Numipulator takes the single
solutions generated by the underlying Javascript mathematical functions.
Note: the inputs for arcsine or arccosine should lie between -1 and +1;
other inputs will yield a result of NaN (Not a Number). Sine (degs), Cosine (degs) and Tangent (degs) These trigonometric functions generate the sine, cosine and tangent of angles
expressed in degrees. Arcsine (degs), Arccosine (degs) and Arctangent (degs) Identical to arcsine (rads) etc., but the angle generated is expressed in
degrees rather than radians. Check (1/0): Integer If a is an integer, the result is 1, otherwise the result is 0. Other Check (1/0):.... functions are similar. If the check is true, the value 1 results; if not, the value 0 results. Note: For the checks on Prime, Odd, and Even, a non-integer input value always results in the value 0. For the check on Prime, any value < 2 results in the value 0. The value 0 is classed as an Even number in Numipulator (even though some mathematicians class it as neither odd nor even). Note: the check for a=0 is equivalent to the logic function NOT. If a=0, the result is 1, while if a=1 or any non-zero value, the result is 0. Note: the check for a<>0 returns 0 if a=0, and 1 if a is non-zero. Logic (1/0): NOT a If a is zero, the result is 1, otherwise the result is 0. Logic (1/0): a If a is zero, the result is 0, otherwise the result is 1. Row: Index a, 10 cols For a table with 10 columns, the result is the row in which the item at position a in the list of items forming the table occurs. This is designed to be useful when using the default 10 column visible area of the Graphics Formatter. Col: Index a, 10 cols is similar but gives the column in which the item at position a occurs. List Function to Number - Row C These take a list as input and produce a number as a result. Important: These functions may also be applied to individual rows or columns of a table, using the Line List Functions of Row S. Sum of list values Simple addition of all the numbers in the list. Example: la=2, 4, 6, 8: Result=20. Product of list values The result is obtained by multiplying all the numbers on the list
together. Note: the product of an empty list is defined as 1. So, if la=L0, the result=1. Average (mean) The result is the sum of the list values divided by the number of items on
the list. Maximum value The result is the maximum value on the list. Example: la=2, -10, 4, 8, 6: Result=8. Minimum value The result is the minimum value on the list. Example: la=2, -10, 4, 8, 6: Result=-10. Range The result is the maximum value on the list - the minimum value. Length of list The result is the number of items on the list. Example: la=2, -10, 4, 8, 6: Result=5. First item The result is the first item on the list. Example: la=2, -10, 4, 8, 6: Result=2. Last item The result is the last item on the list. Example: la=2, -10, 4, 8, 6: Result=6. Random item The result is one randomly-selected item on the list. Example: la=2, -10, 4, 8, 6: Result=4 (or maybe -10, 8 or 6). First Quartile This is the 25 For those not used to percentiles, some explanation is required. Even for those familiar with them explanation is due, since percentiles are defined and implemented differently by different systems. The p For example,
given 7 numbers 10, 20, 30, 40, 50, 60, 70, the 25 To determine the p In most cases, the rank of the p If the rank of the p Median This is the 50 Third Quartile This is the 75 Interquartile Range This is the 75 Variance (N) If the numbers in a list represent some characteristic of a complete
population, the variance is Σ((x-mean) Variance (N-1) If the numbers in a list represent some characteristic of a sample of a population, the
value given by Σ((x-mean) Standard Dev'n (N) The standard deviation of a complete population is the square root of the variance ( Variance (N) ). Standard Dev'n (N-1) The standard deviation of a sample population is the square root of the variance ( Variance (N-1) or unbiased variance). This is often known as the unbiased standard deviation. Sum of squares The result is the sum of the squares of all the numbers. Example: la=2, 3, 4: Result=2 Root Mean Square The result is the square root of the average of the squares of the numbers,
i.e. √(sum of squares/N), where N is the number of items. Sum:X10^n...X10,X1 If the list has n items in it, the result is item1X10 This is intended to generate an integer from a list of its constituent numerals. Check (1/0): Ascend If every item on la <= the following item, if any, the result is 1, otherwise the result is 0. An empty list returns 1. Check (1/0): Descend If every item on la >= the following item, if any, the result is 1, otherwise the result is 0. An empty list returns 1. Check (1/0): Unique If there are no duplicates on la, the result is 1, otherwise the result is 0. An empty list returns 1. Check (1/0): L0 If la is an empty list (no items) the result is 1, otherwise the result is 0. Check (1/0): Not L0 If la is an empty list (no items) the result is 0, otherwise the result is 1. Case: < The numbers on the list are taken as parameters of a case statement. The list is best considered in groups of 3, as follows: The meaning is: If no default value is given and none of the specified checks succeeds, the result is undefined. Any surplus number (e.g. if there were a number k above) is ignored. Example: Suppose la is given as: If D1 had the value 7, the result would be the default value 104 (the surplus number 105 is ignored). If the numbers 104 and 105 were removed from la, the result would be undefined in this case, as no checks succeed and there is no default value. Other Case: ... functions (except Comp) operate similarly, but with a different comparison operator. Case: Comp The numbers on the list are taken as parameters of a more complex case statement, where the checks in each can be different.
The list is best considered in groups of 4, as follows: The second item in each group of 4 represents a comparison operator. This should be an integer from 1 through to 6 or, exactly equivalent, 14 through to 19: Why are there two set of values for these comparison operators when values 1-6 are almost certainly easier to remember? This is because Numipulator includes some built-in input Mappings that you can choose to use. Now, one set of these is for Number Operations, which includes <, <=,...> for numbers 14, 15, ... 19. In order that the same symbols may be used for comparison operators in Case: Comp and related functions, these mappings are also included for simple comparison operations, so it is necessary to use 14-19 as operator values. That is, it ensures that the Number Operation and Case Mappings are compatible. So, the meaning of: Example: Suppose la is given as: The treatment of surplus values and no default value is similar to that for the other Case: functions. Case: 1st Like Case: Comp, the numbers on the list are taken as parameters of a complex case statement. The first item on the list is the key number that is involved in every comparison made - always the first item in the comparison.
The remainder of the list (i.e. all but the first item) is best considered in groups of 3, as follows: Example: Suppose la is given as: The treatment of surplus values and no default value is similar to that for the other Case: functions. Calculator As with the various Case... functions, the input to this is a combination of numbers and operator codes: codes representing Number Operations, e.g. +, -, x and /. The codes that represent the number operations are as given in the list of codes (from pressing the Codes link above the Information Zone). So, 1 means add, 2 means subtract, 3 means multiply and 4 means divide, for example. The input list, la, starts with a number, which is followed by any number of operator code and number pairs, i.e. number, operator code, number, operator code, number... The first three represent an operation. The result of this feeds into the next operation, and so on. So, a list beginning 2,3,5, which means 2 x 5 and yields the result 10, becomes the first argument of any next pair. So, the input list 2,3,5,2,4,3,10 yields the result 60, as they represent the expression (((2 x 5) - 4) x 10). This is called the Calculator function because it resembles the operation of a calculator, where the result of the first operation becomes the first input of the next operation. Reminder: 2 + 4 x 5 gives the result 30, i.e. (2 + 4) x 5, not 22, i.e. 2 + (4 x 5), which would be the expected result using normal operator precedence. With this Calculator function, all operators have the same precedence, so evaluation is simply left to right. It can be useful to specify Mappings as follows to allow more readable input lists: The input list 2,3,5,2,4,3,10 can then be input as 2 x 5 - 4 x 10, still giving the result 60. This function clearly enables you to specify more complex calculations than a single Number Operation. The Calculator function can also include number functions as well as number operations. The approach to incorporating these is quite simple. It makes use of a mock operator code, 100, to specify that a function is being used, followed by a number function code (again obtained from the Codes link at the top). So, the sequence 3 100 1 yields the result 9, as 1 is the code for the Square function operator, so that this means 3 squared. Likewise, the sequence 1 1 3 100 2 100 10 yields the result 0.5, as 1 1 3 means 1+3, i.e. 4, and 100 2 means apply the function Square Root, so gives the result 2, and then 100 10 means apply the function Reciprocal (1 divided by the input), so the final answer is 1/2 or 0.5. As with number operators, such sequences can be made much more readable by using text to map to these codes. So, using the following additional mappings: f 100 Square 1 Root 2 Reciprocal 10, this number sequence can be written as 1 + 3 f:Root f:Reciprocal (using : as the separator between the f and the function name), again giving the answer 0.5. Expression The input to this is the same as the Calculator function above, i.e. number, operator code, number, operator code, number, etc., including the number function codes as discussed above, with the meanings of the operator codes the same. The difference is that conventional operator precedence is used for the main operators (+, -, *, / and ^ (power)), as in the BODMAS/PEMDAS convention. With this, any power operations are evaluated first, followed by any multiplication or division operations, and then any addition or subtraction operations. With this convention, 2 + 3 x 12 / 2 ^ 2 has the meaning (2 + ((3 x 12) / (2 ^ 2))) and evaluates to 2 + (36 / 4) = 11. The same expression with Calculator precedence means (((2 + 3) x 12) / 2) ^ 2, which evaluates to ((5 x 12) / 2) * 2 or 30 ^ 2 = 900. Any sequential operators of the same precedence are evaluated from left to right. Now, there are many more operators in Number Operation than these, including ones beginning Check (1/0) and Logic (1/0). Apart from Check..., Logic..., Add, Subtract and Power, these all involve multiplication or division, so these have the same precedence as Multiply and Divide. Overall, the precedence of the operators is as follows:
This allows complex expressions to be specified. Again, it can be useful to specify Mappings to allow more readable input lists, as for Calculator. It is important to realize that Expression does not give you full expressive power, as no brackets/parentheses are available. So, to specify complicated expressions, you may need to use two or more Expression or Calculator functions. SList functions The following functions are all concerned with SLists only. They all take an SList as an input. The example SList for each function is la=2 27 28 0 4 29 30 31 32. Note: this has 3 "sublists". SList: head length Given an SList as an input, the output is the length of the content of the first "sublist" within the SList.
SList: length Given an SList as an input, the output is the number of "sublists" within the SList.
The result is list of the selected conversions for each of the numbers on the input list [a]. For example, if the selected conversion is foot->metre and the input list, [a], is 2, 3, 4, then the result is 0.6096, 0.9144, 1.2192. Notes: Some conversions for cases where the input or output is not a simple number, e.g. ft and inches to cm or vice versa, can be found in the Formula numipulation box. Notes on units: Many of these conversions are between metric/SI units and Imperial (sometimes used in the U.K. and some other countries) or U.S. measures. Sometimes, Imperial and U.S. measures with the same name are different. They are distinguished here by Imp or US. When measuring volumes, the U.S. measures differ according to whether measuring dry materials or wet materials (i.e. liquids). Only U.S. wet measures are given here (and are noted as US wet). Both the U.S. and Imperial systems employ short tons and long tons. A short ton is 2000lb; a long ton is 2240lb. However, traditional usage is for 'ton' alone to refer to 2000lb in the US, and to 2240lb in countries using Imperial measures. So, ton(US)=2000lb; ton(Imp)=2240lb. The hundredweight (cwt) is 1/20 of the respective ton. A tonne, also known as a metric ton, equals 1000kg. The abbreviation ft-pndal means foot-poundal (a poundal is a U.S./Imperial measure of force). A calorie has several definitions (close but slightly different values). The
International Table (IT) value is defined here. The term Calorie
(upper-case C) is also widely used, particularly when discussing nutrition and
exercise. 1 Calorie = 1000 calories or 1kilocalorie (1kcal). There are seven measures associated with dates and days: - Date: This is an 8-digit integer of form YYYYMMDD. For example, 20060405 is used to represent the date 5 April 2006. This format ensures that dates will sort into chronological order.
- Day Integer: Each date is associated with an integer. Day 0 is 1 January 1970. Day 1 is 2 January 1970. Day -1 is 31 December 1969, and so on.
- Year: The full year, e.g. 1973 or 2006.
- Month: A number, 1-12, where 1=January and 12=December.
- Day(1-31): Day of month (1-31).
- Day(1=Sun): Each day of the week is numbered 1 through to 7. In this format, 1=Sunday and 7=Saturday (typical North American style).
- Day(1=Mon): Each day of the week is numbered 1 through to 7. In this format, 1=Monday and 7=Sunday (typical European style).
There are conversions to allow you to convert from Date to Day Integer, Day Integer to Date, and Date to Year, Month, Day(1-31) and both forms of weekday numbering. So, Date 20060405 converts to Day Integer 13242. Using these conversions, you can easily calculate the length, in days, between two dates. Note: the Day Integers used in Numipulator, being based around Javascript, may differ from those in other packages. There are also many conversions that allow you to convert from so many of a given quantity (e.g. Million, Dozen), or from a unit with an SI prefix (e.g. kilo-, milli-) to individual units. So, if [a] had the value 2, 2.5 and the selected conversion were Dozen 12 then the result would be 24, 30. If the selected conversion were kilo- k (10^3) then the result would be 2000, 2500. Note: With the default rounding of 12 decimal places, conversions from small SI prefixes, such as atto- and femto-, may give the result 0. Ensure you use the Internal rounding when handling very small numbers. Note: Different countries or traditions use the same term to mean a different number. For example, a billion may mean 10 All the list generation operations let you generate lists of numbers, based on parameters in the input list. Some operations require one parameter, some two or more parameters. In all cases, more than one set of parameters may be entered; the list generated for the second and subsequent sets of parameters is joined to the end of the list for the first set of parameters. Note: In all cases, if a certain number of items to be generated must be specified, the number must be an integer. Similarly, if generating integers within some range, the range limits must themselves be integers. If these numbers are not integers, the result is undefined. p1 items of value p2 Generates p1 occurrences of the number p2. Example: parameters=4, 3.5: Result=3.5, 3.5, 3.5, 3.5. Integers p1->p2 Generates all integers between integers p1 and p2 (inclusive). Example: parameters=4, 8: Result=4, 5, 6, 7, 8. Vals p1->p2 inc by p3 Generates a list, starting at p1, in which all subsequent values differ from
the previous one by p3. If the next number to be generated is greater than
p2 (if p3 is positive) or is less than p2 (if p3 is negative), the number is not
included and generation stops. p1 is always included in the list. p1 vals, start p2, inc p3 Generate a list containing p1 items, starting at value p2, where subsequent
values differ from the previous one by p3. p1 pairs: p2 & p3 Generate a list containing p1 pairs of the values p2 and p3. p1 random ints 1->p2 Generates a list with p1 items, each being a pseudo-random number between 1
and p2 (an integer) inclusive. p1 random ints p2->p3 Generates a list with p1 items, each being a pseudo-random number between
integers p2 and p3 inclusive. Dates p1->p2 Generates all dates between integers p1 and p2 (inclusive). The two dates, p1 and p2, must be integers representing a Date as follows: an 8-digit integer of form YYYYMMDD. For example, 20060405 is used to represent the date 5 April 2006. The results will also be integers representing dates in this format. Example: parameters=20050227, 20050302: Result=20050227, 20050228, 20050301,
20050302. Primes p1->p2 Generates prime numbers between the given non-negative integers
(inclusive). A prime number is a positive integer that has exactly two
positive integer factors, 1 and itself. Example: parameters=1, 20: Result=2, 3, 5, 7, 11, 13, 17, 19. Prime factors of p1 Generates a list of prime factors for number p1. This list, which is always ordered in ascending order, is a list of prime numbers that, when multiplied together, result in the number p1. Note: this list can contain duplicates of numbers, e.g. the prime factors of 4 are 2, 2. Prime factors are defined only for positive integers - the result for all other numbers is undefined. Example: parameters=6: Result=2, 3 Numerals of p1 Generates a list of the numerals found in the number p1. Non-numeric characters, such as -, ., E, are ignored. Example: parameters=64502, 19: Result=6,4,5,0,2,1,9 R:Indices p1->p2,p3 col The parameters p1 and p2 are positive integers representing the start and end indices in a list of numbers. If this list were laid out in a table with p3 columns, then the result is a list of the row numbers in which these items would be found. Example: parameters=3,7,5: Result=1,1,1,2,2 Example: parameters=7,3,5: Result=2,2,1,1,1 - the reverse of the first example Example: parameters=8,8,5: Result=2 - returns the row number for index 8 Use: to convert a list index into a table row. C:Indices p1->p2,p3 col Similar to the previous one, but the column numbers are returned. Using the same first example, the result would be: 3,4,5,1,2 Example: parameters=8,8,5: Result=3 - returns the column number for index 8 I:[p1,p2]->[p3,p4],p5 col The parameters p1 and p2 are positive integers representing the row and column numbers of some position in a table with p5 columns, while p3 and p4 represent the row and column numbers of some other item. The result is the list indices of all the items from the first to the second item inclusive. Example: parameters=1,3,2,2,5: Result=3,4,5,6,7 Example: parameters=2,2,2,2,5: Result=7 - just a single index returned as the start and end items are the same. p1 (p2<p3:p4 else p5) The result is p1 occurrences of the result of the if-then-else statement: if p2<p3 then the result is p4, else the result is p5. Example: parameters=2,D1,4,101,102 and D1=3: Result=101,101 p1 (p2<=p3:p4 else p5) and the others with different comparison operators function similarly. p1 Func p2(p3) The result is p1 occurrences of the result of the number function with code p2 operating on the number p3. Number functions have a unique code, which can be seen by pressing the Codes Display link near the top of the main Numipulator page. The beginning of this list is Example: parameters=3,1,6: Result=36,36,36 Use: This meta-level operation allows you to select the function to be applied - particularly useful if developing your own Numiplets. For example, you might allow input of an angle either in radians or in degrees; code p2 could be set as 18 or 21 to return the sine of the angle - no need to use two numipulation boxes to produce both results. p1 Op p2(p3, p4) The result is p1 occurrences of the result of the number operation with code p2 operating on the numbers p3 and p4. Number operations have a unique code, which can be seen by pressing the Codes Display link near the top of the main Numipulator page. The beginning of this list is Example: parameters=1,3,6,4: Result=24 p1 If p2(p3,p4,p5,p6) The result is p1 occurrences of the result of the if-then-else statement: if the comparison (p2) between p3 and p4 is true then the result is p5, else the result is p6, where the comparison to be carried out is defined by the parameter p2, which should specify a comparison code, 1 to 6 (or 14 to 19). The comparison codes can be seen by pressing the Codes Display link near the top of the main Numipulator page. Example: parameters=2,1,D1,4,101,102 and D1=3: Result=101,101 Series:p1 Op p2(p3, p4) The result is a list of p1 items, where the first is the result of the number operation with code p2 operating on the numbers p3 and p4, as given above for p1 Op p2(p3, p4) . The second item in the results list is the result of the number operation with code p2 operating on the first item in the results list and p4. More generally, for any value of n > 1, the n Example: parameters=3,4,1,2: Result=0.5,0.25,0.125 Example: parameters=4,3,1,2: Result=2,4,8,16 Example: parameters=3,6,10000,5: Result=10500,11025,11576.25
Important: The Table Function functions can also be used for simple lists, by setting the number of columns to 1. Important: These functions may also be applied to individual rows or columns of a table, using the Line List Functions of Row S. Sort (ascending) Sort the list into ascending numerical order. Example: la=3, 2, 4, 5, 1, 3: Result=1, 2, 3, 3, 4, 5 Sort (descending) Sort the list into descending numerical order. Example: la=3, 2, 4, 5, 1, 3: Result=5, 4, 3, 3, 2, 1 Reverse Example: la=3, 2, 4, 5, 1, 3: Result=3, 1, 5, 4, 2, 3 Remove duplicates If a number occurs more than once on the list, the 2nd and subsequent
occurrences of the number are removed from the list. Cumulative sum This generates a list with the same length as the input list. The value
of the number at position n on the result list is the sum of all the numbers on
the input list from positions 1 through to n inclusive. Cumulative product This generates a list with the same length as the input list. The value
of the number at position n on the result list is the product of all the numbers on
the input list from positions 1 through to n inclusive. Diffs: item-next This generates a list whose length is the same as the input list. The value at position n in the result list is the value at position n on the
input list minus the value at position n+1. The last value on the input
(which has no item after it) is returned as the last item on the result list. Note: If the Cumulative sum is found for list L, and this result is then reversed and used as the input to Diffs: item-next, the result is the reverse of list L. Divisions: item/next This generates a list whose length is the same as the input list. The value at position n in the result list is the value at position n on the
input list divided by the value at position n+1. The last value on the
input (which has no item after it) is returned as the last item on the result
list. Note: If the Cumulative product is found for list L, and this result is then reversed and used as the input to Divisions: item/next, the result is the reverse of list L. All but first The result is the input list but with the first item removed.
The result is undefined if the input list is empty. All but last The result is the input list but with the last item removed. The
result is undefined if the input list is empty. Permutation The result is a permutation of the input list. Note: although
under List Function to List, this is strictly not a function as the input
does not uniquely determine the output. Ranks (ascending) Produces the ranks associated with each item on the list when the list has been sorted into ascending numerical order. If several items are the same, then the ranks associated with these items will also be the same. Example: la=30, 20, 40, 50, 10, 30: Result=3, 2, 5, 6, 1, 3 (Note: as there are two identical items (30) ranked 3rd lowest, there is no item ranked 4; the next highest item (40) is ranked 5. Ranks (descending) Produces the ranks associated with each item on the list when the list has been sorted into descending numerical order. If several items are the same, then the ranks associated with these items will also be the same. Example: la=30, 20, 40, 50, 10, 30: Result=3, 5, 2, 1, 6, 3 (Note: as there are two identical items (30) ranked 3rd highest, there is no item ranked 4; the next lowest item (20) is ranked 5. Frequency table Produces a list consisting of each value that occurs on la followed by the number of occurrences (frequency) of this value on la. The values are in ascending order of the values on la. The result is best considered as a table with two columns. Example: la=30, 20, 40, 20, 10, 20, 30: Result= 10, 1, 20, 3, 30, 2, 10, 1. Considered as a table with two columns this is: Adjacency table Produces a list consisting of the next different value on la (starting at the first) followed by the number of occurrences of this value before a different value is found. The result is best considered as a table with two columns. Example: la=30, 30, 40, 20, 20, 20, 30: Result= 30, 2, 40, 1, 20, 3, 30, 1. Considered as a table with two columns this is: Case list The description of this function should be read in combination with the Case: Comp function of List Function to Number.
As with the Case: Comp function, the numbers on the input list (la) generally represent Number, Comparison Operator Code, Number, Result, Number, Comparison Operator Code, Number, Result ... Default etc. However, if a zero (0) is encountered when an operator code is expected, this signifies the end of one group of inputs and the start of the next. So, the input list of values
2 1 2 3 4 5 8 9 10 0 2 3 2 4 5 represents two groups:
2 1 2 3 4 5 8 9 10 with a meaning: The result is the list of the results of each of these individual Case: Comp operations, as determined by the Case: Comp function: 10,4 Note: For this to work, there must be a default value just before any 0 used as a group separator. Calculator list The description of this function should be read in combination with the Calculator function of List Function to Number.
As with the Calculator function, the numbers on the input list (la) generally represent Number, Operator Code, Number, Operator Code, Number etc. However, if a zero (0) is encountered when an operator code is expected, this signifies the end of one group of inputs and the start of the next. So, the input list
2 1 3 3 5 0 7 3 2 0 5 3 6 2 6 represents three groups with the following meanings:
2 + 3 x 5 The result is the list of the results of these individual Calculator operations, as determined by the Calculator function: 25, 14, 24 Expression list This works the same way as Calculator list above, except that the groups separated by the 0s are evaluated as for the Expression function of List Function to Number. So, the input list
2 1 3 3 5 0 7 3 2 0 5 3 6 2 6 represents three groups with the following meanings:
2 + 3 x 5 The result is the list of the results of these individual Expression operations, as determined by the Expression function: 17, 14, 24 Smash row/col 100 This is concerned with taking pairs of numbers in a list that represent the row and column numbers of cells in a table and producing a single integer for each pair that shows both the row number and cell number smashed together. So, if the numbers in a pair are 25 13, the integer generated will be 2513. The 100 in the name represents the number by which the row number is multiplied, to which the column number is added, i.e. 25x100+13, in this case. Note: if either number is not an integer or is < 1, the value generated is undefined. This is also true if the column number >= 100. Note: if the number of items in the list is odd, the last number is ignored. This can be useful as it enables handling of individual numbers rather than pairs of numbers, while enabling the row and column numbers to be clearly visible still.
Example: if la = 23 45 61 3 2 19, the result is 2345 6103 219 Smash row/col 1000 This is similar to Smash row/col 100 above, but the multiplier for the row number is 1000 instead of 100. This makes it suitable for tables having between 100 and 999 columns, as well as those with fewer columns. Example: if la = 23 45 61 3 14 106 2 19, the result is 23045 61003 14106 2019. Unsmash row/col 100
This takes a list of integers representing row and column numbers smashed together using the multiplier 100 (see above) and produces a pair of numbers (row and column number) for each integer.
Example: if la = 2345 6103 219, the result is 23 45 61 3 2 19 Unsmash row/col 1000
This takes a list of integers representing row and column numbers smashed together using the multiplier 1000 (see above) and produces a pair of numbers (row and column number) for each integer.
Example: if la = 23045 61003 2019, the result is 23 45 61 3 2 19 Shift right
Assuming the list la is written from left to right, the numbers in the list are shifted one place to the right, with the last item becoming the first.
Shift left
Assuming the list la is written from left to right, the numbers in the list are shifted one place to the left, with the first item becoming the last.
All shifts right
The Shift right function above is applied to la, and then to this result, and so on (for as many times as there are items on the list) until the result of the Shift right is the same as the initial la. All these results are joined together.
This may prove useful for producing certain graphical patterns. All shifts left
Like All shifts right above, but applying the Shift left function.
SList functions The following functions are all concerned with SLists only. They all take an SList as an input. The example SList for each function is la=2 27 28 0 4 29 30 31 32. Note: this has 3 "sublists". SList: head content This returns the contents of the first "sublist" of the input. The result for the example is 27 28. SList: tail This returns an SList that is the remainder of the SList once the first "sublist" has been removed. The result for the example is 0 4 29 30 31 32. SList: contents lengths This returns a list of all the lengths of each "sublist" in the SList. The result for the example is 2 0 4. SList: reverse This returns a new SList, where the order of all the "sublists" is reversed. Note: the contents of each "sublist" are not reversed. The result for the example is 4 29 30 31 32 0 2 27 28. A List Operation has two inputs: an input list, la, and a set of parameters, p1,p2... p1,p2... ... . Some of the operations require one parameter (p1), some two (p1 and p2); this will be clear from the operation names, which always refer to the parameters. In all cases, more than one set of parameters may be entered; the final result list consists of the results for the first set of parameters, followed by those for the second set, and so on. Item p1 Result is the number found at the p1 First position of p1 Finds the first position in which the number p1 is found on la. Returns 0 if it is not found. p1th Percentile Returns the p1 Item at rank p1 (asc) The input list is sorted into ascending order; the result is the p1 Item at rank p1 (desc) The input list is sorted into descending order; the result is the p1 Count items = p1 Returns a count of the number of occurrences of p1 on la Ratio: la length/p1 Returns the length of (number of items in) la divided by p1 Note: if la represents the values in a table, then if p1 is the number of columns in the table, then the result is the number of rows, and vice versa. Check (1/0): p1 on la If p1 occurs on list la, the result is 1, otherwise the result is 0. Example: la=4, 2, 3, 6, 9, 11, 11, 16, 12, 13, 9; Sum: items p1->p2 The result is the sum of the list of items found at positions p1 through to
p2 on la. Product: items p1->p2 The result is the product of the list of items found at positions p1 through
to p2 on la. The behaviour is similar to that for Sum:... above List: initial p1 items The result is the list of the first p1 items found on la. If parameters (p1)=0; Result=L0. Example: la=4, 2, 3, 6, 9, 11, 11, 16, 12, 13, 9; If parameters (p1)=13; Result=undefined. List: all but initial p1 items The result is the list of all items found on la except for the first p1 items. List: final p1 items The result is the list of the last p1 items found on la. If parameters (p1)=0; Result=L0. Example: la=4, 2, 3, 6, 9, 11, 11, 16, 12, 13, 9; If parameters (p1)=13; Result=undefined. List: all but final p1 items The result is the list of all items found on la except for the last p1 items. List: items p1->p2 The result is the list of items found at positions p1 through to p2 on la. List: insert item p1 @p2 The result is the list la with an additional item, value p1, inserted at
position p2. p2 may be any position of la or one more than the length of
la (in which case the p1 is inserted at the end of the list). The length
of the resulting list is one more than that of la. List: subst. item p1 @p2 The result is the list la with the item at position p2 replaced by the value
p1. The length of the resulting list is the same as that of la. List: del. item @p1 The result is the list la with the item at position p1 removed. The
length of the resulting list is one less than that of la. The last example is a reminder that all these functions may take more than one set of parameters, with the results all joined together, even though you may not find a use for more than one set of parameters. List: del. p1 items @p2 The result is the list la with p1 items, starting at position p2, removed.
The length of the resulting list is p1 less than that of la. List: shift by p1 The result contains the same items as la, but the positions of the items are shifted by p1 towards the front of the list, with items dropping off the beginning of the list being moved to the end of the list. The value of p1 must be an integer, but may be positive or negative. List: map to p1 blocks The result for a given value of p1 is a list the same length as la, where each item on la is mapped to an integer (1 -> p1) based on its value. These integers represent value ranges (or blocks): p1 equal-sized ranges from the minimum value on la to the maximum value. This is useful when you wish to plot a list of numbers on a graph. To explain further, if Min is the minimum value on la, and Max the maximum
value, p1 block beginnings are defined, spaced out at increments of
(Max-Min)/p1, starting at Min. So, if Min is 10, Max is 50, and p1 is 10,
there will be 10 block beginnings: 10, 14, 18, 22, 26, 30, 34, 38, 42, 46.
Any number on la >=10 (and < 14) will be mapped to 1; any number on la
>=14 (and < 18) will be mapped to 2, and so on. Note: any number on la >=
46 and <=50 (rather than < 50) will be mapped to 10. Note: if la is empty an error message results. If each item on la has the same value, so that blocks cannot be determined, all items are mapped to 1. If p1 is not a positive integer, the result is undefined. List: p1 occurrences of la The result is the list la repeated for a total of p1 times.
SList functions The following functions are all concerned with SLists only. They all take an SList as an input. The example SList for each function is la=2 27 28 0 4 29 30 31 32. Note: this has 3 "sublist" items. SList: item p1 length The result of this is the length of the "sublist" at position p1.
SList: item p1 content The result of this is the content of the "sublist" at position p1.
SList: before item p1 The result of this is the part of the SList that comes before the "sublist" at position p1 (and not including it).
SList: after item p1 The result of this is the part of the SList that comes after the "sublist" at position p1 (and not including it).
These operations take two lists as inputs, and produce a list as a result. Positions: of lb on la This returns a list containing, for each element of lb, the position at which this value is found on la. At first sight this looks the same as the First position of p1 operation from the List Operation numipulation box. However, it differs from this in one important aspect: once a particular position has been identified, it is no longer available for further selection. This means that if there are duplicates on la and the same duplicates on lb, both positions will be returned - in contrast to the First position of p1 operation, which always returns the first position of any number, since the operations on the items in the parameter list are independent of each other. If the number being considered on lb does not exist on la, or the positions at which it occurs have already been returned, the position is given as zero. Example: la=2, 1, 3, 4, 3, 5; lb=3, 2, 7, 3, 3, 4: Result=3, 1, 0, 5, 0, 4 (the 3 and 5 correspond to the two positions of 3 in la. The two zeros are returned because 7 does not exist on la and a third 3 is not available. This operation allows you to put an unsorted list in la, put a sorted version in lb, and generate the positions at which the items on lb occurred at on the unsorted list. Example: la=10, -10, 30, 40, 30, 50; lb=-10, 10, 30, 30, 40, 50: Result=2, 1, 3, 5, 4, 6. Common: on la and lb Returns a list of all those items that exist on both la and lb. Each
value occurs only once in the result. The order is based on the first
occurrence of the number on la. Union: on la or lb Returns a list of all those items that exist on either la or lb. Each
value occurs only once in the result. Essentially, the two lists are
joined together (la followed by lb) and duplicates are removed. Diff: on la but not lb Returns a list of all those items that exist on la but not on lb. Each
value occurs only once in the result. The order is based on the first
occurrence of the number on la. SDiff: on one not both Symmetrical Diff: returns a list of all those items that exist on la
but not lb, followed by those that exist on lb but not la. Each
value occurs only once in the result. Remove 1 lb from la For each item on lb, remove one occurrence of it from la and return the
resulting list. Duplicates will be removed from la only if there are
corresponding duplicates on lb. Remove all lb from la For each item on lb, remove all occurrences of it from la and return the
resulting list. Join la and lb Simple joining together of la followed by lb. Sort la by lb (asc) Takes two lists of equal length as inputs. Returns the items of la
re-ordered in such a way as to match the order of corresponding items on lb if
this were sorted in ascending numerical order. Sort la by lb (desc) As above, but as if lb were sorted in descending numerical order. Cross Add: la+lb To understand this operation, consider la to be the row labels of a table, and lb to be the column labels. The value of a cell at a particular row and column in the table is the row label + column label. So, if la=10, 20, 30 and lb=1, 2, 3, 4, then the resulting table would look as follows: 1 2
3 4 The list resulting from this operation is the values in the cell tables (extracted row by row, starting at the top), namely: 11, 12, 13, 14, 21, 22, 23, 24, 31, 32, 33, 34. Cross Subtract: la-lb This is similar to Cross Add, but in this case the resulting cell values are the row label - column label. So, given the same example as for Cross Add, the resulting table is: 1 2
3 4 so the resulting list is: 9, 8, 7, 6, 19, 18, 17, 16, 29, 28, 27, 26 Cross Multiply: laXlb This is similar to Cross Add, but in this case the resulting cell values are the row label X column label. So, given the same example as for Cross Add, the resulting table is: 1 2
3 4 so the resulting list is: 10, 20, 30, 40, 20, 40, 60, 80, 30, 60 90, 120 Cross Divide: la/lb This is similar to Cross Add, but in this case the resulting cell values are the row label/column label. XP1:len(lb) of la items and XP2:len(la) of lb The above Cross... operations allow you directly to undertake some of the basic arithmetic operations on the row labels and column labels of a table. Sometimes, you may wish to carry out more complex operations. The two XP... operations (standing for Cross-pairs), which should be considered together, each generate a list, and these two lists can then be used as inputs to an Items Operation numipulation box, where you can apply any operation. Given the same example as for the Cross Add operation, i.e. la=10, 20, 30 and lb=1, 2, 3, 4, then XP1... is the list derived from the table where the row labels are placed in every cell of the row: 1 2
3 4 so that the result, as a list, is 10, 10, 10, 10, 20, 20, 20, 20, 30, 30, 30, 30. XP2... is the list derived from the table where the column labels are placed in every cell of the column: 1 2
3 4 so that the result, as a list, is 1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4. These two lists could now be taken as input an Items Operations numipulation
box with any operation selected. For example, selecting the Power
operation would yield the list: Merge: (various types) To understand merging, you must take the list lb to be the values of a single new column to be added to a table formed by the values of la. Clearly, this table must have the same number of rows as there are values in lb. So, if la=1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12 and lb=30, 40, 50, then imagine la laid out in 3 rows (row-by-row, left-to-right and top-to-bottom: 1 2 3 4 Merging involves inserting the values of lb to become a new column in the table, either at the start or at the end. The result is the elements of the new table extracted row-by-row (top-to-bottom, left-to-right). Special cases: if la is an empty list, then the result is lb, while if lb is an empty list, then the result is la. Merge at start means insert the items of lb to be the first column in the new table. So, given the above example, the new table is: 30 1 2 3 4 so the result is Merge at end means insert the items of lb to be the last column in the new table. So, given the above example, the new table is: 1 2 3 4 30 so the result is Note: More general merging can be undertaken using the Insert lc @ col d or Merge table lc @ col d operations of Table Construction numipulation boxes. Simple map values
This treats the elements of the first list (la) separately, and maps each of them to another (or the same) number. The resulting list should have the same number of items as la. The mapping is defined
by the values of the second list (lb). The values of lb should be considered as a series of pairs: The result list has the same values as the first list (la) except that wherever the first number of one of the pairs on lb is found, it is replaced by the second number of the pair. If there is a surplus number after the pairs (Default), this replaces any input value for which no mapping is explicitly defined. If there is no surplus number and no explicit mapping pair is found, the value in the result list is the same as on la. Note: once an explicit mapping is found for a value, working left to right on lb, no further mapping is carried out for that value. Note: it can be helpful to use colons and semicolons to make the pairs and mappings clearer.
Example: la=1 2 3 4 5 6 and lb=3: -127799; 4: -127773; 5: -127796, the result is: This operation can be very useful for letting you work with simple numbers, but then map them to longer format codes for a graphical interface output. Change values This is concerned with changing the values of la; the positions and values are specified in lb.
List lb contains pairs of numbers: the first of each pair must specify a valid index (position) of la,
while the second of the pair specifies the value that should replace the existing value. If the position
specified is invalid, an error is thrown. If there is an odd number of items in lb, the last item is ignored.
Note: the numbers are changed sequentially, left to right, so a value that has already been changed may be changed again.
SList functions The following functions are all concerned with SLists only. They all take an SList as an input. The example SList for each function is la=2 27 28 0 4 29 30 31 32. Note: this has 3 "sublist" items. SList: add content head This adds a new "sublist", content lb, at the beginning of the SList defined in la.
SList: add content end This adds a new "sublist", content lb, at the end of the SList defined in la.
Meta List to Number List lb should contain only positive integer codes that specify functions that can be found in the List Function to Number numipulation boxes, as defined under List Function to Numbers when the Codes button is pressed, e.g. 1 for Sum of list values, or 4 for Maximum value. The result
is a list of the results of applying the specified functions to la.
Meta List to List List lb should contain only positive integer codes that specify functions that can be found in the List Function to List numipulation boxes, as defined under List Function to Lists when the Codes button is pressed, e.g. 1 for Sort (ascending), 3 for Reverse, or 4 for Remove duplicates. Unlike the function above, the output is the result of applying each
function in turn, from left to right, starting with the input list la. To explain, see the following example:
This is a useful function for applying several List to List functions in a single numipulation box.
Find All operations are concerned with identifying which items on input list [a] satisfy some relationship with the corresponding items on the second list, [b], and creating a list either of the items that satisfy this relationship or of the positions of those items in [a]. Val of a: a < b This generates a list of all the items on [a] that are less than the
corresponding item on [b]. Pos of a: a < b This generates a list of all the positions on [a] whose items are less than
the corresponding item on [b]. The other comparison relationships work in the same way. For each item, b, on the second input list, [b], count the number of occurrences of items in the first input list, la, that satisfy a given relationship with b. Return a list with these counts as the items. Items on la < b p> Example: la=4, 3, 5, 4, 6, 7, 3, 3 ; [b]=3, 4, 5, 9: Result=0, 3, 5, 8 (there are 0 items < 3; 3 items < 4; 5 items < 5; 8 items < 9)The other comparison relationships work in the same way. Range selection is concerned with finding items on the first input list, la, whose values or positions are in one or more ranges (as defined by pairs of parameters, p1 and p2, on the second input list), and returning either the values or positions that are inside one or more of the ranges, or the ones that lie outside all of the ranges. Important: Unlike other functions with a number of sets of parameters, these parameters are treated as a whole. The | shown on the label should be read as OR. The order of the items in the result is strictly dependent on the order in the input list, la, not on the order of the pairs of parameters. p1>=Pos<=p2: Val in This says: find all the positions that lie in the ranges defined by pairs of
parameters p1 and p2, and return the values of the items at these positions. p1>=Pos<=p2: Val out This says: find all the positions that lie in the ranges defined by pairs of
parameters p1 and p2, and return the values of the items at all positions except
those that lie within these ranges. p1>=Val<=p2: Val in This says: find all the items whose values lie in the ranges defined by pairs
of parameters p1 and p2, and return these values. p1>=Val<=p2: Val out This says: find all the items whose values lie in the ranges defined by pairs
of parameters p1 and p2, and return all items on la except these. p1>=Val<=p2: Pos in This says: find all the items whose values lie in the ranges defined by pairs
of parameters p1 and p2, and return the positions of these items. p1>=Val<=p2: Pos out This says: find all the items whose values lie in the ranges defined by pairs
of parameters p1 and p2, and return the positions of all items on la except
these items. Other definitions of range (> and <, for example) work in a similar way. Please note that there are four types of If-Then-Else box: Simple (Row O), Items (Row P), All (Row Q) and List (Row R). If you're looking for one that provides a fairly flexible/complex condition, try if exp(la)=lb: lc, else ld within the If-Then-Else (List) set of functions. If-Then-Else (Simple) - Row O Despite looking complicated, this is a simple If-Then-Else for two numbers being compared, a and b, with two possible resulting lists, lc and ld. This says: if a satisfies some relationship with b then the resulting list will be lc, otherwise it will be ld. if a < b: lc, else ld Example: a=3; b=4; lc=25; ld=50: Result=25 (as 3<4
the result is lc) Example: a=3; b=4; lc=25, 70; ld=L0: Result=25, 70 (as 3<4
the result is lc) Example: a=4; b=3; lc=101; ld=L0: Result=L0 (as the check for 4<3 fails the result is ld) Other comparisons work in a similar way. This is an If-Then-Else for corresponding items on 4 input lists: [a], [b], [c], [d]. The length of [a] determines the length of the output, with other lists of items cycling in the usual way. This says: if a satisfies some relationship with b then the resulting value will be c, otherwise it will be d. if a < b: c, else d Example: [a]=3; [b]=4; [c]=25; [d]=50: Result=25 (as 3<4
the result is c) If [a]=L0, the output will be L0. Other comparisons work in a similar way. Note: You can sometimes avoid using several of these linked together by using a single Case (Map Values) operation (List & List Operation). This says: if all the items on [a] satisfy some relationship with the corresponding items on [b], then the resulting list will be lc, otherwise the resulting list will be ld. Note: lc and ld are treated as whole lists, not lists of items from which the result will be constructed. if all a < b: lc, else ld Example: [a]=3; [b]=4; lc=25; ld=50: Result=25 (as 3<4
the result is lc) N.B. More strictly, the meaning is: if none of the items on [a] fail to satisfy some relationship with the corresponding items on [b], then the resulting list will be lc, otherwise the resulting list will be ld. This means that if [a]=L0, the result will always be lc, as there are no items that can fail the specified relationship. Other comparisons work in a similar way. N.B. As shown by the first example for each of these first three If-Then-Else numipulation boxes, if the four inputs contain only one number each, then their behaviours are identical, so any of them may be used for a simple number If-Then-Else. You can avoid having several linked together by using the various Case:... functions within List Function to Number or the Case list function within List Function to List. This says: if lists la and lb satisfy some relationship, then the resulting list will be lc, otherwise the resulting list will be ld. The descriptions below just mention and describe the relationship within the function name. exp(la)=lb: lc, else ld This is true if the evaluation of the list la as an Expression list (see under List Function to List functions) is exactly the same as list lb. This provides a very flexible way of specifying the condition of the If-Then-Else. The expectation is that the results of the Expression list would come from Check (1/0):... or Logic (1/0):.. operations and functions, so that lb would normally consist only of 1s and 0s, but this is not essential. In the following examples, the assumption is made that input Mappings have been specified using the +-x/ button under Mappings to allow more readable input lists. Example: la=4 < 5 AND 9 > 3; lb=1 is true, as la evaluates to 1. This function provides a handy way of specifying some negative conditions.
Note: this function is so useful, that it is the default for every If-Then-Else (List) box. all la on lb This is true if every item on the list la is also found on list lb, i.e. la is a subset of lb. More strictly, this is true if there is no item on la that is not found on lb.
>=1 la on lb This is true if at least one item on la is also found on list lb, i.e. la and lb intersect.
1st of la on lb This is true if the first item of la is also found on list lb.
len(la) on lb This is true if the length of list la found on list lb.
lengths = This is true if the lengths of lists la and lb are the same.
la = lb This is true if la and lb are equal.
sorts = This is true if la and lb are both sorted and found to be the same.
uniques = This is true if la and lb are both contain exactly the same values, ignoring duplicates.
la in lb range This is true if every value on la is >= the minimum value on lb and <= the maximum value on lb.
The first two inputs for Table Operation are a list, la, and a number, ncols. Together these represent an input table (see Tables), where la represents the cell values and ncols represents the number of columns in the input table. The operations defined take this input table, and produce a list of numbers, based on parameters defined in the last input list, p1,p2... p1,p2... ... . Some of the operations produce a row, column, block or cell as the result, while others produce some function of the values. Some of these operations require one parameter, some two, some more (the name of the operation makes this clear, as it always refers to the parameters). In all cases, more than one set of parameters may be entered; the final result list consists of the results for the first set of parameters, followed by those for the second set, and so on. However, some are intended for multiple sets of parameters, e.g. Row and Column, while others, e.g. Swap rows or Clusters, are intended for a single set of parameters only. Note: The results for an empty input list, la, are described individually. All the operations described below, except those within the Searching and Graph Plotting groups, assume that la=1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12 and ncols =4, so that the input table is 1 2 3 4 Some operations also give some additional examples for la. Row p1 This takes a single parameter, p1. The p1 Example: p1=2: Result=5, 6, 7, 8 If la is an empty list, there are 0 rows, so the result is undefined . Column p1 This takes a single parameter, p1. The p1 Example: p1=2: Result=2, 6, 10 If la is an empty list, the result is an empty list if p1 is valid, otherwise it is undefined . Cell [row,col]=[p1,p2] This takes two parameters, p1 and p2. The value in the cell found at the intersection of row p1 and column p2 is returned (in a list) as a result. Example: p1,p2=2, 3: Result=7 If la is an empty list, the result for any pair of parameters p1 and p2 is undefined . Block [p1,p2]->[p3,p4] This takes four parameters, p1, p2, p3, p4. p1 and p2 represent the row number and column number of one cell in the table, and p3 and p4 represent the row number and column number of a second cell. Conceptually, a rectangular block is drawn around these cells, and the result is a list of the values in all the cells contained within this block (extracted row-by-row starting at the top). Example: p1,p2,p3,p4=1, 2, 3, 4 1 2 3 4 The first cell is row 1, column 2 = the cell with 2 in it. Example: p1,p2,p3,p4=3, 4, 1, 2 The same two cells are specified as in the first example, albeit in a different order, so the result is the same: 2, 3, 4, 6, 7, 8, 10, 11, 12 Example: p1,p2,p3,p4=2, 1, 2, 3 1 2 3 4 The result is 5, 6, 7 Example: p1,p2,p3,p4=2, 3, 2, 3 1 2 3 4 Block hXw [p1,p2]:p3Xp4 This takes four parameters, p1, p2, p3, p4. p1 and p2 represent the row number and column number of the top-left cell in a block of the table, while p3 and p4 represent the height and width (in cells) of the block. The result is a list of the values in all the cells contained within this block (extracted row-by-row starting at the top). Example: p1,p2,p3,p4=1, 2, 3, 3 1 2 3 4 The top-left cell of the block is row 1, column 2 = the cell with 2 in it. Example: p1,p2,p3,p4=2, 3, 1, 1 1 2 3 4 The result is the value in the single cell at row 2, column 3 = 7 If la is an empty list, the result for any set of parameters p1, p2, p3 and p4 (except L0) is undefined . Swap rows p1 & p2 The result has rows p1 and p2 of la swapped in position. Example: p1,p2=2,3. Result = 1, 2, 3, 4, 9, 10, 11, 12, 5, 6, 7, 8, i.e. the table: 1 2 3 4 Remember: For this and others below in this section, if you have two pairs of parameters, the result will not be the outcome of applying both swaps to the input list in one go, with the result length the same length as la; it will be the result for the first pair, followed by the result for the second pair (i.e. the result will be twice the length of la). Swap cols p1 & p2 Similar to Swap rows.. but with the swapping of columns. Example: p1,p2=2,3. Result = 1, 3, 2, 4, 5, 7, 6, 8, 9, 11, 10, 12, i.e. the table 1 3 2 4 Move row p1 to p2 The result has row p1 of la moved to become row p2 of the result. The relative ordering of the other rows remains unchanged. Example: p1,p2=1,3. Result = 5, 7, 6, 8, 9, 11, 10, 12, 1, 3, 2, 4, i.e. the table
5 6 7 8 Move col p1 to p2 The result has column p1 of la moved to become column p2 of the result. The relative ordering of the other columns remains unchanged. Example: p1,p2=1,3. Result = 2, 3, 1, 4, 6, 7, 5, 8, 10, 11, 9, 12, i.e. the table 2 3 1 4 Delete rows p1->p2 The result has rows p1 through to p2 of la removed. The relative ordering of the other rows remains unchanged. Example: p1,p2=2,2. Result = 1, 2, 3, 4, 9, 10, 11, 12, i.e. the table: 1 2 3 4 Example: p1,p2=2,3. Result = 1, 2, 3, 4 Example: p1,p2=1,3. Result = L0 Delete cols p1->p2 Similar to Delete rows... The result has columns p1 through to p2 of la removed. The relative ordering of the other columns remains unchanged. Example: p1,p2=1,2. Result = 3, 4, 7, 8, 11, 12, i.e. the table: 3 4 Look-up rows: p1 This finds the first row, moving from top to bottom, that has the value p1 as its first item (i.e. in column 1). The result is the list of all the elements in the row except for the first one. If no row is found with the value p1 as its first item, the result is undefined. Example: p1=5: Result=6, 7, 8 If la is an empty list, the result for any value of p1 is undefined . Look-up cols: p1 This finds the first column, moving from left to right, that has the value p1 as its first item (i.e. in row 1). The result is the list of all the elements in the column except for the first one. If no column is found with the value p1 as its first item, the result is undefined. Example: p1=2: Result=6, 10 If la is an empty list, the result for any value of p1 is undefined . Rows: @p1 < p2 This selects and returns as lists all the rows that satisfy the condition: the item in column p1 is less than the value p2. The order of the row lists in the result is determined by the input table (rows nearer to the top appear first). Note: @p1 is shorthand for 'the item at position p1'. If no such rows are found for p1 and p2, an empty list results. Example: p1, p2=2, 7: Result=1, 2, 3, 4, 5, 6, 7, 8 (since only in the first
two rows is the second item less than 7). If la is an empty list, the result is an empty list. Rows: @p1 <= p2, Rows: @p1 = p2, Rows: @p1 <> p2, Rows: @p1 >= p2, Rows: @p1 > p2 These operate in a similar manner to Rows: @p1 < p2, but the comparison test is, of course, different. Cols: @p1 < p2 This selects and returns as lists all the columns that satisfy the condition: the item in row p1 is less than the value p2. The order of the column lists in the result is determined by the input table (columns nearer to the left appear first). If no such columns are found for p1 and p2, an empty list results. Example: p1, p2=2, 7: Result=1, 5, 9, 2, 6, 10 (since only in the first two
columns is the second item less than 7). If la is an empty list, the result is undefined . Cols:@p1 <= p2, Cols: @p1 = p2, Cols: @p1 <> p2, Cols: @p1 >= p2, Cols: @p1 > p2 These operate in a similar manner to Cols: @p1 < p2, but the comparison test is, of course, different. Rows: @p1 < @p2 This selects and returns as lists all the rows that satisfy the condition: the item in column p1 is less than the item in column p2. The order of the row lists in the result is determined by the input table (rows nearer to the top appear first). If no such rows are found for p1 and p2, an empty list results. Example: p1, p2=2, 3: Result=1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12 (since in
all rows the value in column 2 is less than the value in column 3) If la = If la is an empty list, the result is an empty list. Rows: @p1 <= @p2, Rows: @p1 = @p2, Rows: @p1 <> @p2, Rows: @p1 >= @p2, Rows: @p1 > @p2 These operate in a similar manner to Rows: @p1 < @p2, but the comparison test is, of course, different. Cols:@p1 < @p2, Cols:@p1 <= @p2, Cols: @p1 = @p2, Cols: @p1 <> @p2, Cols: @p1 >= @p2, Cols: @p1 > @p2 These operate in a similar manner to the corresponding Rows: operations, but
search and return columns rather than rows. For example, Cols: @p1 <
@p2 searches for all columns where its p1 If la is an empty list, the result is undefined . Sum of row p1 This takes a single parameter, p1. The sum of the values of the p1 Example: p1=2: Result=26 (sum of 5, 6, 7, 8) If la is an empty list, the result is undefined . Why? There are no rows, so p1 is always invalid. Sum of column p1 This takes a single parameter, p1. The sum of the values of the p1 Example: p1=2: Result=18 (sum of 2, 6, 10) If la is an empty list, the result is 0 if p1 is a valid column, otherwise it is undefined . Why? Each valid column has no items, and the sum of an empty list is 0. Product of row p1 This takes a single parameter, p1. The product of the values of the p1 Example: p1=2: Result=1680 (product of 5, 6, 7, 8) If la is an empty list, the result is undefined . Why? There are no rows, so p1 is always invalid. Product of column p1 This takes a single parameter, p1. The product of the values of the p1 Example: p1=2: Result=120 (product of 2, 6, 10) If la is an empty list, the result is 1 if p1 is a valid column, otherwise it is undefined . Why? Each valid column has no items, and the product of an empty list is 1. Counts: p1 in rows This takes a single parameter, p1. The result is a list of the number of occurrences of the value p1 in each of the rows of the input table. Example: p1=2: Result=1, 0, 0 (2 occurs once in row 1 and 0 times in rows 2 and 3). If la is an empty list, the result is an empty list. Counts: p1 in cols This takes a single parameter, p1. The result is a list of the number of occurrences of the value p1 in each of the columns of the input table. Example: p1=2: Result=0, 1, 0, 0 (2 occurs once in column 2 and 0 times in columns 1, 3 and 4). If la is an empty list, the result is a list containing ncols occurrences of 0. Count p1 in row p2 This takes two parameters, p1 and p2. The result is the number of occurrences of the value p1 in row p2 of the input table. Example: p1,p2=2, 1: Result=1 (2 occurs once in row 1). If la is an empty list, the result is an empty list. Count p1 in column p2 This takes two parameters, p1 and p2. The result is the number of occurrences of the value p1 in column p2 of the input table. Example: p1,p2=2, 1: Result=0 (2 occurs zero times in column 1). If la is an empty list, the result is 0 if p2 is a valid column, otherwise it is undefined . Subst. p1 @ [p2, p3] This takes three parameters p1, p2 and p3. The result list contains the items of the input table, but with the item at cell [p2, p3] (row p2, column p3) replaced by the value p1. Example: p1,p2...= -89, 2, 3: Result=1, 2, 3, 4, 5, 6, -89, 8, 9, 10, 11, 12 If la is an empty list, the result is undefined . Resize p1Xp2, fill p3> This takes three parameters p1, p2 and p3. It is concerned with producing a resized output table based on a given input table. p1 defines the number of rows in the output table; p2 defines the number of columns in the new table; p3 defines the value to be entered in any new cells that exist in the new table but not the input table. To explain, consider the input table: 1 2 3 4 Suppose we wish to resize it to produce an output table with 2 rows and 3 columns only. Any resizing always assumes that the top-left cell of the table (if any) will also be the top-left cell of the resized table. This resizing therefore means that we have to remove from the input table the 3rd row and the 4th column, so that we are left with: 1 2 3 Suppose, instead, that we wish to resize it to produce an output table with 5 rows and 5 columns. Again, the resizing assumes that the top-left cell of the table will also be the top-left cell of the resized table. This resizing therefore means that we have to add in two additional rows at the bottom and a column on the right, so that we are left with: 1 2 3 4 ? Since the result must contain numbers, we cannot produce a table containing symbols such as a '?'. The parameter p3 is used to specify the value that is placed in every 'new' cell. So, if the three parameters were 5,5,0, the output table would be: 1 2 3 4 0 We explain this operation by saying that it produces an output table . However, the result of the operation cannot actually be a table but must be a list. The result list therefore consists of the values in the output table selected from each row (left-to-right) starting at the top. The result list may, of course, be displayed as a table in the Table Formatter. If la is an empty list, the output table will have all its values equal to p3. If either p1 or p2 has the value 0, the result will be an empty list (L0). Cells (R:C), value p1> This finds all the cells in the input table that have the value p1, and returns the row/column pairs for each of these. If la = Clusters The operations within the Clusters group of operations are all concerned with carrying out some form of search within an input table starting from a given cell within the table, where the starting cell is defined by parameters p1 and p2, which always specify the row and column respectively of the cell. The operations all involve starting from the starting cell and searching in all directions (both directions along the associated row and column) and, in most cases, all directions diagonally as well. These operations might be used when looking for or analysing clusters of data in a table, or when analysing positions in a game where the cells of the table represent various states of the game. To explain these operations, we will use the following 5X5 table (la=3, 4, 5, 4, 4, 2, 5, 4, 2, 1, 1, 5, 4, 4, 2, 2, 4, 3, 2, 1, 4, 4, 4, 2, 4 and ncols=5):
3 4 5 4 4 We will start searches from the centre cell, i.e. p1=3 and p2=3 In all these operations, the result is undefined if la is an empty list, or if p1 or p2 is not a valid row/column number. [p1,p2]-> count p3 This operation counts the number of occurrences of the value p3 in every one of 8 directions before a value that is not p3 is found. Note: the starting cell itself is not counted. The result list, which always contains eight items unless some error results, contains the results for the searches starting in the upwards vertical direction, which we'll call North, or N, and moving clockwise (so the last result is for the NW direction). So, the eight results are for the directions: N, NE, E, SE, S, SW, W, NW. Example: p1,p2...=3, 3, 4: Result=1, 0, 1, 0, 0, 2, 0, 0
3 4 5 4 4 [p1,p2]-> cells p3 This operation finds the occurrences of the value p3 in every one of 8 directions before a value that is not p3 is found, and returns in the result list, the row number and column number, in pairs, of the cells in which they occur. In other words, it returns the row and column numbers of all those occurrences counted up in [p1,p2]-> count p3 . Note: the starting cell itself is not included. The pairs of row/column numbers in the result list are given in the order they are found when following the same search directions/orders as for [p1,p2]-> count p3 . Example: p1,p2...=3,3,4: Result=2, 3, 3, 4, 4, 2, 5, 1 [p1,p2]-> 1st not p3 This operation searches the same 8 directions, and in the same order, as [p1,p2]-> count p3 , but finds the first value in each direction that is not equal to p3. If no such value is found, undefined is returned for that direction. Note: the starting cell itself is not included. Example: p1,p2...=3, 3, 4: Result=5, 2, 2, 2, 3, undefined, 5, 5. [p1,p2]-> linked +x This operation carries out a search starting at the start cell [p1, p2] and returns in the result list a set of numbers representing pairs of row/column numbers of all the cells that have the same value as the start cell and are linked to it, either horizontally, vertically or diagonally, by cells that also have the same value as the start cell. That is, it returns the row/column numbers of all cells in the cluster of cells with the same value as the start cell where a path can be traced back to the start cell that includes cells containing only the value of the start cell. Note: the starting cell itself is included as the first pair of row/column pair. Example: p1,p2...=3, 3: Result=3, 3, 2, 3, 3, 4, 4, 2, 5, 1, 1, 4, 1, 2, 5, 3, 5, 2, 1, 5. This represents the set of cells: [3, 3], [2, 3], [3, 4], [4, 2], [5, 1], [1, 4], [1, 2], [5, 3], [5, 2], [1, 5] as highlighted in the table below:
3 4 5 4 4 Note that the 4 in the bottom-right cell does not form part of this cluster, as there is no path linking it to the start cell formed of cells containing only 4s. In case the order is important, the start cell row/column pair comes first, then the row/column pairs for the cells found by a [p1,p2]-> cells p3 type of search starting here, then the row/column pairs for any new cells found as a result of a similar search from each cell found, and so on. Note that the +x in the operation name represents the fact that this search finds links horizontally, vertically and diagonally. [p1,p2]-> linked + This operation carries out a search starting at the start cell [p1, p2] and returns in the result list a set of numbers representing pairs of row/column numbers of all the cells that have the same value as the start cell and are linked to it, either horizontally or vertically, diagonal links ignored, by cells that also have the same value as the start cell. That is, it returns the row/column numbers of all cells in the cluster of cells with the same value as the start cell where a horizonal/vertical path can be traced back to the start cell that includes cells containing only the value of the start cell. Note: the starting cell itself is included as the first pair of row/column pair. Example: p1,p2...=3, 3: Result=3, 3, 2, 3, 3, 4. This represents the set of cells: [3, 3], [2, 3], [3, 4] as highlighted in the table below:
3 4 5 4 4 Note that none of the other 4s in the table have horizontal/vertical paths linking them to the start cell formed of cells containing only 4s. The order of the results is similar to that for [p1,p2]-> linked +x . Note that the + in the operation name represents the fact that this search finds links only horizontally or vertically, not diagonally. Graph Plotting The Graph Plotting operations are concerned with providing results which, given appropriate formatting, can provide rudimentary graphical representations of some input data. Each operation is best described by considering that it produces an output table . However, the result of the operation cannot actually be a table but must be a list. The result list therefore consists of the values in the output table selected from each row (left-to-right) starting at the top. The result list may, of course, be displayed as a table in the Table Formatter, Graphics Formatter or Animation Zone. Plot p1 (p2) vs p3 (p4) This takes four parameters: p1 through to p4. It is a complex operation to explain and understand and is used as a basis for producing a plot of column p1 (on the vertical- or Y-axis) vs column p3 (on the horizontal- or X-axis), each containing numbers that may be real or integers. To produce such plots, it is necessary to group, or normalize, the values in the two lists in some way, which we do here by assigning the values to certain specified ranges or blocks. The first two, p1 and p2, together define a list of numbers to be mapped to a certain number of equal-sized blocks between the minimum and maximum values of the list of numbers. p1 is the column number of the input table, whose values form the list of numbers, while p2 is a positive integer representing the number of blocks to which these numbers are to be mapped. See List Operation (Row J) Map to p1 blocks for a full description of this mapping (but remember that the 'p1' in that represents the number of blocks, whereas here the number of blocks is represented by parameter p2). The second two, p3 and p4, represent respectively a second column and associated number of blocks to which the numbers in the column are to be mapped. To help understand this operation, consider that this operation produces an output table, with p2 rows and p4 columns. Corresponding items on the two sets of equal length mappings (the first containing integers ranging from 1 to p2, the second containing integers ranging from 1 to p4) are taken to specify cells in the output table. The values in the output table represent the number of pairs that specify the given cell. The result, is, of course, just the values of the output table laid out as a list in the usual way. Example: Suppose la contains is the list 2, 4, 5, 6, 1, 10, 6, 9, 4, 5, 11, 7, 2, 4, 0, 4, 2, 4, 6, 9 and ncols is 2. The input table is therefore: 2 4.1 If p1=1, p2=6, p3=2 and p4=4, the two sets of mappings (shown as columns), after mapping the values in the first column to integers 1 -> 6 and those in the second column to 1 -> 4 (in both cases the minimum value maps to 1) are: 2 1 The output table, where row 1 is at the top, as usual in Numipulator, and column 1 is on the left, is therefore:
and the result list is 1, 0, 0, 1, 3, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 1, 0 This says that there is only 1 pair of corresponding items that map to cell [1, 1], 3 that map to cell [2, 1], 0 that map to cell [2, 2], and so on. This could form the basis of a rudimentary plot of column 1 vs column 2, although you would probably wish to flip the table vertically, so that the lowest values on the vertical axis are on the bottom row rather than the top row. If la is an empty list, the result is undefined . Histogram p1 (p2) This takes two parameters: p1 and p2. It is concerned with producing an output table which, when formatted appropriately, represents a rudimentary histogram. p1 is the number of a column in the input table. The numbers in this column generally represent a count of the occurrence (or frequency) of some factor in a population. The numbers in the column should all be non-negative numbers. p2 is the number of rows in the output table in which the histogram should be presented. To explain, suppose we have an input table consisting of just one column as follows (where la=7, 11, 8, 2, 6, 10, 0, 9 and ncols=1)
7 Suppose these numbers represent the numbers of people in a small survey that read certain newspapers (7 read paper1, 11 read paper2, and so on). We might want to look at these data graphically in the form of a histogram. If we therefore carry out a calculation with p1=1 (i.e. the first column) and p2=6, the output table would have 6 rows (as defined by p2) and 8 columns (the number of data items in the column) and would look as follows:
If you mentally ignore the 0s (or physically remove them), the table looks as follows:
you will see that this table contains a number of downward-pointing column bars where the 'length' of the column bar is roughly proportional to the number of people that read each paper. The actual number reading it is given by the number making up the bar. The output table is produced as follows: - the number of rows in the output table = p2;
- the number of columns in the output table = the number of values in the input column;
- each of the columns in the output table is associated with the corresponding value in the input column;
- the interval for each row = (the maximum value in the input column/p2) rounded up; so, in the example, the interval of each row is 11/6 rounded up = 2;
- each row has a lower limit = (row number-1)Xinterval; so, in the example, row 1 (the top row) has a lower limit=0, row 2 has a lower limit = 2 and row 6 has a lower limit = 10.
- for each cell, if the value associated with the column > (but not equal to) the lower limit of its row, its value is the value associated with the column; otherwise it is 0.
If la is an empty list, the result is undefined . Line List Functions The Line List Functions provide the ability to specify a List Function to Number or List Function to List to the individual rows or columns of the table, as defined for Rows C and H. These functions are applied by specifying the code for the functions to be applied, as given when the Codes link is pressed. The examples below assume a 4-column table, with la defined as follows: Ind. rows to num p1 Result=100, 260, as code 1 for List Function to Number means Sum of list values, and 20+10+40+30=100 and 80+70+50+60=260. Note: If la=L0, the result is L0, as there are no rows to sum. Ind. cols to num p1 Result=100, 80, 90, 90, as code 1 for List Function to Number means Sum of list values, and 20+80=100, 10+70=80, 40+50=90 and 30+60=90. Note: If la=L0, the result is 0, 0, 0, 0, as the sum of each empty column is 0. Ind. rows to list p1 Result=10, 20 30, 40, 50, 60, 70, 80, as code 1 for List Function to List means Sort (ascending), so each row is sorted individually. Note: If la=L0, the result is L0, as there are no rows to sort. Ind. cols to list p1 Result=20, 80, 10, 70, 40, 50, 30, 60, as code 1 for List Function to List means Sort (ascending), so each column is sorted individually. Note: If la=L0, the result is L0, as the sort of each empty column is L0. Meta Ops The Meta Ops operations provide the ability to specify the function or operation to be carried out on a table by means of a code. There are five of these: - Function=p0
- Op=p0:p1
- Op=p0:p1,p2
- Op=p0:p1,p2,p3
- Op=p0:p1,p2,p3,p4
In all cases, p0 represents the code for the function or operation, while the remaining parameters (if any) represent the parameters of the operation specified by the code. The codes can be found by clicking on the Codes link near the top of the main Numipulator page. Please note the following carefully, as an example: Op:p0:p1,p2,p3 has a total of 4 parameters: the first, p0, represents the number code of the operation, which can be found under Table Operations - 3 parameters: in the list of Codes. The remaining three, p1, p2 and p3 correspond to p1, p2, p3 in the description of the operation above. In the following examples, the input table is a 4-column table: 1 2 3 4 Example: Operation selected is Func=p0; parameter(p0)=15
5 6 7 8 Example: Operation selected is Op(p1):p2,p3; parameters (p0, p1, p2)=2,2,3 1 2 3 4 This takes a list, la, and a number, ncols, as inputs. Together these represent an input table (see Tables), where la represents the cell values and ncols represents the number of columns in the input table. The functions include many Transformations. These take this input table, which has both shape and values, and produce an output table. The shape of the output table is, depending on the Transformation function, either the same as the input table, i.e. with ncols columns, or else that shape turned through 90 degrees, i.e. with ncols rows. The values in the cells are dependent on the Transformation function. The result list for the functions that are Transformations consists of the values in the output table selected from each row (left-to-right) starting at the top. So, for example, if the output table were: 4 3 5 6 the result list would be 4, 3, 5, 6, 2, 1, 8, 5, 4, 2, 1, 7 The result list for the functions that are Other represents some property of the output table, e.g. the ranks of the columns when the table is sorted according to its columns. Note: The results for an empty input list, la, are described below for all functions. All the functions described below, except the Sort... , Shift... , Permutation... , Ranks..., and Remove duplicates functions, assume that la=1, 2, 3, 4, 5, 6 and ncols =3, so that the input table is 1 2 3 Transformations For all the Transformation functions, if la is an empty list and ncols is a positive integer, the result is an empty list. Transpose row/col Rows and columns are swapped around, so that the top row becomes the leftmost column, the second row becomes the second column, and so on. Note: the output table has ncols rows. 1 4 Flip horizontally The leftmost column of the input table becomes the rightmost column of the output table, the second column becomes the second-to-right column of the output table, and so on. The output table has ncols columns. 3 2 1 Flip vertically The top row of the input table becomes the bottom row of the output table, the second row becomes the second to bottom row of the output table, and so on. The output table has ncols columns. 4 5 6 Rotate 90 degs The input table is turned 90 degrees clockwise. The output table has ncols rows. 4 1 Rotate 180 degs The input table is turned 180 degrees clockwise. The output table has ncols columns. 6 5 4 Rotate 270 degs The input table is turned 270 degrees clockwise. The output table has ncols rows. 3 6 Sort... functions The Sort... functions are all concerned with sorting the rows or columns. In all cases, the shape of the output table is the same as the input table, with ncols columns. To explain these, an input table with la= 4 3 2 2 and ncols=4 is used for the examples. Sort rows (asc) This function sorts the rows in ascending order (from top to bottom), where the primary key is the value in the first column. If the values in the first column are identical, then the values in the second column are used as a secondary key. This pattern continues, if necessary, for all columns. So, the output list (shown as a table here) is: 2 1 8 8 Note: Because the items is the first column (the primary key) of 4 2 1 1 and 4 3 2 2 are identical, the items in the second column (the secondary key) are used to determine the order. This results in 4 2 1 1 being considered less than 4 3 2 2. Sort rows (desc) This is similar to Sort rows (asc) but the rows are placed in descending order top to bottom. The output list (shown as a table) is: 4 3 2 2 Sort cols (asc) This sorts the columns in ascending order from left to right, where the primary key is the value in the first row. If the values in the first row are identical, then the values in the second row are used as a secondary key. This pattern continues, if necessary, for all rows. The output list (shown as a table) is: 2 2 3 4 Sort cols (desc) This is similar to Sort cols (asc.) but the columns are placed in descending order left to right. The output list (shown as a table) is: 4 3 2 2 Sort ind. rows (asc) This function sorts the values in each of the individual rows in ascending order. So, the output list (shown as a table here) is: 2 2 3 4 Sort ind. rows (desc) This function sorts the values in each of the individual rows in descending order. So, the output list (shown as a table here) is: 4 3 2 2 Sort ind. cols (asc) This function sorts the values in each of the individual columns in ascending order. So, the output list (shown as a table here) is: 2 1 1 1 Sort ind. cols (desc) This function sorts the values in each of the individual columns in descending order. So, the output list (shown as a table here) is: 4 3 8 8 Shift... functions The Shift... functions are all concerned with shifting rows or columns by one row/column in a certain direction. In all cases, the shape of the output table is the same as the input table, with ncols columns. To explain these, the same input table as for the Sort... functions above will be assumed. Shift rows up The output list (shown as a table here), where row 2 has become row 1, row 3 has become row 2 and row 1 has moved to the end, is:
2 1 8 8 The other Shift... functions operate in a similar way Permutation: Rows The individual rows remain intact, but their relative positions change pseudo-randomly. One possible result, using the same input table as for the Sort... functions, is:
4 2 1 1 Permutation: Cols This operates similarly, but pseudo-randomly re-orders the column positions. Rows bottom-right (and similar operations) The four functions Rows top-left, Rows top-right, Rows bottom-right, and Rows bottom-left all have an output table the same shape as the input table, i.e. with ncols columns. They specify that the values in the original input list, la, should be entered into the output table in rows, starting at the specified cell. Each row is filled in the same direction - the direction being dictated by the starting cell. Reminder: All the functions concerned with laying out the values in a particular way assume an input table as follows: 1 2 3 So, Rows bottom-right yields the follow output table: 6 5 4 Notes: Cols bottom-right (and similar operations) The four functions Cols top-left, Cols top-right, Cols bottom-right, and Cols bottom-left all have an output table the same shape as the input table, i.e. with ncols columns. They specify that the values in the original input list, la, should be entered into the output table in columns, starting at the specified cell. Each column is filled in the same direction - the direction being dictated by the starting cell. So, Cols bottom-right yields the follow output table: 6 4 2 S-Rows bottom-right (and similar operations) The four functions S-Rows top-left, S-Rows top-right, S-Rows bottom-right, and S-Rows bottom-left all have an output table the same shape as the input table, i.e. with ncols columns. They specify that the values in the original input list, la, should be entered into the output table in rows, starting at the specified cell. In contrast to the basic Rows transformations, alternate rows are laid out in opposite directions, so that the values from the list snake (hence the S) through the table. So, S-Rows bottom-right yields the follow output table: 4 5 6 S-Cols bottom-right (and similar operations) The four functions S-Cols top-left, S-Cols top-right, S-Cols bottom-right, and S-Cols bottom-left all have an output table the same shape as the input table, i.e. with ncols columns. They specify that the values in the original input list, la, should be entered into the output table in columns, starting at the specified cell. In contrast to the basic Cols transformations, alternate columns are laid out in opposite directions, so that the values from the list snake (hence the S) through the table. So, S-Cols bottom-right yields the follow output table: 6 3 2 Other Reminder: All the functions described below, except the Ranks..., and Remove duplicates functions assume an input table as follows: 1 2 3 Number of rows This function produces a list with a single number in it: the number of rows in the table. For the example, the result would be the list: 2. Numbered rows This produces a table with an additional column on the left containing the row numbers. 1 1 2 3 Numbered cols This produces a table with an additional row at the top containing the column numbers. 1 2 3 If la is an empty list, the result is the column numbers for ncols. Numbered rows/cols This produces a table with an additional column on the left containing the row numbers, and an additional row at the top containing a 0 followed by the column numbers (as above). 0 1 2 3 If la is an empty list, the result is a 0 followed by the column numbers for ncols. Head: 1st row This produces a list containing just the items of the 1st row. The result for the example is: 1 2 3 Tail: all but 1st row This produces a list all the items of the table except for the 1st row. The result for the example is: 4 5 6 Sums of rows This function produces a list of the sums of each of the rows. The result for the example is: 6, 15. If la is an empty list, the result is an empty list. Why? There are no rows so no row totals Sums of cols This function produces a list of the sums of each of the columns. The result for the example is: 5, 7, 9. If la is an empty list, the result is a list of length ncols, each item having a value=0. Why? There are ncols columns, each with zero items, so the total of each column is zero. Ranks ... functions The Ranks... functions are all concerned with sorting the rows or columns and returning, as a list, the ranks of the rows or columns in the input table. Note: if two or more of the rows or columns (as appropriate) are identical, their ranks will also be identical. If, for example, there are 3 identical rows or columns ranked 4th, the ranks 5 and 6 will not appear in the output list; the next rank (if any) will be 7. To explain these functions, an input table with la=
4 3 2 2 and ncols=4 is used for the examples. Ranks rows (asc) This function considers the table that would result from sorting the rows in ascending order (from top to bottom), namely:
2 1 8 8 The result of the function is a list of the rankings of each of the input table rows (i.e. the positions of the rows from the input table as found in the sorted table). In this example, the list returned is therefore 3, 1, 2 as the 1st row of the input table is the 3rd row of the sorted table, the 2nd row of the input table is the 1st row of the sorted table, and so on. If la is an empty list, the result an empty list. Why? There are no rows so no row rankings. Ranks rows (desc) This is similar to Ranks rows (asc) but the rows of the output table are placed in descending order top to bottom. The result is: 1, 3, 2 Ranks cols (asc) This is similar to Ranks rows (asc) but in this case it considers the table that would result from sorting the columns in ascending order (left-to-right), namely:
2 2 3 4 The result is therefore: 4, 3, 1, 1 Note: there are two identical columns, both = 2, 8, 1, so both are ranked 1 (the lowest). There is therefore no column in the input table ranked 2. If la is an empty list, the result is a list of length ncols, each value on the list = 1. Why? There are ncols columns, each having zero items, so each column is identical so each has a rank of 1. Ranks cols (desc) This is similar to Ranks cols (asc.) but the columns are placed in descending order left to right. The result (showing a joint 3rd rank) is: 1, 2, 3, 3 Remove duplicate rows If the input table contains duplicate rows, all but the first of these (top-to-bottom) are deleted. For example, if the input table (written as a table with ncols=2) were:
3 4 then the lower rows with values 2, 3 and 1, 2 would be removed and the output table would be:
3 4 If la is an empty list, the result is an empty list. Remove duplicate cols If the input table contains duplicate columns, all but the first of these (left-to-right) are deleted. For example, if the input table (written as a table with ncols=8) were:
2 3 4 3 5 1 2 2 then the output table would be:
2 3 4 5 1 2 If la is an empty list, the result is an empty list. The first two inputs for Table Construction are a list, la, and a number, ncols. Together these represent an input table (see Tables), where la represents the cell values and ncols represents the number of columns in the input table. Merge table lc @ col d This is concerned with simple merging of two tables, each with the same number of rows. List lc specifies the values of the table to be merged in, laid out in the usual way (left-to-right for each row of the table). The value d specifies the column at which this is to be merged in. The simplest merge is where table given by lc is placed to the right of the table defined
by la and ncols. That is, the first column of the table given by lc becomes the ncols+1 So, if la = 1 2 3 4 5 6 7 8 9 10 11 12 and ncols=4, then the input table is: If lc is specified as 20 21 22
23 24 25
26 27 28, then the table to be merged, which is assumed to have 3 rows, is If the value of d is specified as 5 (ncols+1), then the resulting table is: If d is specified as 1, then the table given by lc becomes the 1st column of the resulting table, i.e. the table given by lc is placed to the left of the main input table: If d is specified as 3, then the table given by lc becomes the 3rd column of the resulting table, i.e. Line Change Each of the Line Change operations takes the input table, and constructs an output table . The operations are all concerned with inserting additional sets of row or column values, possibly associated with deletion/replacing of existing rows or columns. The remaining two inputs are a list, lc, which represent a set of values that are to be put into the table in some way, and d, a number, which represents a row or column number in the table. In all cases, the number of values in lc must correspond to a whole number of rows or columns, as appropriate for the operation. If not, an error results. The result list consists of the values in the output table selected from each row (left-to-right) starting at the top. Note: The results for an empty input list, la, are described below for all operations. The examples for the operations described below assume that la=1, 2, 3, 4, 5, 6 and ncols =3, so that the input table is 1 2 3 Insert lc @ row d This inserts the additional rows defined by the values in lc in the
table, with the first of these additional rows becoming the d Example: lc = 7, 8, 9, 10, 11, 12 and d = 2 Output table: Example: lc = 7, 8, 9, 10, 11, 12 and d = 1 Output table: Example: lc = 7, 8, 9, 10, 11, 12 and d = 3 (although the input table has only 2 rows, d=3 is a valid input which indicates that the new rows should be inserted after the existing rows, i.e. the first one is row 3 of the output table). Output table: This is a useful function to insert a list of arbitrary length into another list at a given position, by defining ncols=1. For example, if lc = 1, 2, 3, 4, 5, ncols=1, lc=7, 8, 9 and d=3, the result is 1, 2, 7, 8, 9, 3, 4, 5 If la is an empty list, the result is lc (assuming the length of lc corresponds to the number of columns) if d=1, otherwise it is undefined . Del. row d & insert lc This firstly deletes the existing row d of the input table, then inserts the
additional rows defined by the values in lc in the table, with the first of
these additional rows becoming the d Example: lc = 7, 8, 9, 10, 11, 12 and d = 2 Example: lc = 7, 8, 9, 10, 11, 12 and d = 1 Example: lc = 7, 8, 9, 10, 11, 12 and d = 3 Example: lc = L0 and d = 1 This deletes the first row and inserts an empty list, i.e. no rows. Using an empty list as input lc is a way of deleting a given row. If la is an empty list, the result is undefined . Why? There are no rows, so none can be deleted. Subst. lc @ row d Starting at row d of the input table, the rows defined in lc are entered into the table. These rows are substituted for (i.e. replace) the corresponding rows in the input table (assuming they exist). Example: lc = 7, 8, 9, 10, 11, 12 and d = 1 Output table: Example: lc = 7, 8, 9, 10, 11, 12 and d = 2 Output table: Example: lc = 7, 8, 9, 10, 11, 12 and d = 3 (although the input table has only 2 rows, d=3 is a valid input which indicates that the new rows should be placed after the existing rows, i.e. the first one is row 3 of the output table - and there are no rows to replace). Output table: Example: lc = L0 and d = 1 Output table: If la is an empty list, the result is lc (assuming the length of lc corresponds to the number of columns) if d=1, otherwise it is undefined . Insert lc @ col d This inserts the additional columns defined by the values in lc in the
table, with the first of these additional columns becoming the d Example: lc = 7, 8, 9, 10 and d = 2 Output table: Important: Remember that the list lc in this and the other 'col' operations defines a sequence of column values laid out top to bottom. So, the two sets of column values are 7, 8 and 9, 10 (not 7, 9 and 8, 10 as you might be tempted to think). N.B. This is quite different from Merge table lc @ col d. The other 'col' operations, Del. col d & insert lc and Subst. lc @ col d, operate in a similar way to the 'row' operations, but on columns instead of rows. For all the 'col' operations, if la is an empty list and lc is an empty list and d is a valid column number, the result an empty list, otherwise it is undefined . Why? The length of a column on the input table is 0, so all columns inserted or substituted must also have 0 length. Cell Change Cell Change operations take the input table and produce an output table that has the same size and shape as the input table. The values of the cells of the output table are the same as the input table, unless explicitly changed by the operation (but see below for the impact of input d). These functions are primarily (but not exclusively) of value when producing graphical outputs. Input lc consists of sets of parameters/values associated with the changes. If input d is defined as -1 (or any negative value), all the final values in the output table are multiplied by -1. This can be useful if you wish to operate with positive numbers for colour formats, as it enables you to produce negative (borderless) values without using an additional numipulation box. If d is 0 or positive, no such change is made to the values. In all cases, more than one set of parameters/values may be supplied. The changes are made one set at a time (left to right). These changes may conflict, so that a change made to a cell by one set may be overwritten by a change made by a set further to the right. The result list consists of the values in the output table selected from each row (left-to-right) starting at the top. Change cell values The input lc represents a list of parameters. These parameters are in groups of three, where the first represents a row number, the second represents a column number and the third represents a value. Any number of groups of three parameters may be specified in lc. Note: if the number of parameters is not a multiple of three, any surplus ones are ignored. The way this operation operates is that each group of three parameters (rownum, colnum, val) is taken in turn. The value of the cell at [rownum, colnum] is changed to val. The examples below assume that la=1, 2, 3, 4, 5, 6 and ncols =3, so that the input table is 1 2 3 Input d is defined as 0. Example: lc=2, 1, 13, 1, 3, 6, The output table becomes 1 2 6 Example: lc=2, 1, 13, 1, 3, 6, 2, 1 10 The output table becomes 1 2 6 Note: if any set of three parameters includes an invalid cell specification, the result is undefined . So, if la is an empty list, any changes specified in lc will result in undefined . Change block values This is concerned with changing the values of a block of items in a table. The input lc represents sets of parameters and values. The first 4 numbers in any set represent: - the row number of the item at the top left corner of the block,
- the column number of the item at the top left corner of the block,
- the height (number of rows) of the block,
- the width (numberr of columns) of the block.
One set of parameters/values follows on immediately from the preceding set. These may specify changes to values already changed by a preceding set of parameters. Note: if there are 4 or fewer surplus numbers in lc, these are ignored; however, a set of 5 or more numbers is assumed to form a set of parameters/values. These must specify correct row and column numbers, and include the number of values implied, otherwise the output is undefined. Note: If the height or width of the block is less than 1, the result is undefined. The examples use the same input table as above: 1 2 3 Input d is defined as 0 in these examples.
Example: lc= The output table becomes 1 71 72
Example: lc= The output table becomes 1 71 72 Fill block values This is also concerned with changing the values of a block of cells in a table, but using the same value in relation to each cell rather than a list of different values. This allows a block of a table to be filled with the same value. The input lc represents sets of 5 parameters/values. These represent: - the row number of the item at the top left corner of the block,
- the column number of the item at the top left corner of the block,
- the height (number of rows) of the block,
- the width (number of columns) of the block,
- the value to be used in the change - the same value for each cell of the block.
Note: any surplus parameters/values are ignored. Note: If the height or width of the block is less than 1, the result is undefined. The examples use the same input table as above: 1 2 3 Input d is defined as 0 in these examples.
Example: lc= The output table becomes 1 71 71
Example: lc= The output table becomes 1 71 71 Edge block values This is concerned with changing the values of certain elements of a block of cells in a table, namely those cells that form the edge of a block (some form of rectangle). It is identical to Fill block values above, except only the outer edge of the block is filled with the value specified. Fill circle values This is concerned with changing the values of certain elements of a block of cells in a table, namely those cells that approximate to a circle. Each cell of the circle is filled with the same value. Clearly this is valuable for graphical applications. The input lc represents sets of 4 parameters/values. These represent: - the row number of the item at the top left corner of the block containing the circle,
- the column number of the item at the top left corner of the block containing the circle,
- the diameter (number of cells) of the circle (the height and width of the block),
- the value to be used in the change - the same value for each cell in the circle.
Note: any surplus parameters/values are ignored. Note: If the diameter of the block is less than 1, the result is undefined, as it is if the diameter is not an integer. Note: As the diameter decreases, the shapes become less circular. Edge circle values This is concerned with changing the values of certain elements of a block of cells in a table, namely those cells that approximate to the edge of a circle. It is identical to Fill circle values above, except only the edge of the circle (generally one but maybe two cells width) is filled with the value specified. Line values This is concerned with changing the values of cells that approximate to a straight line between two cells of a table. It is mainly of use in graphical applications. The input lc represents sets of 5 parameters/values. These represent: - the row number of the first end of the line,
- the column number of the first end of the line,
- the row number of the second end of the line,
- the column number of the second end of the line,
- the value to be used in the change - the same value for each cell of the line.
Note: any end may be considered the first end. Note: any surplus parameters/values are ignored. For a 100x100 input table, if lc = 1 1 100 100 -3, then a diagonal red line from the top-left corner to the bottom-right corner is shown when the output table is displayed in the Animation Zone. This takes two lists of items as inputs, [a] and [b], and produces a list as its result (the same length as [a]). For each item, a, on [a], and its corresponding item, b, on list [b] (which cycles in the standard Numipulator way), the selected operation is carried out as specified in Number Operation, and a corresponding item is generated on the result list. Add: a+b (as an example) Example: [a]=2, 4, 5, 7; [b]=7; Result=9, 11, 12, 14. This takes a list of items as input, [a], and produces a list as its result (the same length as [a]). For each item, a, on [a], the selected function is carried out as specified in Number Function, and a corresponding item is generated on the result list. Square (as an example) Example: [a]=2, 4, 5, 7; Result=4, 16, 25, 49. Items Coded Operations - Row X These functions all have a list of items as their first input, [a], and a set of numbers in the second list, lb, that contains some numbers that represent operator codes and some that are numbers on which the operators operate. In all cases, the list of results produced is the same length as [a]. The second list, lb, always begins with an operator code (unless it's empty), which is an incomplete expression. For each item, a, on [a], the number a is placed in front of the numbers in lb to produce a complete expression. This is evaluated to give the result for a. The three functions below correspond to the related functions in List Function to Number. Calculator (a Op Num...) Unless empty, lb consists of the following sequence: Op Num Op Num..., where Op is a number representing a number operator (see the Codes link near the top of Numipulator for these). Once the item from [a] is placed in front of this sequence, a complete expression, a Op Num Op Num... is produced. This is evaluated exactly as described in the Calculator function of List Function to Number.Reminder: the operator codes begin: Remember also that, as described in the Calculator function in the List Function to Number set of functions, the string may also include number function codes, through the use of the mock operator code 100. Example: if [a] = 9, 10, 11, 12 and lb=2 1 9 10 1 1 or - 1 DIV 10 + 1 (if the +-x/ mappings are used), then the result is 1 1 2 2. An example using number functions is [a] = 1 2 3 and lb = 100 1 3 pi (or f:Square x pi, if using suitable text to number mappings), which will result in the areas of circles with radii of 1, 2 and 3; the fornula for each one is equivalent to πr Expression (a Op Num...) The calculation of the completed expression a Op Num Op Num... is exactly as described for the Expression function in the List Function to Number set of functions. That is, the evaluation follows the conventional operator precedence for the main operators (+, -, *, / and ^ (power)), as in the BODMAS/PEMDAS convention, rather than simple left-to-right evaluation as with Calculator. Example: if [a] = 9, 10, 11, 12 and lb=2 1 9 10 1 1 or - 1 DIV 10 + 1 (if the +-x/ mappings are used), then the result is 10 11 12 13. Case: 1st (a Op Num...) The general form of lb is Op Num Num Op Num Num ... (Num), where Op is an integer from 1 to 6 or 14 to 19 representing a comparison operator. The evaluation of the completed expression a Op Num Num Op Num Num ... (Num) is exacly as described for the Case: 1st function in the List Function to Number set of functions. Example: Suppose [a] has the value 6 2 4 3 and lb has the value: Memory Number - Row Y and Memory List - Row Z The Memory Number and Memory List numipulation boxes are possibly the most difficult to understand. They are concerned with enabling you to carry out a series of calculations in which results from one press of the = button are used as inputs to the next. If you don't use Memories, and keep the same values in all your numipulation boxes, you'd expect the results to be the same every time you press the = (Calculate) button (unless you've generated a list containing random numbers, carried out some random permutation of a list, or used now as an input): same inputs, so same results. Memories essentially allow Numipulator to remember a result from one press of an = button and use that as an input to the next press of an = button, so that different results may be generated (it also works from one Repeat cycle to the next - see later). The behaviours of Memory Numbers and Memory Lists are identical. During a calculation, two values associated with a Memory numipulation box may be evaluated: - The first, its current value, is specified by the mem field, second from bottom. This, like any other input field, may contain a number or a reference name (or a mixture of these in the case of a list). Once evaluated, the resulting value, which is the value that is used whenever the numipulation box is referred to in other boxes, is output into the result field at the bottom (next to the reference name, as with most other numipulation boxes). However, an unusual feature of the mem field is that you cannot type into it. Where the specification comes from is described below.
- The second value that is derived during a calculation is based on the value or definition given in the next field, just above the mem field. You can type into this, and can specify a value, including the use of reference names, as you can with any other input field. The value is calculated just like any other value during the calculation; however, it is not, and cannot be, used as an input value to any numipulation box during this calculation. At the end of the calculation, the resulting value is output into the mem field. Now, because the value specified in the mem field becomes the value of the bottom or reference field, this means that this value will be the value of the reference field during the next calculation. The mem field is, therefore, the key to a Memory numipulation box: a result from one calculation cycle becomes an input/value in the next calculation cycle.
The best way to demonstrate this is to provide an example, which just makes use of one Number Operation and one Memory Number:
This shows the state before the = button has been pressed, where the init field for Y1 is specified as 4, its next value is specified as A1, and the value of A1 is specified as Y1+1 (but none of these have been evaluated yet). After pressing =, the boxes will look as follows:
The specification in the init field, 4, would have been transferred into the mem field, as it was initially empty, and this has ended up as the result, or value, of Y1, as shown. This value has been used to yield the value 5 for A1, as shown. The next field is defined as A1, so the resulting value, 5, has been put into the mem field (overwriting the 4 that had been transferred there at the beginning). This will be the value of Y1 in any next cycle. After pressing = again, the boxes will look as follows, since the value of Y1 is evaluated as 5 (from mem at the beginning of the calculation), and A1 is evaluated as Y1+1=5+1, i.e. 6, which also becomes the new value of mem. Note that the init field has not been used this time, as mem was not empty.
Overall, then, you specify just two values for a Memory box: - the initial value, init, which is to be used if the mem field is empty;
- the next value, next, whose result gets put into the mem field, and becomes the value of the Memory box during the next calculation.
From the description above, it sounds as though the value specified in the init field will only ever be used once: on the first-ever calculation, as the mem field will never be empty again. However, you can re-initialize all the Memory boxes by pressing the IM button (Initialize Memories) on the left. This clears the contents of the mem field and main result field, then, if the init field of a Memory is not empty, its contents are transferred into the mem field, to become the value of the Memory box at the next calculation. This means that you may re-run a set of calculations from scratch, or run them with a different data set. The boxes below shows the result of pressing the IM button after the last calculation in the example just shown: 4 has replaced 6 in the mem field, and the Y1 result field is empty.
Important: If the next field is left empty, no change is made to the mem field during a calculation. By entering a specification only in the init field, a Memory Number or Memory List effectively acts as a Common Number or Common List, but one in which the actual value is visible in the result field. You may find the L0 (empty list) constant useful when using Memory Lists. If building up a list of results at each cycle, you may need to define the initial value of the list as L0. One time you might use Memories is when you're calculating compound interest with variable interest rates. You might want to calculate the interest earned in the first year, add it to the initial sum to give you the total at the end of the year, and then use this as the initial sum for the next year. You can also use Memories for carrying out many complex list operations, since you can deal with one item from a list at a time, and construct the resulting list from the results of each cycle. Note: for many complex list operations, you will not need to use Memories, since Numipulator already has many item-by-item operations built in. Note: When inspecting details of calculations or relationships using Values or Flow, you will see two distinct reference names associated with each Memory box. For example, you will find Y1 and newY1, where newY1 refers to the value derived from the specification in next, which will become the value of Y1 in the next calculation cycle. Remember that these new... names cannot be used as an input to any other field, and that during a calculation cycle Y1 and newY1 are independent: Y1 is defined by mem, while newY1 is defined by next. The Formula numipulation box is intended to provide solutions to specific, commonly-encountered formulae, such as volumes and areas of common shapes, and solutions to complex number operations. The input list for Formula consists of parameters. The selected Formula operation may take 1 or more parameters, and the input list may contain more than one set of these parameters. The number of input parameters for the selected Formula operation is implied by the items, separated by semicolons (;) following the colon (:) in the operation description. These also indicate what the numbers represent. For example, the operation Growth: Initial; Rate%; Periods indicates that this takes 3 parameters: the first represents the initial amount or size; the second represents the growth rate, expressed as a percentage (for a given period); and the third represents the number of periods being considered. Calculation generates results for each set of parameters, and these form the result list. In the Growth example, there will be one number output for each set of three parameters in the input list (representing the final amount or size after this number of periods). Growth: Initial; Rate%; Periods This takes sets of three parameters representing the initial amount or size,
the percentage rate of growth over a given period (e.g. year) and the number of
periods (e.g. years). The calculation yields one number representing the
final amount or size after the given number of periods at the given growth rate. This is useful for calculating compound interest at a fixed rate for a given time. Length between points: X1; Y1; X2; Y2 There are four parameters in the set: X1; Y1; X2; Y2, where X1; Y1 are the
coordinates of one point, and X2; Y2 are the coordinates of the second
point. The result is the distance between the two points, based on the
formula √((X2-X1) Example: If X1; Y1; X2; Y2 = 0, 0, 3, 4 then the result is 5 Areas Circle area: Radius There is only one parameter in the set: Radius (r) of the circle.
The result is the area of the circle, based on the formula πr Sphere surface area: Radius There is only one parameter in the set: Radius (r) of the sphere.
The result is the surface area of the sphere, based on the formula 4πr Cone surface area: Radius; Height There are two parameters in the set: Radius (r) of the base of the
cone; height of the cone (h). The result is the surface area of the cone
(inc. base), based on the formula πr(r+√(
r Triangle area: S1; S2; S3 There are three parameters in the set: the lengths of the three sides of the triangle (S1, S2 and S3). The result is the area of the triangle based on the formula √(S(S-S1)(S-S2)(S-S3) where S is the semi-perimeter of the triangle: (S1+S2+S3)/2. Triangle area: Base; Height There are two parameters in the set: the base length (b) of the triangle and its perpendicular height (h). The result is the area of the triangle, based on the formula bh/2. Volumes Sphere volume: Radius There is only one parameter in the set: Radius (r) of the sphere.
The result is the volume of the sphere, based on the formula 4/3(πr Cone volume: Radius; Height There are two parameters in the set: Radius (r) of the base of the
cone; height of the cone (h). The result is the volume of the cone, based
on the formula πr Pyramid volume: Base Area; Height There are two parameters in the set: Base area of the pyramid (A); height of the pyramid (h). The result is the volume of the pyramid, based on the formula Ah/3. Complex Number Operations These are operations on complex numbers, i.e. on numbers having a real part and an imaginary part. The four operations defined, addition, subtraction, multiplication and division, each take as inputs four parameters, which define two complex numbers, C1 and C2: R1 is the real part of C1 In all four operations, the result is a list whose two elements represent R3 and I3, the real and imaginary parts of the resulting complex number, C3. Complex addition: R1; I1; R2; I2 If C1 = 3 + 4i and C2 = 5 - 3i then enter parameters: 3, 4, 5, -3 The result is 8, 1 since C3 = C1 + C2 = 8 + i Complex subtraction: R1; I1; R2; I2 If C1 = 3 + 4i and C2 = 5 - 3i then enter parameters: 3, 4, 5, -3 The result is -2, 7 since C3 = C1 - C2 = -2 + 7i Complex multiplication: R1; I1; R2; I2 If C1 = 2 + 3i and C2 = 4 + 5i then enter parameters: 2, 3, 4, 5 The result is -7, 22 since C3 = C1 X C2 = -7 + 22i Note: the formulae used are: Complex division: R1; I1; R2; I2 If C1 = -7 + 22i and C2 = 4 + 5i then enter parameters: -7, 22, 4, 5 The result is 2, 3 since C3 = C1 / C2 = 2 + 3i Note: the formulae used are: Conversions The conversions here are for those to or from measurements that are not simple decimal numbers, namely feet and inches (12 inches = 1 foot), pounds and ounces (16 oz = 1 lb) and stones and pounds (14 lb = 1 stone). In all cases, these non-decimal measurements are entered or output as two numbers: a whole number of the larger unit, e.g. feet, and a decimal number of the smaller unit. The metric unit equivalent is entered or output as a simple decimal number. All decimal number outputs are rounded to 2 decimal places. Just two are given below, one non-metric to metric, and one metric to non-metric. The others follow the same pattern. Conv ft & in -> cm: ft; in There are two parameters in the set: the number of feet (should be a whole number); and the number of inches (decimal). Conv cm -> ft & in: cm There is one parameter in the set: the number of centimetres (should be a whole number). The output consists of two numbers for each input parameter: the number of feet (whole number) and the number of surplus inches (rounded to 2 decimal places). Body Mass Index Body Mass Index, or BMI, is a commonly-used measure to assess whether someone
is overweight, obese, and so on. The BMI is determined by the formula W/H BMI (height & weight): cm; kg There are two parameters in the set: Height in cm; Weight in kg. BMI (height & weight): ft; in; kg There are three parameters in the set: The first two together express the
height in feet and inches (the first is the number of feet; the second the
number of inches); the third is the weight in kg. BMI (height & weight): ft; in; lb There are three parameters in the set: The first two together express the
height in feet and inches (the first is the number of feet; the second the
number of inches); the third is the weight in pounds. BMI (height & weight): ft; in; stone; lb There are four parameters in the set: The first two together express the
height in feet and inches (the first is the number of feet; the second the
number of inches); the last two express the weight in stones and pounds
(the third is the number of stones; the fourth the number of pounds). The Equation Solver numipulation box is intended to provide solutions to equations: quadratic equations and simultaneous linear equations. The input list for Equation Solver consists of a single set of coefficients for the equation(s). Quadratic equation ax^2+bx+c: a; b; c Given a quadratic equation of the form ax For a set of three coefficients, representing the values of a, b and c, this
operation generates a pair of numbers representing the two values of x. Simultaneous Eq'ns n: nX(n+1) coeffs This operation is concerned with solving simultaneous linear equations, where there are unique solutions of the variables that satisfy the equations. For example, given the two simultaneous linear equations: 5x - 2y = 4 the unique solutions for x The simultaneous equation operation in Numipulator is intended for solving n equations that contain n variables. The result is a list of the unique solutions for the n variables. Each value in the input list coeffs represents a coefficient or constant in a set of linear equations of the form: c where the coefficients c Important: The constants of the n simultaneous equations (k The number of simultaneous equations to be solved is not input explicitly. This is determined from the number of values in coeffs, since, if there are n equations, the number of coefficients is nX(n+1). So, for 2 equations there are 2X3=6 coefficients, for 3 equations there are 3X4=12 coefficients, for 4 equations there are 4X5=20 coefficients, and so on. If the number of values in coeffs does not correspond to an integer value for n, an error will be produced. So, to solve two simultaneous equations such as: 5x - 2y = 4 the coefficients are input (in coeffs) as: 5, -2, 4 The result is a list containing the values of x and y that satisfy both these equations, namely: 2, 3 To solve the three equations: x The result is a list comprising the values of x, y and z that satisfy all
three equations, namely: Whenever you press the = (Calculate) button, one set of calculations is carried out and the results are displayed. The Go buttons for Repeat until (the one in the Repetitions box or the one down the left) allow you to perform a sequence of calculations before the results are displayed. This sequence, these repetitions, are intended principally for use with Memory Numbers and Memory Lists , since these enable you to carry results from one set of calculations as inputs to the next set of calculations. Only when the repetitions have completed are the results displayed. Note: the value shown in the Cycle field is incremented each time (it has the value 1 for the first cycle). The Repeat until functionality allows you to specify that calculations should be repeated until some condition is met. The condition is specified as a comparison between two numbers, where the comparison is selected from a drop-down list as one of < , <= , = , <> , >= or >, unless both input fields are left blank, in which case the condition is deemed to be satisfied, by default, after one evaluation cycle. Either of the two numbers may be specified directly as a number or by a reference name (just like any other input field). When the Go button to the right of the Repeat until field is pressed, one set of calculations is carried out (unless exactly one of the input fields is undefined, in which case no calculation is carried out). If both input fields are blank, no further calculations are carried out and the repetition stops after one cycle (by default), otherwise the values of the two Repeat until fields are evaluated as part of this, and a check is made to see whether the condition is satisfied by these values. If it is, no further calculations are carried out and the results are displayed; if it is not satisfied, a further set of calculations is carried out. This continues until the condition is satisfied. If the value of either Repeat until input field is not a number, a suitable alert is given and no further repetitions are carried out. Control1 The Control1 field lets you specify that a delay should occur between one cycle and the next. The value defines a delay time in seconds. The value may be either specified as a number or as a reference to another numipulation box. Specifying a reference name enables you to change the delay time each cycle, if you wish. The specified delay occurs after the value has been calculated in that cycle. This is particularly useful for graphical applications. It can allow an appropriate time for a player to respond in the Graphics Formatter or Animation Zone. If the specified value is 0, or no value is specified, then no delay occurs; this has an important impact on the Graphics Formatter, as no delay means that no graphical inputs can be accepted from one cycle to the next. For games, allowing the user to vary the delay time can be a good way to speed up or slow down the game. Cycle The number of cycles carried out when the repetitions stop is shown in the Cycle field. This field also shows how many cycles have been carried out while repetitions are underway. Note: it also displays 1 after the '=' (Calculation) button is pressed. Stop Repetitions In case you set up a repetition cycle that goes into a loop, e.g. because the Repeat until condition cannot be met, you may press the red Stop button on the left. This stops calculation at the end of a cycle, and the results so far are displayed. The button can, of course, be pressed whenever you wish to stop a set of repetitions, and can be restarted by pressing a Go button. Warning Beware of setting a Repeat until condition that is based on the equality of two numbers that are not integers. The internal inaccuracies of Numipulator mean that even though you might expect equality, this may not be achieved. Even if the results output look as though the two numbers are the same, they may not be. See Accuracy and output number rounding for more on this. Repetitions and Value Changes Before a set of repetitions begins, and, indeed, before any calculation begins, Numipulator determines the inital values and relationships, as given by the text in the numipulation boxes, Mappings, etc. For the second and subsequent cycles, the values and relationships already defined are employed, so any changes to the numipulation box text (and this is possible under certain circumstances) will have no effect. The only values that are independent of others (apart from functions generating random numbers or permutations) that can change from one cycle to another are: - now (the new time is checked at the beginning of each cycle)
- Graphin1 and Graphin2, if graphical input between cycles is specifed
- click (is set to 1 if a graphical input has been accepted, otherwise it is set to 0)
- keypad (is set to one of the values 1-9 if a keypad click has been made since the start of the previous cycle, otherwise it is set to 0)
- any Memory value, if a next value has been defined.
You might expect that if a certain number of calculation cycles were carried out using one of the Go buttons, then the results would be exactly the same as if the = button were pressed the same number of times. However, there may be some differences. This may be for one or more of the following reasons: - the value of now will be different;
- the value of any random number or permutation generated will probably be different.
Mappings and Output Formatting The Mappings box allows you to define text and symbols to represent numbers. The words and symbols may then be used in any list or number input field to represent that number. This allows you to enter data in terms that are more meaningful to you. For example, if you are entering data about certain countries, e.g. UK, USA, Germany and France, and are using the numbers 1, 2, 3 and 4 to represent these in your data, you can instead map these words to the numbers 1, 2, 3 and 4 in the Mappings box and enter lists or numbers that include these words. The word Germany will be treated as the number 3. Mappings are entered in the Mappings box in the form of a list, where the groups of characters and numbers are separated by the same separators as numbers in a list input field. The list is treated as a sequence of Mapping Number pairs (any surplus word or number is ignored). So, to map UK, USA, Germany and France to 1, 2, 3 and 4, the list entered would be: UK 1 or even as UK : 1, USA : 2; Given these mappings, we could then have the two inputs to an addition being France and Germany. The answer would be 7. Any sequence of characters may form the Mapping except the following: - any predefined constant or time, such as pi , e or now ,
- the word Mappings itself (this has special significance - see below)
- those beginning with a numeral, a '+' followed by a numeral or a '-' followed by a numeral. The following are all invalid: 6A -6A +6A, as are 121.5 or 45 (you can't redefine numbers!)
- any sequences that begin with one of the following: A , B , ... Z , List , Num , Form , Equation , Graphin , Control , newY , newZ followed by a sequence of numerals only. This ensures no conflict with Reference names or system names. So, the following are all invalid: C1, C67, List5. However, C, C1Credit, C1_Credit or C1-Credit, are valid as they do not end with a sequence of numerals only.
Note: symbols may also be included. Several built-in Numiplets include mappings to symbols: < <= = <> > >= to improve the interface. Beneath the Mappings text box are three buttons that can be used to add commonly-used mappings: - A-Z - adds mappings for the capital letters A-Z to the numbers -1 to -26.
- +-x/ - adds mappings for the codes (1-28) for Number Operators (as given when pressing the Codes button). Next is included for 0 when separating expressions in Calculator list and Expression list functions.
- <=> - adds mappings for the codes (14-19) for comparison operators (as given when pressing the Codes button). These are useful for the Case: Comp function and related functions.
A sequence of pairs may be preceded by the special word Mappings followed by a GroupName . Any mappings following, up till the next Mappings GroupName heading, form part of this mappings group. Although the mappings specified are used for inputs, the GroupNames are used for output formatting only (see below). So, the Mappings box list might contain two mappings groups - one for countries, one for regions, as defined by the following list, which will be used in some examples below: Mappings Countries Note: if the same name is mapped to 2 or more different numbers in the Mappings box, only the first such mapping is used for input mapping. The Table Formatter and Graphics Formatter both provide facilities for mapping outputs: taking a number and mapping it, or formatting it, to some sequence of characters. These can make outputs more meaningful. In all cases, the formatting of a number is defined by a string of characters - an Output Formatting String . In all cases, if no specific formatting is successfully applied, the default Output Number Rounding is applied. a) Output Formatting String = Mappings If the string consists of just the word Mappings , the first Mapping Number pair, where the Number = the number to be formatted, is found from the Mappings box. The Mapping is output instead of the number. So, if the list of numbers to be formatted is: 1, 2, 3, 4, 5, 6 b) Output Formatting String = Mappings GroupName If the string consists of the word Mappings followed by a GroupName (separated by a single space), the first Mapping Number pair, where the Number = the number to be formatted, is found from the specified Mapping Group. So, if the Output Formatting String = Mappings Regions , then, if the
list of numbers to be formatted is: 1, 2, 3, 4, 5, 6, In contrast, if the Output Formatting String = Mappings Countries ,
then, if the list of numbers to be formatted is: 1, 2, 3, 4, 5, 6, c) Output Formatting String contains internal mappings If the string contains a colon or a space, and is not one of the other formats defined here, the mapping is defined within the Output Formatting String itself.
The string consists of one or more lines, each one of the form These lines are checked, in order, until a line is found where the number to be formatted satisfies the Test defined. If so, the output mapping is all the Text on that line following the first colon or space. The Test components are simple comparisons: a comparison operator (<, <=, =, <>, >=, >) followed by a number (no spaces). A simple number may also be the Test, equivalent to = followed by the number. Alternatively, the Test may just be the single letter n , which always succeeds for any number. Note: the Text may include spaces; it may also be empty. So, if the Output Formatting String is 0 Zero the list of numbers 1, 4, 6.5, 12, 0, -1 maps to: Very small, Small, Average, Large, Zero, Very small In contrast, if the Output Formatting String is the same list would map to: Average, Average, Average, 12, Average, Average since any number < 10 immediately satisfies the first Test, so the later Tests are ignored. No Test succeeds for 12, so it is output with standard rounding. Since these Output Formatting Strings may occur in more general Row Formatting Strings (see Table Formatter), certain characters or character sequences will be taken to represent other characters: ~ represents a tab (as you generally will not be able to type in a tab) d) Output Formatting String is a non-negative integer If the string is a simple positive integer, or 0, the number is rounded to this number of decimal places. e) Output Formatting String is a date format There are a number of date formats, intended for formatting a non-negative integer in the Numipulator YYYYMMDD data format, such as 20070331, which represents the date 31 March 2007. The data formats are listed below, together with the output for the number 20070331: DDMMYYYY - 31/03/2007 The date format may also be followed by a single character, which will be used as a separator instead of '/'. So, for example DDMMYYYY: gives the output 31:03:2007 Date formats may also be used for times or other numbers. If the number is less than 10000, the YYYY part is taken as 0. Note: the DD and MM parts of the output always have two numerals (with initial zeros inserted if necessary), but the YYYY part has the minimum number of numerals possible. So, the input number 130512 would, for the format YYYYMMDD:, be output as 13:05:12. The Table Formatter lets you format a list of numbers into a table. This table is purely an output for display - it has no reference name so cannot be used as an input to any numipulation box. You can, of course, copy and paste the table into other applications, e.g. spreadsheets or word processors. Essentially, it takes a list of numbers and displays it as a table, i.e. as a set of rows and columns. You may also specify lists of numbers to be displayed as column labels, row labels, or both. Additionally, there are four fields concerned with defining formatting strings. In this formatted table, each row is displayed on a new line. The items on each row are, by default, separated by the selected output list separator, unless this is a paragraph, in which case a tab is used as the separator. So, since a new paragraph is the default list separator, the default separator of items in a table row is a tab. This makes the default table output suitable for copying and pasting into a spreadsheet. There are four main inputs to the Table Formatter (all of which may be treated like inputs to numipulation boxes, i.e. you may use numbers, reference names, or, for lists, a mixture, to specify their values): la , n , Row labels and Column labels The first input, la, defines the list of values to be shown in the table. The second input, n, specifies either the number of rows or columns there should be in the output table (whether rows or columns is determined by the layout operation selected). There are four format operations. Horizontally, n columns This specifies that the values on la should be laid out horizontally (i.e. from left to right starting at the top left) in a table with n columns. Example: For la=1, 2, 3, 4, 5, 6 and n=2, the table produced is: 1 2 This is the default. Horizontally, n rows This specifies that the values on la should be laid out horizontally (i.e. from left to right starting at the top left) in a table with n rows. Example: For la=1, 2, 3, 4, 5, 6 and n=2, the table produced is: 1 2 3 Vertically, n columns This specifies that the values on la should be laid out vertically (i.e. from top to bottom starting at the top left) in a table with n columns. Example: For la=1, 2, 3, 4, 5, 6 and n=2, the table produced is: 1 3 Vertically, n rows This specifies that the values on la should be laid out vertically (i.e. from top to bottom starting at the top left) in a table with n rows. Example: For la=1, 2, 3, 4, 5, 6 and n=2, the table produced is: 1 3 5 The last two list inputs to the Table Formatter are: - Row labels . This is a list whose values form the labels of the
output table rows
(top-to-bottom). Specifying this is optional, but if it is specified,
the number of values must equal the number of rows in the output table.
- Column labels . This is a list whose values form the labels of the output table columns (left-to-right). Specifying this is optional, but if it is specified, the number of values must equal the number of columns in the output table.
Note: if both row labels and column labels are specified, the top-left 'cell' of the table displayed is represented by a single space character. As an example of how you might use row and column labels, suppose you took two lists 3, 4, 5 and 10, 20, 30 40, and used the cross-pair operations to produce a list of containing the product of each cross-pair, i.e. 30, 60, 90, 120, 40, 80, 120, 160, 50, 100, 150, 200. With this list as la and a value of 3 for n , then if the format operation Horizontally, n rows is selected with the row labels defined as 3, 4, 5 and the column labels as 10, 20, 30 40, the following overall table is displayed: Note: If la is an empty list, L0 only is displayed in the table output field, as long as n is defined as a positive integer, regardless of whether row or column labels are defined, or of what their values/lengths are. Note: There are also two output fields, Number rows and Number columns . These display the number of rows and columns in the main output table (excluding labels). More advanced formatting In addition to enabling you to display a table of numbers with default separators, the Table Formatter also provides you with functionality that gives you a high degree of control over layout and the ability to include text in the table. Note: this section is complex, so our advice is that you leave off reading this initially, and look at some built-in Numiplets to gain a better understanding. There are four fields concerned with this: Column label text This takes, as input, an Output Formatting String , as discussed in Output Formatting. Each number in the Column label is formatted according to this string. This allows you to output text as column headings, instead of numbers, to make the table more meaningful. So, given a table with three columns, and a column label list = 1, 2, 3, the following definition of Column label text =1:Base cost would give the following column headings: Base cost Tax Total cost Row label text Like Column label text, this takes, as input, an Output Formatting String. Each row label number is formatted according to this string. Main format This field takes a Row Formatting String as input. It defines the formatting of every row in the main table (but not the row labels), and partial formatting of the column label row. A Row Formatting String defines both the formatting of separators (including any text coming before or after the number) and, optionally, the formatting of the numbers themselves. The general format is: SeparatorFormat @ OutputFormattingString @ SeparatorFormat @ OutputFormattingString @........ That is, each number in the row is denoted by a pair of @ symbols, optionally with an Output Formatting String that defines the formatting of the number in that position/column. The SeparatorFormat consists of text specifying separators and any pre- or post-text. It may be empty (and the first one will frequently be empty). Certain characters or character sequences will be taken to represent other characters in these strings: ~ represents a tab (required as you generally can't enter a tab directly into
your browser's field) For example, to format a three-column table with values as follows: 20060331 24.657 13.32 so that the first column is formatted in DDMMYYYY format, the second column is rounded to 2 decimal places, and has a tab and a '$' symbol before it, and '(US)' after it, and the last column is preceded by a tab and has 'kg' after it, the following Row Formatting String is required: @DDMMYYYY@~$@2@(US)~@@kg Note: in this case, the number in the third column has no formatting (apart from default rounding), as there is no string between the two @ symbols. The ~ symbol represents a tab. The resulting output is: 31/03/2006 $24.66(US) 13.32kg Note: If the string has more @ pairs than the number of columns in the table, the first surplus @ pair and any following text are ignored. If there are more columns than @ pairs in the string, the next column and subsequent ones take default formatting (and separators). Note: Unless the Row Formatting String is completely empty, it always defines at least one separator. The final separator defined is the text from the last @ pair (if any) up to the end of the string (or up to the next single @ if this exists). So, if the Row Formatting String ends with @, the last separator defined is empty: the next value (assuming no repetition, see below) will be placed next to the one before, with no separating space, tab or any other character. A Row Formatting String may also contain a repetition symbol, '|' (the bar character). Any text between this and the end of the string (or the next | if there is one) is treated as a repetition string, as long as it contains at least two @ symbols. When determining the formatting of a row, and a column is reached for which there is no @ pair in the Row Formatting String , the repetition string is added to the end of it. So, given a Row Formatting String as follows: @DDMMYYYY@| $@@ then the row 20060331 3.45 5.62 6.78 is formatted as 31/03/2006 $3.45 $5.62 $6.78 while a Row Formatting String as follows: |$@0@(US)~ formats a row with any number of elements. For example, the row 3.45 5.62 6.78 is formatted as: $3(US) $6(US) $7(US) Note: If row labels are specified, and a Row Formatting String is defined, the separator between the label and first column must be explicitly defined. Note: The separators and pre- and post-text defined by the Row Formatting String of Main format are also applied to the column label row, although the formatting of the numbers themselves is not applied to the column label values. These may, however, be overridden by a Row Formatting String defined in Column label format (see next). Column label format Column label format is another Row Formatting String that is applied only to the column labels. The formatting defined in this, overrides any formatting of separators (inc. pre- and post-text) defined in the Main format , and any formatting of the values defined in Column label text . Note: If you wish to apply the formatting defined in the Column label text to a particular column, instead of defining a different format, enter no text between the two @ symbols for that column. If you wish to apply the default output number rounding to a particular column, enter the word default between, the two @ symbols. So, if Column label text contains just the number 2 , meaning that column labels are to be rounded to 2 decimal places, and Column label format contains: @@~@n:Cost@~@default@~ this means that the first column label will be rounded to 2 decimal places, the second will be the word Cost , while the third will be rounded according to the default Output Number Rounding. Open button The Open button, at the top right of the Table Formatter, displays the values, without the formatting defined in the Table Formatter, in a table/grid in the Information Zone. The form of this is suitable for copying and pasting into a spreadsheet. The Graphics Formatter is a powerful tool that lets you: - display a table of results in a grid;
- associate colour, borders, shapes or images with the values displayed;
- specify that certain values should not be displayed;
- map text to the output values, both in the grid and in a feedback field;
- provide graphical input, by mouse-clicking/tapping on the grid cells, including between repetition cycles;
- display graphical output between repetition cycles.
Overall, these features provide you with a means of: - visualizing your data;
- watching the progress of a set of repetitions graphically;
- developing your own graphical tools and apps (Numiplets), including ones that are dynamic and display graphical changes at each cycle and allow mouse-click/tap inputs;
- having fun - seeing how calculations and manipulations of numbers can be used to produce puzzles and games - even those based around words and letters.
Yes, numbers can be fun, and Numipulator with its Graphics Formatter proves it. The Graphics Formatter Grid The visible Graphics Formatter grid is, by default, a 10X10 grid. The values of any table may be displayed in the cells of this grid. The table to be displayed is specified in the Table parameters boxes to its left: the field la specifies the list of values that form the table, while ncols specifies the number of columns in the table. The values are always laid out horizontally (left-to-right) starting at the top row, row 1. If the length of la and the value of ncols do not specify a valid table, an error message is given in the Feedback field, and any repetitions are halted. The grid may be extended by specifying different numbers of rows or columns through tapping on the small table at the bottom left of the Graphics Formatter area. The number of each may be set from 10 to 25 (in steps of 5). The current setting for each has a green background. A table that extends beyond the grid size can also be specified for display, but only the grid-size portion of it will be displayed. Other parts of the table can be viewed by using the +1 or +5 buttons or -1 or -5 buttons to move the focus of the display. The =1 button moves the display back to the first cell of the row or column. Note: The row and column numbers being displayed are shown in the beige stripes at the left and top respectively. Note: If the value of ncols is inappropriate for the number of values on la, the table will be treated as having one column only. Adding colour, borders, shapes and images By default, the values of the table are displayed in white text fields on a white background (the black background showing at the beginning changes when a table is specified for display). All the other cells are shown completely blank. However, there is another field, below ncols, called Cell formats . A list of values, which must be identical in length to that of la, may be specified in this. These values specify the background colours, borders, shapes or images to be displayed for the corresponding value on la. If the lengths of la and Cell formats are not identical, an error message is given in the Feedback field, and any repetitions are halted. For simplicity, Numipulator employs codes that map to 20 colours as backgrounds to the square tiles, with or without borders. The values on this simplified list should be integers in the range -20 to 20. Essentially, these are mapped to 20 colours and to border/no border, as follows: 1=white; border The numbers -1 to -20 have the same colours, but have no border. In addition, 0 has a black background and no border, and, importantly, does not display the value in a text box. This is useful for creating a plain, black background, regardless of the associated values. The full set of format codes can be seen by clicking the Codes button near the top of the main Numipulator page. This also describes the use of other format codes, which give you millions of available colours, and codes that specify a large set of shapes and images, including emojis, with, a wide range of colours for both the shape and the background, and for larger text on the tiles (intended for 1 character only), again with the same text and background colours. There are also codes that let you display graphics from external web sites in the cells, employing URLs defined in the URLs field. So, given la=1,2,3,4,5,6 and ncols=3 and Cell formats=3,3,3,-2,-2,-2, a table with 2 rows and 3 columns would be displayed, with the cells of the top row having a red background and a border, and the cells of the second row having a black background and no border. Mapping text or NOTEXT to the values displayed As with the Table Formatter, text can be mapped to numbers and displayed on the grid instead of the numbers. The mapping is specifed in the Cell text field, which takes a simple Output Formatting String . So, if
la=-1 -2 31 2 27 4; Sometimes, you will choose not to display any text; in fact, you may wish to have no text field displayed in the middle of the grid cell. If you map any number to the special text value NOTEXT, the text field will not be displayed. This allows you to produce graphical output that has absolutely no text displayed, just colours. The built-in Numiplets provide you with many examples of text-mapping, the use of NOTEXT and the use of shapes and larger, coloured text. However, to try it out, enter the parameters 100, 20 in numipulation box G1 and select the operation p1 random ints 1->p2 . Then specify G1 as the list value for both la and Cell formats, ncols=10 and Cell text= n:NOTEXT. The last means that every number should be mapped to NOTEXT. When you press an '=' button, you should see the 20 colours randomly placed on the grid. Remember that the Output Formatting String can be just the word Mappings, in which case the Mappings declarations are used in reverse, so that a Mappings declaration A 1 B 2 is treated as Cell text: Feedback Text Above the grid is a text field intended for providing feedback, additional information, and so on. The values to be displayed in this are specified in the Feedback values field on the right, while the text mappings for these values are specified in the Feedback text box, again as a simple Output Formatting String . So, if the Feedback values were specified as P1, and the feedback text as: Note: If you are dealing with exclusively non-negative numbers as 'real' values, you may find it useful to employ negative numbers for mapping letters and words to, as in the above Feedback. Note: Feedback works only if the Graphical Formatter is in use (i.e. la and ncols are correctly defined). Graphics with repetitions On the left of the page are three small buttons below the green = button: Start, Go (both green) and Stop (red). These are all concerned with repetitions. Start and Go both initiate a set of Repeat Until cycles. So, if you wish to make use of these buttons, you need to define the Repeat Until values, or else leave them both blank so that exactly one cycle is carried out (by default). By default, the output will be displayed graphically after every cycle. However, you can also choose to prevent the display of graphics at the end of any cycle (apart from at the end of the last cycle, when graphics will always be displayed). To do so, specify a value in the field Control2 on the right of 0. This will prevent the display of graphics at the end of a cycle that is not the last cycle. Note: By making a reference to some other numipulation box in Control2, which may have the value 0 in some cycles and non-zero in others, you can control when to display the graphics. Note: If Control2 is not defined, graphics are displayed between cycles. Graphical inputs and clicks By default, you should see a green bar near the top of the Graphics Control box. This indicates that the system will accept your mouse-click. However, if you uncheck the box to Allow graphical input just above the green bar, the bar will change from green to red to indicate that clicking on the grid cells will have no effect. When you click on one of the grid cells (and the band beneath the check box is green): - The Graphin1 field on the right is changed to the Row number of the selected cell;
- The Graphin2 field on the right is changed to the Column number of the selected cell;
- The value of the system value click is set to 1;
- Assuming a set of repetitions is not already underway, a new set is begun, using the values of Graphin1 and Graphin2 specified by the mouse-click.
- No further graphical input is allowed (the green band turns red) - unless expressly specified as below.
By default, no further graphical inputs (through mouse-clicking on the cells) are allowed until the current set of cycles ends, at which point the red band turns green again. However, you may specify a value in the field Control1 in the Repetitions box. If the value of this, as calculated in a cycle, is greater than 0, the system will, at the end of that cycle, turn the band green, and wait for a period of approximately Control1 seconds, and accept any mouse-click made during that time (as shown by the band's being green). The last such click made during that time will be acknowledged by Numipulator (click will be set to 1 and the new values of Graphin1 and Graphin2 will be used in the next cycle). So, if Control1 has the value 1.5, the system will wait approx. 1.5 seconds to allow graphical input. Because you cannot type in values to Graphin1 and Graphin2, there will be no value specified in any first cycle. If you are using Graphin1 or Graphin2 in your program, this would cause failure. To overcome this, you can specify initial values for Graphin1 and Graphin2 in the init fields just above them; these values will be transferred into Graphin1 and Graphin2 if they are found to be empty. Note: The values of Graphin1 and Graphin2 remain unchanged in a set of cycles unless changed by a mouse-click. The system value click is important, as this is automatically set to 0 at each new cycle unless a click has been acknowledged, when it is set to 1. Your set-ups can therefore make a distinction between old and new values of Graphin1 and Graphin2. Note: If Control1 is not defined, graphical input is not accepted during repetitions, as there is no time delay to allow them. Start and Go buttons Both the Start and the Go button initiate a set of Repeat Until cycles. They are however different. The Start button first initializes all the Memory numbers and lists. It also inspects the init values above Graphin1 and Graphin2, and, if any of these are defined, it copies the text into the main Graphin1 and Graphin2 fields. This ensures that if you use the Start button to begin, you can set the values of Graphin1 and Graphin2 appropriately. If you make use of Graphin 1 or Graphin2 in any other Numipulation box, you must set these init values, otherwise Graphin1/Graphin2 will have no values, so an error occurs. In contrast, the Go button does not carry out these initializations. This is a useful button if you have pressed the Stop button to inspect the state of your calculation and then wish to carry on calculating without re-initializing. Open button The Open button opens up the Information Zone and displays the complete table currently being displayed in the Graphics Formatter (not just the grid area). As it is at smaller scale, the text fields and values are not displayed - only the colours. Emojis and shapes are displayed, but all larger, coloured text is shown as a ? of the correct colour, and URL images are displayed as X. The values underlying the displays may be seen on a laptop by hovering over the cell in the grid: the value and the row and column numbers are then displayed. URLs field To the left of the Graphics Formatter is a URLs field. Here, you can specify URLs of graphics to be displayed in the grid cells (see the Codes link for more on this: N=20). Each URL must be direct to a .jpg, .jpeg, .gif or .png file. If the URL does not end with one of these, it will not work. There should be one URL per line. The Animation Zone provides another means of producing graphical output, but it provides no means of interacting directly with the images produced by clicking on them. Instead, it provides an Animation Keypad, intended for controlling objects displayed on the screen. It is intended for developing animations such as those used in games, while the Keypad enables games of the shoot 'em up variety to be developed. The Animation Zone output area, like the Graphics Formatter, consists of a grid of cells. The number of cells in each row or column of the grid can be selected, at the bottom-left: from 10 to 150, in steps of 10. The grid is always square, so that selecting 40, which is the default, results in a 40x40 grid of cells, i.e. one containing 40 rows and 40 columns (1600 cells). Clearly, a grid size of 100x100 means it has 10000 cells, while 10x10 size means it has only 100 cells. The size selected will have an impact on the speed of response, as 10000 cells will take more computing power and time than 100 cells, so beware of using too high a size, as this may slow your app down too much. Unlike the Graphics Formatter, the size of the individual cells tends to reduce as the size of the grid gets bigger, so that the overall size of the grid remains <= 500 pixels. Note: If you wish to have a visible grid with a size that is not 40x40, 50x50, etc. use an available grid that is larger than the size you want and define a background with a colour code of -1142035035, which will exactly match the brownish background of the Animation Zone, so that you see only the grid that you wish to have. The same also applies to the Graphics Formatter. There is only one main input to the Animation Zone, called Cell formats. This must evaluate to a list with the exact number of items on it for the size selected, e.g. 1600 for a size of 40x40. If the length of Cell formats is invalid, an error message is given in the Feedback field, and any repetitions are halted. The numbers on the list are all used only to determine the colour and border of its associated cell. The only colour codes used are the numbers 0, 1-20, the short RGB codes 1000-1999 and the full RGB codes >= 1 billion, as described for the Graphics Formatter, and also their negatives. As with the Graphics Formatter, positive codes are displayed with a border, while negative codes are displayed without a border. So, the codes 3, 1900, 1255000000, -3, -1900 and -1255000000 all yield a red-coloured cell - the first three with a border, the last three with no border. Hint: If you don't like working with negative numbers to give borderless cells, use positive numbers but then multiply the resulting codes by -1; this approach is taken with the built-in Alien Invasion game. Note: using borders can significantly slow down the generation of the graphics, so we would recommend using no borders if speed is important. We would also recommend not using borders with a grid size > 80x80, as the colour of each cell becomes submerged by the borders. The Animation Zone also has Feedback values and Feedback text inputs that work precisely like those for the Graphics Formatter. The Animation Keypad is a 3x3 grid. The middle cell is red, and is intended for requesting 'shoot' or 'fire'. The outside cells all have arrows on them, generally specifying a request to move an object in a particular direction, although the developer of games in this
may choose to make them have different meanings. So, the game developer may choose to make the arrows pointing NE and NW (assuming N points up) to mean 'rotate clockwise' and 'rotate anticlockwise', for example. The developer may also change the symbols shown on the keypad to reflect the intended meanings, e.g. use rotation symbols. Any changed symbols
are defined in the Keypad symbols field below the Keypad. Pairs of numbers are given (formatted as a standard list): the first is the key on the Keypad whose symbol is to be redefined (1-9, see below), while the second is the Unicode number for the symbol, e.g. 8630 for an anticlockwise rotation. Use code 32 (space symbol) for any key not intended to
be used. So, if the Keypad symbols field has the folllowing content When the Keypad is clicked or tapped, an internal value is set. The values set by the keys are as follows:
At the beginning of a cycle, the last setting made, since the beginning of any previous cycle, by using the keypad becomes the value of the internal value keypad. If no keypad click has taken place in that time, the value of keypad is set to 0. So, if you wish to specify what the output should be when a user clicks on the fire button, e.g. in an If-Then-Else box, you should specify what the output is to be when keypad = 5. You may, of course, choose to disregard certain keypad clicks. There are a few built-in numiplets that make use of the Animation Zone. One, Moving truck animation, merely shows a truck moving across the grid, and no means of interaction using the keypad is provided. Another, Alien Invasion, is a version of a well-known 1970s game, in which you need to shoot down aliens to get points, while they are moving, descending and bombing you. This uses the keypad to fire missiles and to move the missile launcher. Some of the outer buttons have had their symbols changed from the defaults, so that the ones on the right move the missile launcher rightwards by 1, 2 or 3 cells, and the ones on the left move it leftwards by the same amounts. The built-in numiplet Keypad control to move object provides generic code for controlling the movement of an object in the Animation Zone with the keypad. Key points about the Animation Zone to be understood are: - The graphics are updated after every cycle; there is no option to prevent updating after a cycle as there is with the Graphics Formatter.
- The delay time specified in the Control1 field in the Repetitions box applies to the Animation Zone (as well as the Graphics Formatter). This can be used to control the speed of games in the Animation Zone.
- Keypad presses are accepted at all times, including during a calculation cycle, not just in the delay period afterwards.
- The Start, Go and Stop buttons, the Auto Start and Auto Go settings, and the Repeat until specifications operate exactly the same with the Animation Zone as with the Graphics Formatter.
Accuracy and Output Number Rounding As with all calculators and spreadsheets, Numipulator has accuracy limitations. Numipulator depends on the accuracy of the underlying browser's Javascript interpreter for its internal accuracy. These accuracy limitations can cause some surprises. For example, with one browser, the simple subtraction 3.6-1 yields a result of 2.6, as you would expect; however, the subtraction 4.6-1 yields a result of 3.5999999999999996. For those undertaking simple calculations, presenting this as a result would probably be unacceptable. For this reason, Numipulator, by default, rounds all outputs to 12 decimal places. With this rounding, 4.6-1 yields a result of 3.6. You may change the rounding of all numbers output by selecting the number of decimal places to which rounding should be carried out (0 - 12) from the drop-down list under Output Number Rounding in the Settings section towards the bottom of the Numipulator page. You may also select Internal, which means that Numipulator applies no additional rounding of the answers produced by Javascript. Output rounding to a lower number of decimal places can come in useful. For example, if you're calculating the total price, including tax, of goods based on their base price, you will generally want to see answers displayed to two decimal places only. Important: when a reference name is used in some calculation, the value used is the underlying value, not the value you see displayed after the set of calculations. So, if you have A1=2.8/5 and A2=A1+0.58 and you round outputs to 1 decimal place, the results will be shown as 0.6 and 1.1. You might have thought that A2=0.6+0.58 would be 1.18, which, when rounded to 1 decimal place, would be 1.2. But, the underlying value of A1 is 0.56, so the true value of A2 is 1.14, which rounds down to 1.1. If you want to ensure that rounded values are used as inputs, you will need explicitly to round values before they are used. So, if A1=2.8/5; B1=A1 with the Round to 1 dec. pl. function applied; and A2=B1+0.48, then the underlying value of A2 will be 0.6+0.48=1.08. With outputs rounded to 1 decimal place, the value of A2 will be displayed as 1.1. The accuracy limitations mean that you will also find problems or errors with very
large numbers (e.g. integers > 10 Note: The values put into the mem fields of Memory boxes are not rounded, but are the internal values. This helps to ensure that a series of calculations carried out by pressing the = button gives the same final outputs as a set of repetitions (where internal values are always used). Errors may occur when you're using Numipulator, and these will be handled in different ways. In all the cases below, these errors are identified and displayed to you once an = button is clicked, or when a Go... or Start button is clicked. In addition, if an attempt is made to load a Numipulator set-up that is empty or has a syntax error, an alert box to this effect is displayed. Note: if an alert box is displayed when an error is identified, you must
acknowledge the alert by pressing the OK button, or similar, depending on your browser. Incomplete inputs and other syntax errors If a numipulation box or other feature with inputs (e.g. Repeat until, or Graphics Formatter) has text in one of its input fields but not in some other one that is required for the calculation to occur, no calculation takes place and an alert box is presented, which notes that a Syntax error has occurred in a particular field which is <empty>. If the text in a number input field is not a single number or a valid reference name, no calculation takes place and an alert box is presented, which notes that a Syntax error has occurred in a particular field; the text input is also displayed. If the text in a list field is analysed and contains an item that is not a number or a valid reference name, no calculation takes place and an alert box is presented, which notes that a Syntax error has occurred in a particular field; the item text is also displayed. Note: if more than one syntax error is found, all are displayed in the alert box. Undefined inputs If the reference name of a numipulation box is used as an input, but the inputs for the numipulation are blank (so the value cannot be determined), no calculation takes place and an alert box is presented, which notes that a value is being specified but is undefined. Note: if more than one error of this type is identified, all are displayed in the alert box. Circularity If the linkage between numipulation boxes is defined in such a way that there is circularity, e.g. A1 depends on A1; or A1 depends on B1 which in turn depends on A1; or A1 depends on B1, B1 depends on C1 and C1 depends on A1, and so on, no calculation takes place and an alert box is presented. This notes that circularity has been found, and also states which numipulation boxes cannot be evaluated because of this circularity. Errors during calculation Even when calculation is underway, certain errors may be found. These do not result in alert boxes. Instead, the error message is shown as the result of the calculation (i.e. in the result field). Some of these error messages are produced by the underlying Javascript; others are identified and generated by Numipulator. NaN - indicates that the result is Not a Number. Typically, this results if an attempt is made to produce a numerical value that cannot be determined, e.g. square root of a negative number. undefined - indicates that the result cannot be determined. This is the result of an attempting to carry out some operation that is invalid, e.g. find the first item of an empty list; or find the First quartile of two numbers; or calculate the index of some item in a table from its row and column numbers, where these are not input as positive integers. Wrong type - indicates that a value passed as an input to a calculation is not a number (or, if a list, does not consist only of numbers). For example, if the result of an attempt to evaluate the square root of a negative number is used as an input to another numipulation box, the result will be Wrong type. This in turn, would cause a Wrong type error in any numipulation box dependent on it, and so on. If this error is encountered, any repetitions underway are simply halted (as if the Stop button had been pressed). Other output error messages will be relevant to specific operations, e.g. Error: Invalid ratio of list lengths (when attempting to merge
two lists) Once a calculation (single or repeated) has been completed, you may press the Values button in the main set of buttons on the left of the page. This presents, in the Information Zone, a summary of the calculations carried out. For each numipulation box involved in the calculation, the reference name (followed by any associated note, in parentheses), is presented. Underneath this, all the inputs are listed, together with their associated inputs (including any reference names used - not their calculated values). Next, the operation is summarized. Lastly, the resulting value of the numipulation box is displayed (but not for Common Numbers or Lists, or Memory Numbers or Lists, unless their definitions included reference names). The values are not rounded. Similar details are given for the Formatters and the inputs of the Repeat until boxes, if used. All these are listed out in the order of evaluation. So, if A1 depends on A2, then the details for A2 will be presented before those for A1. In this way, the general flow of a set of calculations can be reviewed. When a repetition has been carried out, only the values for the last cycle are presented. The input text and output values are those input or derived during the calculation, even if the text has since been edited. The notes, however, are those currently in the Note fields. At any time, you may press the Flow button to inspect the flow of data, or the dependencies between the various numipulation boxes and other fields. In the Information Zone, a table/graphic shows a tree-like representation of the relationships between the various numipulation boxes, fields and formatters. Below is part of one such representation.
Each element has a name with a box underneath for its associated note, so that you have some idea of what it represents. In this example, Tableformatall, which represents the Table Formatter and all its various fields, including its row and column labels, is shown on the left. This indicates that it is an output only, so no other element is dependent on it. To the right of this is Q1, which means that at least one of its fields refers to Q1. Note that there are vertical lines down from this which lead to another element on which it depends, but this is not shown here (it has been cut off). In turn, Q1 is shown to be dependent on Num2. This has a small dot after it, to indicate that it has no dependencies. Q1 also has vertical lines below it, with pointers to the right showing that Q1 also depends on T1 and Q2. T1 depends on two List1 and Num1, both without further dependencies. Q2 depends on three elements: Num2, List1 and T1. While the first two of these have no further dependencies, T1 does, but as its tree has already been shown, it is not repeated, and a note is given afterwards that it is expanded above. Overall, this helps you to understand your set-up better. It can also reveal some outputs on the left that you once used but no longer require and which can be deleted from your set-up. In a complex set-up, this is very likely to happen, as you will probably work in a bottom-up way, defining your data inputs, then performing calculations and manipulations of these, and so on until you define your final outputs, e.g. the Formatters. The Flow tool gives you, in contrast, a top-down view of the calculations and manipulations. Note: Before developing this diagram, the current set-up is checked for syntax and other errors, including circularity. If any such errrors are found, a warning is given and diagram is then produced. Note: Grafixformatall represents its various input fields, including cell formats and feedback values of the Graphics Formatter (but not the Graphics Control fields), and Animationall likewise includes the cell formats and feedback values associated with the Animation Zone. As the Numipulator application is written entirely in Javascript and HTML, it cannot carry out file operations, such as Save, as a typical spreadsheet package would. However, Numipulator does make provision for you to save your Numipulator set-up and to load a previously-saved Numipulator set-up. There are two approaches to saving and loading your numipulator set-ups: - A manual approach in which you save to a text file;
- An approach in which your set-up is saved to your browser's local storage. This works only if your browser supports local storage. They generally do if you're accessing Numipulator over the web, but some do not if you've saved Numipulator locally on your laptop or other device.
Regardless of the approaches available to you, you should still use the manual approach using text files for long-term storage or for sharing with others, so this approach will be covered first. At the heart of both approaches is the concept of the Numiplet. Numiplets A Numiplet is formatted text that defines all the relevant settings of a Numipulator set-up, namely: - all non-empty input field text, together with the associated selected operation;
- all non-empty note fields
- the Numiplet name and description for the set-up
- the number of columns in each of the main table rows
- various other relevant settings (e.g. Auto Start, Allow graphical input, rounding, output separator)
You can consider a Numiplet as an app that is run within the Numipulator environment. The Input/Output section deals with inputs of Numiplets on the left side (headed Input) and outputs on the right side (headed Output), each of which has a large box or text area. Saving a Numiplet to a text file The standard way of saving a Numiplet is to do so manually, to a text file that you create and save in a text editing application, such as Notepad on a Windows PC or TextEdit on a Mac. Saving a Numiplet as a simple text file is carried out as follows: 1) Give your Numiplet a description. This is particularly useful if you're intending to share it with others, but is also a good reminder for you. The Description text area is found at the top of the Input/Output: Numiplets section. 2) Give your Numiplet a name. This is done in the field called Current Numiplet Name just below the Description field . 3) Decide whether you wish any action to occur when the Numiplet is re-loaded. You have three choices, which can be selected by use of the radio buttons under the Auto Start and Go heading in the Settings section: - No action. This is the default.
- Auto Start. This means that when re-loaded the Start button will, in effect, be automatically pressed, so the Memories, Graphin1 and Graphin2 will be initiated, and a set of Repeat Until cycles begun. This can be useful for ensuring that the Graphics Formatter grid is automatically set up to display the graphical interface.
- Auto Go. This means that when re-loaded the Go button will, in effect, be automatically pressed, and a set of Repeat Until cycles begun. This can also be useful for ensuring that the Graphics Formatter grid is automatically set up to display the graphical interface.
4) Check that you haven't got large amounts of data in your inputs, unless this data will always be needed. If you have, delete the data in the field and replace it with a comment {....} so that the system knows you wish to save details of this field. 5) Press the Create Numiplet button, with the down-arrowhead, just under the Output heading. This deletes any text in the Output box below it and replaces it with formatted text containing the necessary Numiplet details. The name (title) always appears at the top, followed by the description, and then details of the table row widths. All the input specifications for the numipulation boxes then appear, together with the associated operation selections. Next come the other settings, including mappings and formatting definitions. And finally, the notes are listed. This Numiplet contains everything that you need to save. 6) Copy all the text from the Output box and paste it into a new text document (CTRL-A, and then CTRL-C, and then CTRL-V to paste it into the text document on a Windows PC), which should then be saved. Please note that you can use the Numiplet you have saved as text to create a standalone browser app: a single web page that you can send to others or put on a website, which will allow others to see or play with any graphical apps you have developed. Loading a Numiplet To load a previously-saved Numipulator set-up, follow these steps: 1) Delete any text already in the Input box on the left (e.g. click in the field and press CTRL-A then hit the Delete button on a Windows PC). Open up the text file containing your Numiplet. Copy all the set-up text from its source document (e.g. CTRL-A then CTRL-C on a PC) and paste it into the Input box (e.g. CTRL-V on a PC). 2) Press the yellow Load Numiplet button above the box, with the up-arrowhead. This will load your Numiplet, including executing Auto Start or Go, if defined. Important: This will overwrite any existing set-up. Just in case you had not intended to overwrite this without saving it, the existing set-up is output as a Numiplet in the Output box, as if you had pressed the Create Numiplet button. You can then choose to ignore it, save it as a text file, or reload it by pressing the Transfer Numiplet button, which transfers the text into the Input box, and then pressing the Load Numiplet button. Built-in Numiplets Your introduction to Numiplets should come from trying out and using the built-in Numiplets. These are Numiplets that are always available to you within Numipulator. These not only provide you with useful applications, or provide you with some fun, they also help to open your eyes to some of the possibilities open to you, and to the power of Numipulator. The built-in Numiplets are accessible through a drop-down menu a little below the Input box. Select one of these, then press the yellow button, with the up-arrowhead, just above it, which transfers the built-in Numiplet into the Input box. This enables you to look at the Numiplet before loading it, particularly its description. Once you are happy that you wish to load it, press the yellow Load Numiplet above the Input box. This will load it, and may begin to run the Numiplet, depending on the Auto Start setting. Many of these Numiplets were created using a prototype version of Numipulator that did not allow more than 5 numipulation boxes in a row. This means that some inventive, convoluted ways of carrying out some operations needed to be employed, particularly in the Pentad Numiplet. Numiplets with local storage If your browser supports local storage, you will find an area underneath the drop-down menu of built-in Numiplets titled Your Numiplets in Local Storage. This allows you to save and load your Numiplets to and from local storage. Local storage is an area of storage managed by your browser. Text can be saved to this, which can be retrieved by the browser at some later time. In some ways, use of local storage is like use of cookies, except there is no expiry time with local storage. The storage available to your browser should be a minimum of 1MB - substantially larger than cookie storage. The largest built-in Numiplet would take up less than 30kB, so even 1MB should leave plenty of room. It is worth noting, however, that other pages as well as Numipulator may use local storage, and the available space is shared. Large volumes of data stored in your Numiplets can greatly increase the amount of storage required, so do try to avoid this situation. Overall, local storage is very useful, but should not be relied on long-term, so you should save your Numiplets in text files as back-up. Numipulator provides you with 20 local storage 'drawers' for storing your Numiplets in. Initially, these are all untitled with only a skeleton content. Saving to a local storage drawer Saving a Numiplet follows the same first 5 steps as described for saving to a text file, so that the text of the Numiplet is in the Ouput box. Next, you select one of the 20 numbered storage drawers from the drop-down menu (preferably an untitled one), and then press the yellow Save Numiplet to Selected Destination button above it, with the down-arrowhead. The only acknowledgement you get for this is that the drop-down menu reverts to its default message. Note: The Numiplet name is used as the name of the drawer. The former contents of the 'drawer' are saved to the Backed-up Numiplet. Loading from a local storage drawer To load a Numiplet from a local storage drawer, select it from the drop-down menu on the left, then press the yellow Transfer Saved Numiplet to Input box button above it, with the up-arrowhead, so that the stored text of the Numiplet is put into in the Input box. Finally, press the yellow Load Numiplet button to load it into Numipulator, as with loading from a text file. Direct Save Numipulator also has a single Current Saved Numiplet drawer. Press the yellow Save button, with the down-arrowhead, to save the current state of your Numipulator set-up as the Current Saved Numiplet, without first moving it into the Output box. This overwrites any existing content, which is saved as the Backed-up Numiplet. You can also press the main Save button on the left. To restore the Current Saved Numiplet, press the Transfer Current Saved Numiplet to Input box button, with the up-arrowhead, to put the text into the Input box. From there you can load it, as previously described. Auto Save on Exit As described earlier, if your browser supports local storage and also allows actions when you exit Numipulator, your current Numipulator set-up is saved automatically as the Current Saved Numiplet when you exit (and the overwritten content is saved as the Backed-up Numiplet). The Current Saved Numiplet, whether saved automatically or by use of a Save button, should be automatically restored whenever you open or reload Numipulator (with the same browser and device). You can also restore it manually via the Transfer Current Saved Numiplet to Input box button, or through the List button (see next). List button The central yellow List button lists, in the Information Zone, the contents of all 20 local storage drawers, followed by the Current Saved Numiplet and the Backed-up Numiplet. This is your only means of accessing the Backed-up Numiplet, if needed. Probably more importantly, it means you can save all these Numiplets in a text file in one go by copying and pasting them into a text file. Exiting from Numipulator without Auto Save If you don't have local storage, or your browser doesn't support autosaving on exit, your current set-up cannot be saved when you exit Numipulator, so try to remember to save it using the Save button on the left before exiting. This is always good practice. If you forget, there may be an alternative: Numipulator always attempts to write your current set-up to a box in a pop-up window, so that you can save it afterwards. Note: Many browsers do not allow the opening of a new pop-up window on exit (see www.numipulator.com for more details), so do try to remember to Save your set-up. Making Standalone Browser Apps If you have created and saved a Numiplet, one that uses the Graphics Formatter or Animation Zone, you may create a standalone app that should run in any browser. Essentially, what you end up with is a version of Numipulator in which all the fields and buttons apart from a few are hidden. Your Numiplet is loaded automatically, and, depending on your Numiplet, either the Graphics Formatter or the Animation Zone will be displayed, but heavily modified so that only the fields the user needs to see are displayed. The user is unable to see or change any of the controls and sees just the graphics, the relevant note underneath the graphics, the relevant Feedback field and the app name and Description. For the Animation Zone, the keypad is, of course, also available. In addition, the user sees the Start, Stop and Go buttons, plus an additional Data button. The Data button makes available to the user versions of the longer input fields (Num1, Num2, List1 and List2), so that they can modify these if desired. You should, therefore, use these fields only for data that you wish the user to be able to modify, e.g. some basic input data, or control data that indirectly is used to control your app. So, for example, if you wish the user to be able to change the delay time with the Graphics Formatter, define the delay in Num1, say, and then define Control1 as Num1. Remember to provide the user with instructions about this in your Description. To create standalone apps, open up the Standalone Maker page, which can be found on the numipulator web site at http://www.numipulator.com/standalonemaker.htm. You will be prompted to specify a background colour, to paste in your Numiplet text, and then to press the Create App button. This will generate the HTML and Javascript code required for your standalone page, which you can copy and paste into a text file and save as a .htm or .html file, ready for use. The Settings section has three sub-divisions, each covered elsewhere in the Help: - Output Separator for Lists. See Formatting list results.
- Output Number Rounding. See Accuracy and Output Number Rounding.
- Auto Start and Go. See Input/Output: Numiplets.
Near the top of the Numipulator page are four Display links, all of which are displayed in the pop-up window. Getting Started This provides advice on getting started with Numipulator. Functions This gives a full listing of the functions and operations found in the various types of numipulation box. Codes This lists the codes used to specify formats (colours, borders, shapes, etc.) in the Graphics Formatter and Animation Zone and also the number codes used to specify functions, operations and comparisons in a number of 'meta-level' operations. Description This displays the description found in the Graphics Formatter. Text This presents a text version of the current program. In the main Numipulator interface, the contents of fields, particularly list fields, cannot always be seen easily. This presents all numipulation boxes in use using the format: This can be a useful format for looking at the program. You can also copy this into a text editor and search for text. However, it cannot be used for loading the program. This version of Numipulator is for an individual's non-commercial use only or for non-commercial educational purposes. Companies, corporations and other organizations may purchase Corporate Licences from TopAccolades Ltd. These may include corporate headers and logos. Details may be obtained at http://www.numipulator.com. See the Terms of Use section at the bottom of the main Numipulator page. Numipulator was designed and developed by Dr David Wolstenholme. Numipulator is a registered trademark of TopAccolades Limited. Copyright TopAccolades Limited, 2023 |