Using pSogol

Contents

Introduction
What Is pSogol?
Screenshots

To What Uses May pSogol be Put?
pSogol Demo Version
Getting Started
Installing pSogol
Using Existing Webs

pSogol Settings
The Settings Dialog
Choosing Output Destinations
Choosing Input Source
Specifying Report Output
Number Specifications
Execution
Plotting
pSogol Reports
Sample Reports
Computing with pSogol
Executing a Script
Contents of Script Fields
Expressions and Formulas
Rules for Referencing Other Cells in Expressions
Number or String?
Sample Calculations
Built In Functions
User Defined Functions
pSogol Script Language
pSogol Data Structures
Cell References

Comments
pSogol Statements
pSogol Grammar
Menubar
pSogol Menus
Errors And Limits
pSogol Error Conditions
pSogol Program Limits
Warranty, License, Registration, Distribution, and Support
Warranty
License
Registration
Distribution
Support


Introduction

What is pSogol


pSogol is a math assistant and calculator program for Windows. It can help with a wide variety of problems, from calculating networks of formulae, to performing dynamic simulations, to computing solutions to multiple equations in multiple unknowns. It's browser-like interface doubles as a hypertext notepad, which can be used to document the calculations in a web.

Screenshots:

   

   

The pSogol screen has one main pane with 6 tabs and a browser toolbar.

The first tab is the list tab, which presents a scrollable, selectable list of each cell in the current web.

The second tab is the text tab, which shows the text data for the selected cell in the current web.

The third tab is the value tab, which shows the value of the selected cell.

The fourth tab is the script tab, which shows the script of the selected cell.

The fifth tab is the console tab, which shows console input and output.

The sixth tab is the plot tab, which shows plot output from the current or most recent script run.

In the text and script panes, cell names are highlighted. Clicking a highlighted cell name makes that cell the selected cell. Double-clicking a word that is not a cell name creates a cell of that name, and makes it the selected cell.

The browser toolbar along with highlighted cell links embedded in the text and script panes, permits hypertext browsing of the current web.

To what uses may pSogol be put?

pSogol has many capabilities. Among other things, it can assist the user to:

Make webs of arithmetic formula’s and use them to compute anything of interest, such as work estimates, units conversions, stress & strain formulas, critical path in a schedule, or return on investments.

Iterate the computation of formula webs to model dynamic systems, solve differential equations, and simulate cellular automata and neural networks.

Apply numeric formulae to cognitive maps or causal networks, making them provide quantitative information about the domains modeled.

Compute the steady state conditions of fuzzy cognitive maps.

Use the script language to perform numerical analysis tasks, such as computing the roots of equations, solving multiple simultaneous equations, integrating a function over a domain of interest, or interpolating between data points with a smooth curve.

Try out algorithms before implementing them in other computing environments. Use the scripting language to simulate processes of interest.

Plot the results of computations in a built-in plotting window, or export data in conventional formats to spreadsheets or graphics packages.

Save webs for later use or for sharing with other users of pSogol.

In addition, pSogol's browser-like user interface provides a builtin hypertext notepad, which assists the user with tasks such as:

    Describing the calculations in a web
    Designing or reverse-engineering software
    Planning a book, a movie, or a website
    Recording and exploring relationships and ideas
    Documenting procedures
    Keeping linked notes and recipies
    Planning for contingencies
    Classifying flowers or insects
    Recording observations

pSogol Demo Version

The pSogol demo version is fully functional, except that it occasionally nags the user to register the program.


To find out how to register pSogol, the user may select the Help menu item About pSogol, and click the Registration Information button on the dialog that appears.


The user will be instructed to go to website www.codelode.com to register the program. After supplying the registration code and paying the registration fee, the user will receive a registration key via email. Information supplied for purposes of registration will not be sold or given away to third parties.

See the section called Registration for information on entering the registration key into the program.



Getting Started

Installing pSogol


Your pSogol program should have arrived as a self-installing archive, containing pSogol.exe, SciLexer.dll (the freeware edit control used by pSogol), and a bunch of other files. Make sure the Pocket PC is hooked up to the installing PC, and ActiveSync is running on both machines.  Double click the self-extracting archive, and follow instructions.

If you did not receive a self-extracting archive, go to www.codelode.com and download one.


Using existing webs

pSogol comes with a collection of pSogol application files (extension .sog). These are installed into the Pocket PC installation directory (usually \Program Files\pSogol.  These applications files may be executed by clicking on them in the File Explorer, or by copying them to MyDocuments or one of its subdirectories, and opening them from pSogol when it is running.

The home cell of a pSogol web is typically is used to document (in the text field) the purpose of the web and how it is used. A good web to try first is piggy, since it has perhaps the simplest computation of the lot.


Clicking on the running man figure in the menu bar executes the script of the current cell and any scripts it may invoke. Although the home cell is often the cell which is the root of the desired computation, often it is not. If the home cell is not the place to start computing, the documentation in the text field of the home cell should tell you which cells perform what calculations.


Mess around with some of the sample webs and get familiar with linking between cells, creating new cells, running scripts, changing the settings and so on. It won’t take long. You’ll be creating your own useful webs in no time.



pSogol Settings


The Settings Dialog


Click on the Edit menu, Settings choice. The following dialog will appear:

               

The individual tabs allow the user to specifiy pSogol behavior and appearance with regard to Links, Reports, Output, Input, Numbers, Execution, and Plotting.

In the picture shown, the Links tab is chosen, which allows the user to choose from four link colors, and to activate automatic cell creation on double clicking of words that are not cell names. It also allows the user to specify a dialog box be displayed before creating a new cell based upon a double-click.

Choosing Output
Destinations


Choosing the Output tab brings up the following dialo

           


There are three kinds of pSogol output, not counting plotting. These are report output, automatic output, and script output. Report output is produced when the user calls for a report. Automatic output is produced once per iteration (see execution settings) showing the values of cells that have changed. Script output is produced by the 'Out' statement in the Sogol language.


With the Output dialog, the user can direct output to the console pane on the screen  or to a text file named in the Output Name field ( a .txt extension is added by pSogol).  The output file will appear in the My Device directory of the Pocket PC.

 

Choosing Input Source


       

The script language has an In( ) statement, which accepts input from the console, a file, or from the text field of a named cell.

The Input Source combo box is used to choose between those three options for a particular web.

When input from a file is selected, Input Name contains the file name, less extension, which is assumed to be .txt .  The file must reside in the My Device directory of the Pocket PC.

When input from the text field of a cell is selected, Input Name contains the name of the cell from which input will be taken.

When the input comes from a generic dialog box, the Input Name field is ignored.

Specifying Report Output


Choose the Report tab, and the dialog below appears. This tells pSogol what to do when the user requests a report

          


Report type allows four choices: Formatted, In Pointers, Out Pointers and Trail.

For each cell name selected the text edit window, or if the "Report on All Cells" button is checked, for all cells, the formatted report generator scans the Report Format string supplied, outputting it’s characters one by one until it encounters a substitution code, such as \n, \N, \T, \S, or \V.

When \n is encountered, a carriage return linefeed is output to the output destination in place of the ‘\n’ string. When \N is encountered, the cell name is output instead of the string ‘\N’. When \T is encountered, the contents of the text field of the cell is output instead of the string ‘\T’. When \S is encountered, the contents of the script field of the cell is output instead of the string '\S'.  When \V is encountered, the contents of the value field of the cell is output instead of the string '\V'.  When \ is encountered, whatever character follows it in the format string, including ‘\’ is output to the output destination.


If Inpointers is selected, then for each cell name selected in the text edit window, or if the "Report on All Cells" box is checked, for all cells, the report generator puts out the cell name, followed by a list of cells which point to that cell name.


If Outpointers is selected, then for each cell name selected in the text edit window, or if the "Report on All Cells" box is checked, for all cells, the report generator puts out the cell name, followed by a list of cell names which are pointed to from that cell.


If Trail is selected, then the report generator merely outputs all of the cellnames in the browser stack kept in the combobox.


Choosing Number Formats


       

Value fields of pSogol cells may contain numbers or strings. Numbers are stored internally as floating point, but the manner of their display is controlled by the Number dialog.

General numbers are displayed as decimal numbers until their 10's exponent exceeds the number of digits specified, at which point they are displayed in scientific notation.

Fixed point numbers are displayed with the number of decimal places specified in number of digits.

Exponential numbers are displayed in scientific notation with a precision which depends upon the number digits specified.

All trigonometric builtin functions assume that their arguments are in either degrees or radians according to the setting of Trigonometry Units.

Choosing Execution Parameters


              

When the user clicks on the running figure in the menubar, the script of the selected cell is executed the number of times specified in Number of Iterations.


If a form of Automatic Output is selected, an output record is produced after each iteration.


If Generic List is the type of automatic output selected, pSogol outputs the names and final values of each cell that changed during the iteration which just finished.


If Formatted List is the type of automatic output selected, then a formatted list of results is output at the end of each iteration. The format of the iteration output list is contained in the List Format entry of the Execution dialog.

Format of the Header Line

If the first character of the List Format is a tilde ('~'), no header line is generated for the calculation. If it is not a tilde, the header line is generated in accordance with the following rule: A newline is output. Then the contents of the List Format string are copied directly to the output, except that any percent signs in the format string are ignored. Wherever the character pair '\n' appears in the List Format, it is replaced with a newline sequence.

Format of Each Iteration Chunk
The output generated at each iteration of a calculation depends upon the content of the List Format string. The manner of this dependence is described in the rule below:

The contents of the List Format string are scanned, and copied to the output until a percent ('%') sign is encountered. The next word after the percent sign is read to determine if it is a valid cell name. If it is, the current value associated with that cell is substituted for the cell name in the output string. Scanning and outputting of the List Format string is then resumed until the next percent sign or the end of the string is reached. Wherever the character pair '\n' appears in the List Format, it is replaced with a newline sequence.

NOTE 1: The selection of cells for formatted output is controlled entirely by the format string, and has nothing to do with the actual cells whose scripts are executed. This is necessary so that you can view only certain cells at each iteration, regardless of how many cells are executed.

NOTE2: Automatic Output is intended to support computations involving webs of expressions which refer to each other. With automatic output enabled, one needn't include any out( ) statements in the scripts to get a clear idea what happened at each iteration. When using scripts which manage their own iteration with while or for statements, and their own output with out statements, it is best to set the number of iterations to 1 and to turn automatic output off.

Setup Plotting


        

The Plotting dialog allows the user to determine two cells that will plotted against each other each time one or the other of their values changes.  It also allows setting the maximum and minimum values and number of intervals for each axis.


The cells associated with the independent and dependent variables, X and Y, are selected from all the cell names in combo boxes.


The plot limits are defined by the fields Xmax,Ymax, and Xmin,Ymin. Only coordinate pairs which lie within those limits show up on the plot.


The number of intervals between Xmin and Xmax, and between Ymin and Ymax, are determined by the fields Xintervals and Yintervals.


The color of the plot is determined by the selection of a color from the Plot Color group of buttons.



pSogol Reports

Sample Reports

(default formatted report from cave.twb)

*****AttackTheGnome**************************

You thrust your torch into the gnome's face, he dodges; and his broad axe separates your head from your shoulders. Your last impression is of the passageway tumbling crazily in your vision; and the sound of rushing water..... then icy silence.


*****ClimbTheRockChimney**************************

You climb for an hour before coming into the sunlight through an opening by a juniper bush on the side of a rocky slope. A rumbling sound intensifies around you, and you leap just in time to avoid the cave-in which closes the chimney from which you just emerged. You can see the lights of your neighboorhood just a short hike down the mountain. Strange adventure.


*****DiveIntoTheTorrent**************************

That was a hugely stupid thing to do! The water siezes you and plunges you through a winding cavern, rushing down without air, until you begin to feel strangely separate from yourself, observing as from a distance.


Suddenly, you break the surface. Your lungs gratefully gulp great draughts of air. A second later, the water slows down. Soon you are in a placid lake, surrounded by translucent, glowing crystal walls. You crawl onto a sparkling beach, and lie there exhausted.


Without warning, a booming voice enfolds you in its thunderous sound: "Be who you are." You look around, but nobody else is there.


Seeing no way out of the crystal cavern, you remember that you followed links from the home cell to get here. All you have to do to get home is just keep pressing Alt-left arrow.


*****EnterTrapDoor**************************

You are an adventureous soul. You drop lithely into a shallow pit below the trapdoor, which slams shut above your head. Before you is a passageway leading into the dimly lit bowels of the earth. A torch burns in a niche in the rock wall of the passage. You're in luck! The torch can be removed from its niche. You may choose to TakeTorchIntoPassageway, or GoBackToShack.


*****Fossil**************************

The only treasure in here is the exposed bed of limestone, rich with the fossilized history of the evolution of life on this planet.


*****GoBackToShack**************************

Unfortunately, the trap door above your head will not open, no matter how you pound on it. You may choose to LayDownAndDie or TakeTorchIntoPassageway..


*****GoHomeAndWatchTV**************************

A wise, and safe decision. On the way home you find $5 lying on the street. You congratulate yourself on your good fortune, and stop at a convenience store to purchase popcorn. There is a good movie on tonight!


*****home**************************

You are standing on a trap door in an abandoned shack in the forest. On the table before you is a map, apparently of subterranean caverns. Much of the map has been destroyed by time, but there is a section of the map that can still be read. On that section is the legend: "Here there be treasure".


If you choose to EnterTrapDoor, you may be able to find the treasure, and become rich. On the other hand, you may get lost, and leave nothing but your bones behind in a dimly lit crevasse far under the ground. If the risk is too great, you may decide to GoHomeAndWatchTV.


Click the link of your choice.


*****LayDownAndDie**************************

Quitter!


*****Noway**************************

There is no treasure in this cavern, which is not accessible from any other passage in the Cave. How did you get in here?


*****SmileAndBrushPastHim**************************

You smile politely and step nimbly around the little fellow, finding yourself suddenly in a cavern full of the sound of rushing water. From a ridge on one side of the room, there is a shaft of light coming down a rock chimney. On the other side, the river disappears into a hole in the wall. There is no air space in the hole, just rushing river.


You can ClimbTheRockChimney or DiveIntoTheTorrent.


*****TakeTorchIntoPassageway**************************

As you descend the passageway, you begin to hear trickling sounds, and to see rivulets of sparkling water along the path. Ahead, in the gloom, a pair of eyes appears; and you hear an ominous chuckling.


Suddenly you are confronted with a fabulously ugly little gnome, who is carrying a broad axe, and clearing his nostrils noisily on your feet.


You must decide whether to AttackTheGnome, or SmileAndBrushPastHim.


Sample Reports

(inpointers report from meditation.twb)

AdviceToBeginningMeditators
<Shamata
CategoriesOfShamataMethods
<Shamata
FifthShamataTechnique
<Shamata
FirstShamataTechnique
<Shamata
FourthShamataTechnique
<Shamata
home
MeditationPosture
<home
MeditationPractices
<home
NonReligiousMethod
<VarietiesOfMeditation
ReligiousMethod
<VarietiesOfMeditation
SecondShamataTechnique
<Shamata
Shamata
<AdviceToBeginningMeditators
<CategoriesOfShamataMethods
<FifthShamataTechnique
<FirstShamataTechnique
<MeditationPractices
<Shamata
<ShamataOnEssence
ShamataOnEssence
<CategoriesOfShamataMethods
ShamataWithFocalSupport
<CategoriesOfShamataMethods
ShamataWithoutFocalSupport
<CategoriesOfShamataMethods
ThirdShamataTechnique
<Shamata
VarietiesOfMeditation
<home
Vipasyana
<AdviceToBeginningMeditators
<FifthShamataTechnique
<MeditationPractices
<ShamataOnEssence
<Vipasyana

Sample Reports

(outpointers report from DIBPrinting.twb)

biBitCount
biClrImportant
biClrUsed
>biClrUsed
biHeight
biPlanes
biSize
>BITMAPINFOHEADER
>biSize
biSizeImage
bitCompression
BITMAPINFO
>BITMAPINFOHEADER
>RGBQUAD
>BITMAPINFO
>BITMAPINFOHEADER
>RGBQUAD
BITMAPINFOHEADER
>biSize
>biWidth
>biHeight
>biPlanes
>biBitCount
>bitCompression
>biSizeImage
>biXPelsPerMeter
>biYPelsPerMeter
>biClrUsed
>biClrImportant
>BITMAPINFOHEADER
bitmapTable
biWidth
biXPelsPerMeter
biYPelsPerMeter
Convert
>Convert
>BITMAPINFO
>DIBbitmap
>GetDIBits
>GetDIBits
>BITMAPINFO
>myBITMAPINFO
>BITMAPINFO
>GetDIBits
>BITMAPINFO
>DIBbitmap
>Transfer
DIBbitmap
>DIBbitmap
>RGBQUAD
GetDIBits
>GetDIBits
>Convert
>BITMAPINFO
>BITMAPINFO
>BITMAPINFO
>GetDIBits
>BITMAPINFO
>GetDIBits
>BITMAPINFO
>bitmapTable
>BITMAPINFOHEADER
>BITMAPINFO
>GetDIBits
>BITMAPINFO
>BITMAPINFO
>GetDIBits
>BITMAPINFOHEADER
home
>Convert
>Transfer
>Convert
>Transfer
myBITMAPINFO
>biSize
>biWidth
>biHeight
>biPlanes
>biBitCount
>bitCompression
>biSizeImage
>biXPelsPerMeter
>biYPelsPerMeter
>biClrUsed
>biClrImportant
>BITMAPINFOHEADER
RGBQUAD
>RGBQUAD
>RGBQUAD
SetDIBitsToDevice
>SetDIBitsToDevice
StretchDIBits
>StretchDIBits
Transfer
>SetDIBitsToDevice
>StretchDIBits

Sample Reports

(trail report from DIBPrinting.twb)

Trail:
BITMAPINFOHEADER
BITMAPINFO
Convert
home


Computing with pSogol


Executing a Script

If necessary, set execution preferences by accessing the Execute tab of the Settings dialog.

Position to a cell which contains a script that you wish to interpret. Click the Run toolbar button (running figure). The script of the cell will be executed, and if an arithmetic expression statement is executed, its result will be placed into the value field of the cell. If the script contains references to other cells followed by exclamation points or argument lists, the script's of those cells too, will be executed. If the Execute Settings dialog calls for automatic results to be output, or if Out() or Report() statements are part of the script, the results of their execution will be directed to the current output stream.

Contents of Script Fields

Script fields may contain sequences of script language statements, which are evaluated in order, or as directed by if, for, or while statements.

Examples of valid script field contents are shown below:

if(y<1) {
   a21+45*sin(cell3!)
} else {
   a21 -45*sin(cell3!)
}

An expression is a valid script language statement, so script fields may contain one or more arithmetic expression statements. The cell takes the value of the expression statement most recently evaluated.

123*home/4.1
or
3 4 5
or
abc>def
or
cell1() cell2() cell21!
or
subprogramX!
subprogramY(oh,my+1)
while(x>4) {
   subprogramZ!
   set x to x+2
}
x-4

See the pSogol Script Language section for details on the syntax of the script language.

Expressions and Formulas

An expression is a prescription for arriving at a new value from a combination of numeric and string values, and the results of built-in function calls. Examples include:

 1
1+3
1+sin(14)
mugga*pugnacious / 4
#
# note: cat is the string operator
# for concatenation
#
sign(my cat relations+3)
"eat" cat " pie"

A formula is a script language statement which consists of a single expression. When a script containing a formula is executed, the content of its value field is replaced by the value computed for the formula.


Rules for Referencing Other Cells in Expressions

pSogol allows the script of one cell to contain references to other cells. There are two kinds of references: execution references (cellname followed by exclamation point or argument list), and value references (cellname not followed by exclamation point or argument list).

An execution reference to a cell causes that cell's script to be executed, and assumes the value of that cell after the script has been executed.  The execution reference is like a function call in most programming languages.

Examples of execution references:

# without arguments
cellname! or cellname()

# with arguments
cellname(expr,pow(2,2))

A value reference to a cell does not execute the script of the cell referenced, but it does take on the value of the cell referenced.  A value reference is like a variable reference in most programming languages.

Example of value reference:

# no bang or parens in value reference
cellname

 

Using Execution References

The example below illustrates a simple application of the execution reference:

The web Example1 has two cells, a and b. Their values and formulas are shown below:

Cellname: a
Value: null
Script: b()-4                  Example 1

Cellname:b
value: null
Script:13+4

When cell a is executed, the b() in its formula is resolved by computing a value for b, and substituting it into the formula for a. When the computation is done, the value in b is 17, and the value in a is 13. The new values of a and b are independent of their previous values.

In the web Example2, the formula in cell a contains an execution reference to the formula in cell b, and the formula in cell b contains an execution reference to the formula in cell a.

Cellname: a
Value: 4
Script: b()-1                          Example 2

Cellname: b
Value: 14
Script: a()+2

When the formula for cell a is interpreted, the execution reference to b causes the program to first attempt to evaluate the formula in cell b. The formula in cell b, in turn, requires an interpretation of the formula in cell a. This computation cannot be carried out, as it will repeatedly start new interpretations of each cell until it runs out of memory, and a STACK OVERFLOW ERROR is generated.

An execution reference to a cell which does not have a script expression or set the cell's value behaves like a value reference to that cell.


Using Value References

The example below illustrates how a script interpretation proceeds when cell references are not followed by exclamation points or argument lists.

The web Example3 also has two cells, a and b, whose values and formulas are shown below:

Cellname: a
Value: 14
Script: b-7 Example 3

Cellname: b
Value: 21
Script: a+4

When the scripts of these cells are interpreted a first, then b; the execution proceeds as follows:

Cell a is set to the value of cell b, 21, minus 7, giving 14.

Cell b is set to the value of cell a, 14, plus 4, giving 18.

When the scripts are interpreted b first, then a; the execution takes a different path:

Cell b is set to the value of cell a, 14, plus 4, giving 18.

Cell a is set to the value of cell b, 18, minus 7, giving 11.

Since the cell references in each cell a and b were to the current value of the cell, and didn't request recalculation (no argument list empty or otherwise), there is no problem with stack overflow.

It is important when computing values of cells which refer to each other to consider the order in which interpretation takes place. This is always necessary in programming languages, but is less commonly necessary in cellular calculators.


Number or String?

During evaluation of expressions, a cell value may be automatically converted from a number to a string or vice versa, depending upon what operation is applied to it. In a numeric operation, such as:

maize + beans

the operands maize and beans must be numeric, so their values will be forced to numbers if they are not numbers already. In a string operation, such as:

maize cat beans

the operands maize and beans must be strings, so their values are forced to strings if they are not strings already.

In a context where the same operator applies to both numbers and strings, there are special rules to decide which to use. When assigning a value with the set statement:

set maize to <expression>

maize takes the type (string or number) of the expression.  In a comparison:

if(expr1=expr2)

if both expressions are numeric, a numeric comparison is made; otherwise any numeric operand is converted to a string, and a string comparison is used.

There are two convenient methods for converting an expression from one type to another:

number cat ""

concatenate a null string to a number to force it to become a string.

String + 0

add zero to a string to make it a number.

To force a string comparison between two expressions, coerce one to a string:

expr1 cat "" = expr2

To force a numeric comparison between two expressions, coerce both to numbers:

expr1+0 = expr2+0

The numeric value of a string is the value of the longest prefix of the string that looks numeric. Thus when the following strings are converted to numbers:

  "1E5"+0 "All my relations"+0 "1X15.21"+0

The numeric results are:

100000 0 1

The string value of a number is computed by formatting the number in accordance with the numeric type and number of digits in force at the time of the conversion. See the section entitled "Numbers Preferences".

Sample Calculations

Circle

The area of a circle is easily computed in two cells:

cellname      formula
-----------------------------------------------
r             (no formula...put value of radius in value field)
AreaCirc      pi*r*r

The calculation is performed by positioning to the cell r, and entering a value for the radius, and then positioning to the cell AreaCirc, and pressing the Execute button on the toolbar . It is not necessary to include a cell with the value of pi since this value (as well as the value for the base of the natural logarithm e) is built in to the Cellweb program.

Payment

The web called "Payment" allows you to compute the monthly payment necessary to pay off a loan of a given amount, at a prescribed interest rate, in a specified number of payments.

The Payment web uses cells with the following formulas to compute the monthly payment:

cellname          formula
----------------------------------------
apr            (no formula... enter annual periodic interest rate)
home             pymt!
i                apr/12
n              (no formula... enter number of monthly payments)
power            pow(1+i!,n)
prin           (no formula... enter the beginning balance)
pymt             prin*power!*i/(1-power)

 

Use the following procedure to obtain a result from the Payment web:

1) Put the annual periodic interest rate into the value field of the apr cell. Make sure that you use the decimal fraction (such as 0.075 for 7.5%).
2) Put the beginning balance into the value field of the prin cell.
3) Set the value of n to the total number of monthly payments. This is twelve times the number of years that the loan is to run.
4) Position to the pymt cell and press the Execute button.

 Since the home cell has the formula: pymt!, you may also compute a result by positioning to the home cell and clicking the Run toolbar button.

Notice in the cell pymt that the first occurance of power, and the reference to i, are execution references. The '!' after the first power reference assures that the formula for power is executed whenever the formula for pymt is executed. There is no '!' after the second reference to power because it is not needed, the value having already been computed. The '!' after i ensures that the periodic interest is computed from the annual periodic interest rate, apr, whenever pymt is computed.

Pert

One of the sample webs provided on the Cellweb distribution disk is called "Pert". The Pert web describes the tasks involved in building a small house, and organizes those tasks according to which ones may be carried out concurrently. There are three different paths through the web of tasks, from start to completion. The three paths may be browsed in the web by following hypertext links. The are also described in three summary cells called path1, path2, and path3. Those cells contain formulas which compute the total time required to traverse the associated paths.

               

The Pert web uses cells with the following formulas to compute the time taken by the three paths through the construction process:

cellname            formula
--------------------------------------------------------------------
path1           ClearLand+BuildFoundation+BuildUpperStructure+
                PlumbingWork+CompleteInterior
path2           ClearLand+BuildFoundation+BuildUpperStructure+
                ElectricalWork+CompleteInterior
path3          ClearLand+BuildFoundation+BuildUpperStructure+
               CompleteExterior+Landscaping

By entering the estimated time it takes to complete each of these tasks into each task's cell, the times taken for each path through the process may be computed from the formulas.

Pert has another cell and formula:

CriticalPath          max(path1!,path2!,path3!)

When the CriticalPath cell is executed, the time necessary to build the house is placed into its value field.

The '!'s after the references to path1, path2, and path3 ensure that new values for these cells are computed every time the cell CriticalPath is executed. If the '!'s were not there, it would be possible to change the values upon which path1, path2, and path3 depend, and to compute CriticalPath without the new values being reflected in the values of path1, path2, and path3. The value of CriticalPath would not then be changed, even though, for instance, the value of ClearLand did change.

NOTE: The action of this web or any web would be unchanged if the exclamation points, !, were replaced by the empty parenthesis pair, ( ).

Logistic

The emergence of chaotic dynamics from simpler behavior may be observed in this example called the logistic map:

cellname             formula
---------------------------------------------------------
r            (no formula...set this parameter to alter dynamics)
x                   r*x*(1-x) 

To explore the behavior of this calculation, set the number of iterations to 20 or so, set different values for r and x (make sure x is between zero and one), go to cell x, and execute it.

For a value of the parameter r of 0.4, and an initial x value of 0.7, successive values of x approach zero and stay there.

For an r value of 2.4, and initial x value of 0.7, successive values of x approach a constant 0.583

For r=3.0, and an initial x of 0.5, an extended damped oscillation takes place between two values of x.

For r=3.5, initial x=0.7; an extended oscillation among four numbers takes place.

For r=3.8, initial x=0.7; a chaotic sequence of numbers is the result.

 

Amort

This sample web computes the approximate principal balance and amount paid in interest each month, given an annual periodic interest rate, and the principal balance the previous month. The cells in the web, and the formulas they contain are:

cellname           formula
-----------------------------------------------------
apr          (No formula....constant entered by user)
home            month! prin!
itm             mi!*prin
             (monthly interest rate times last months principal)
mi              apr/12 (annual periodic interest rate/12)
month           month+1 (number of the month...start at 0)
prin            if(prin>pymt) {
                    prin+itm!-pymt
                } elseif(prin>0) {
                    0
                } else {
                    exit
                }
pymt         (No formula....constant payment amt entered by user)

The reference to mi in the formula for itm, and the reference to itm in the formula for prin are execution references to make sure that the values of mi and itm are computed before they are used in the first iteration of the calculation.

The formula for the prin cell illustrates the use of the if structure to control the number of iterations actually computed ( no more than necessary to cause the principal to reach zero).

The formula in the home cell illustrates the use of multiple expressions in a single formula. The expressions are evaluated from left to right. Since these are execution references, the cells referred to are recomputed each time home is executed. After each expression is evaluated, the value of home is set to the value of the expression. Thus, when execution is complete, the value of home is found to be the same as the value of prin.

To use this web, put the beginning principal into prin, the annual periodic interest rate, as a decimal fraction, into apr, the monthly payment into pymt, and initialize the month to 0. Set the number of iterations (See Execution Preferences) somewhat larger than you expect the number of required months to be, and execute the home cell. The monthly change in principal will be displayed as the calculation progresses. Negative amounts indicate debt accumulating rather than being paid off.


RKutta

There is a method of iteratively solving second order differential equations, called Runge Kutta, which, to third order accuracy, is described by the following set of equations:

      yn+1 = yn +(a1+4a2+a3)/6

      a1 = h*F(xn,yn)

      a2 = h*F(xn + h/2,yn + a1/2)

      a3 = h*F(xn + h,yn + 2a2-a1)

If we apply this method to the equation for simple harmonic motion:

y'' = -ay

We obtain the following formulas, which we can program into a web, in this case, the web Rkutta:

cell name        formula
-------------------------------------------
h              (no formula...value is set to stepsize)
home           yold! ypold! y! yp!
a              constant parameter chosen by user
yold           y
y              yold+(k1!+4*k2!+k3!)/6
ypold          yp
yp             ypold+(k1p!+4*k2p!+k3p!)/6
k1             h*ypold
k2             h*(ypold+k1p!/2)
k3             h*(ypold+2*k2p!-k1p!)
k1p           -a*h*yold
k2p           -a*h*(yold+k1!/2)
k3p           -a*h*(yold+2*k2!-k1!)

Set initial values for y and yp. To see a computed solution to the differential equation, set a to a positive value, and repeatedly execute the home cell.

This example illustrates the use of multiple expressions within the same formula. The home cell contains a sequence of four execution references to yold, ypold, y, and yp. This causes the current values of y and yp to be placed into yold and ypold, and then new values to be computed based upon those old values.
 

Built In Functions

This section lists each available built-in function, and any information necessary for its use.

min(expr1,expr2,expr3,...)
This function returns the minimum of the values of the expressions denoted by expr1, expr2, expr3, ...etc.

max(expr1,expr2,expr3,...)
This function returns the maximum of the values of the expressions denoted by expr1, expr2, expr3, ...etc.

mean(expr1,expr2,expr3,...)
This function returns the arithmetic mean of the values of the expressions denoted by expr1, expr2, expr3, ...etc.

abs(expr)
This function returns the absolute value of the expression denoted by expr.

sign(expr)
This function returns +1 if the expression expr evaluates to a positive value, -1 if it evaluates to a negative value, and 0 if it evaluates to 0.

stp(expr)
This function returns +1 if the expression expr evaluates to a non-negative value (including 0), and 0 if it evaluates to a negative value.

sig(expr)
This function returns the sigmoid logistic function of its single expression argument:
sig(expr) := 1/(1+exp(-expr))

sin(expr)
This function returns the value of the sine of expr. The value of expr is assumed to be in the trigonometric units chosen in the trigonometric units choice list of the 'Numbers Preferences' dialog reached from the 'Preferences' choice in the Special menu.

cos(expr)
This function returns the value of the cosine of expr. The value of expr is assumed to be in the trigonometric units chosen in the trigonometric units choice list of the 'Numbers Preferences' dialog reached from the 'Preferences' choice in the Special menu.

tan(expr)
This function returns the value of the tangent of expr. The value of expr is assumed to be in the trigonometric units chosen in the trigonometric units choice list of the 'Numbers Preferences' dialog reached from the 'Preferences' choice in the Special menu.

asin(expr)
This function returns the value of the arcsine of expr. The value is returned in the trigonometric units chosen in the trigonometric units choice list of the 'Numbers Preferences' dialog reached from the 'Preferences' choice in the Special menu. An invalid argument will cause the value returned to be flagged "Not A Number".

acos(expr)
This function returns the value of the arccosine of expr. The value is returned in the trigonometric units chosen in the trigonometric units choice list of the 'Numbers Preferences' dialog reached from the 'Preferences' choice in the Special menu. An invalid argument will cause the value returned to be flagged "Not A Number".

atan(expr)
This function returns the value of the arctangent of expr. The value is returned in the trigonometric units chosen in the trigonometric units choice list of the 'Numbers Preferences' dialog reached from the 'Preferences' choice in the Special menu. An invalid argument will cause the value returned to be flagged "Not A Number".

sqrt(expr)
This function returns the non-negative square root of the value of expr.

ln(expr)
This function returns the value of the natural logarithm of expr. An invalid argument will cause the value returned to be flagged "Not A Number".

exp(expr)
This function returns the value of e ( the base of natural logarithms) raised to the power of expr. An invalid argument or overflow will cause the value returned to be flagged "Not A Number".

log(expr)
This function returns the value of the logarithm to the base 10 of expr. An invalid argument will cause the value returned to be flagged "Not A Number".

pow(expr1,expr2)
This function returns the value of the first argument raised to the power of the second.

rand(expr)
This function returns a number in the interval [0,1). To reseed the random number generator, call it with a single argument, which is the seed that you wish to use, for example, rand(1365).

first(expr1,expr2)
This function returns a string containing the first expr2 bytes of the string value of expr1.

last(expr1,expr2)
Returns a string containing the last expr2 bytes of the string value of expr1.

butfirst(expr1,expr2)
Returns a string containing the all but the first expr2 bytes of the string value of expr1.

butlast(expr1,expr2)
Returns a string containing the all but the last expr2 bytes of the string value of expr1.

slen(expr)
Returns the number of characters in the string value of expr.

rref("cellname",expr1,expr2)
Produces the reduced row echelon form of the matrix beginning with the quoted cellname, extending in row-column order for the number of rows and columns specified in expr1 and expr2. Assumes that numbers smaller than 0.5E-d are zero (d is the number of decimal digits specified in the Numbers preferences if the number format is fixed or exponential. d=14 if number format is general.) The cellname supplied must be placed in quotes.

gaussj("cellname1",expr1,"cellname2",expr2)
Solves N linear equations in N unknowns using the method of Gauss-Jordan elimination. Cellname1 is the name of the first cell of the coefficient matrix, in quotes.
expr1 evaluates to the number of rows and columns in the square coefficient matrix.
Cellname2 is the name of the first cell in the right side matrix, in quotes.
expr2 evaluates to the number of columns in the right side matrix.
The cell identified by cellname1 must be followed in the web by(expr1*expr1-1) cells for the coefficient matrix in row/column order.
The cell identified by cellname2 must be followed in the web by (expr1*expr2-1) cells for the right side matrix in row/column order.

lookup(expr,xexpr1,yexpr1[,...,xexprN,yexprN])
In this piecewise linear lookup function, the first expr is the entry value for the lookup operation. The remaining expression pairs define X,Y coordinates of the change points of a piecewise linear function whose Y value at the X-coordinate given by expr is returned.

User Defined Functions

Every script in pSogol is a user defined function. It may be executed from another script by referring to the cell which contains it with an execution reference:

    cellname( arglist ) or cellname!

The arglist is a sequence of expressions separated by commas. The exclamation point may be used if there are no arguments to the call.

Within a script, arguments passed in from the calling script are referred to by designators consisting of the percent sign, %, followed by the argument number (position in the argument list of the call). Thus, %2 represents the value of the second argument in the call to the script.  Thus if the script of cell 'addInverse' is called with arguments '4', and '2':

    addInverse(4,2)

And the script contains a formula which reads:

    1/%1 + 1/%2

The result will be 1/4 +1/2 or 0.75, which will be assigned to the value of addInverse and returned to the caller.


pSogol Script Language

pSogol Data Structures

There are three kinds of data structures in pSogol: cells, system constants, and system variables.

Cells
Cells contain a unique name, a text field, a value, and a script field. Cells are referred to in the script language by their names. Cellnames are 1 to 48 characters beginning with a letter, followed by zero or more letters, digits, or underscore ('_') characters.

System Constants
There are three system constants: pi, e, and deg. pi is always interpreted as the value of the ratio of the circumfrence to the diameter of a circle. e is interpreted as the value of the base of natural logorithms. deg is the number of degrees in a radian.

System Variables
There are eight system variables: eof, rptfmt,rpttype, inname, intype, outname, outtype, numfmt, numdec, and trigunits. eof may be used in expressions. It takes the value 1 of the end of file has been reached on the input stream. Otherwise, eof takes the value 0. eof may not be set by the script. The remaining variables may be set using the set ... to statement, but they may not be used in expressions. intype tells whether input comes from a cell, from the console, or from a file.  outtype tells whether output goes to the console or to a file or to the printer.  inname may be set to the name of a cell or file to be used as input.  outname may be set to the name of a file to be used for output.  numfmt, numdec, and trigunits allow the user to change the number format, number of decimals, and trig units inside a script.

 

pSogol Cell References

References to cells in the pSogol are of two kinds: value references and execution references. Value references consist simply of the cell name. Execution references consist of the name of the cell followed by an exclamation point, '!', or an argument list (possibly empty) enclosed in parentheses.

Value References
When a value reference appears in pSogol, it is interpreted by substituting the value of the cell indicated.

 

Execution References
When an execution reference appears in pSogol, it is interpreted by executing the script of the named cell with any arguments supplied, and then substituting for the reference the (possibly) new value of the cell executed.

Subscripted Cell References
To facilitate array operations and enhance control of subprogram execution, subscripted cell references, both value references and execution references, are allowed by the script interpreter.

A subscripted cell reference consists of a cell name followed by a left bracket, followed by an expression, followed by a right bracket, possibly followed by an exclamation point or argument list. Examples of valid subscripted cell references are shown below:

a[1]
a[1]!
a[1]()
a15[4+3*j]
a21[4*3+x](expr1,expr2)
newCell[a[24]!+5.1]
x[sign(sin(y))]
PanDowdy[newCell[a[24]!+5]!-21]
 

The meaning of a subscripted cell reference is as follows:

Imagine that the cells are arrayed in alphabetical order. If the subscript expression evaluates to the floating point number F, N is the largest integer less than or equal to F, and the cell name is twizzle; then the subscripted reference is presumed to refer to the Nth cell past twizzle in the alphabetical sequence of cells. A reference to a[0] is the same as a reference to a.

Subscripts less than zero or to cells beyond the end of the sequence generate a subscript error.

pSogol Comments

The # character, when it appears in a pSogol script, denotes the beginning of a comment. The comment ends at the next carriage return or line feed.

Sogol Statements

Each Sogol script consists of zero or more statements. If there are no statements in the script when Run is chosen from the Actions menu, then nothing happens.

If the execution of an empty script in cell a takes place as a result of an execution reference from another script ( a! ), the value returned to the other script is the content of the value field of cell a. If there is nothing in the value field either, then the value 0 is returned.

If the script of a cell contains legal statements in the script language, whether executed from the menu, or from another script; the statements of the script are interpreted in order until the script ends, or an exit or brk statement is encountered. When the script ends or is exited, control returns to the calling script (the one which used the execution reference), or to the Sogol top level screen.

The statements of the Sogol language are described and illustrated below. For more detailled information, see the section entitled Script Language Grammar.

Set Statement

The set ... to ... statement consists of the word 'set' followed by a cell name, the optional word 'to', and an expession. The action of the interpreter is to set the value of the named cell to the value arrived at by interpreting the expression. The set statement:

set home to 13 - 5*a

will obtain the value of the cell called a, multiply it by 5, subtract the result from 13, and place the result into the cell called home. A slight variation on the statement:

set home to 13-a!*5

will execute the script in the cell called a, (which may change the value of cell a), obtain the (possibly new) value from cell a, multiply it by 5, subtract the result from 13, and place the result into the cell called home.

There is a variant of the set statement which may be used to change certain configuration choices for Sogol during script execution. In the variant, a so-called configuration word is substitued for the cellname which follows the word set. Configuration words and the parameter changed are listed below:

Configuration word-->Parameter changed

rptfmt-->report format string
rpttype-->report type(formatted, inptrs, outptrs, trail)
numfmt-->numeric format (fixed, expn, general)
numdec-->expr for number of decimal places, or significance of result (0-15)
trigunits-->(degrees,radians)
intype-->(cell, file, keyboard)
inname-->cellname or filename for input
outtype-->(screen, file,printer)
outname-->filename for output

Examples of the set statement variant include:

set rptfmt to "\n\N=\V\n"
set trigunits to radians

if Statement
The if( ){ } statement can take any one of the variants shown below:

if(a!=b) {
   zero or more statements
}

NOTE: (a!=b) does not mean a not equal to b. It means execute the script of cell a. If the result is equal to b, then...)

NOTE:The contents of the parentheses in an if statement must be an expression, conditional or arithmetic.

or

if(a<>b) {
   zero or more statements
} else {
   zero or more statements
}

(This is how you check to see if a is not equal to b.)

or

if(a<10) {
   zero or more statements
} elseif(a<5) {
   zero or more statements
} elseif(a<3) {
   zero or more statements
} elseif(....) {
  .......
} else {
   zero or more statements
}

While Statement

The while( ){ } statement looks like this:

while(expr) {
   zero or more statements
}

If the contents inside the parentheses evaluate to a non-zero value, then the contents inside the curly braces will be repeatedly executed until the expression in parentheses becomes zero.


Do Statement

do {
   zero or more statements
} while ( expr )

Sogol first executes the statements between the curly braces. Then it checks to see if the expression is non-zero. If so, it executes the statements between the braces again, and then checks to see if the expression is non-zero,... , and so on. This statement differs from the while statement in that the statements between the braces are always executed at least once.

For Statement

There are two variants of the for statement:

    for ( cellname=expr to expr step expr ) {
       zero or more statements
    }

 and

    for(cellname=expr to expr) {
       zero or more statements
    }

Sogol executes the statements between the curly braces so long as the value of cellname has not gone past the value of the second expression, whether stepping from an initial value above or below the ending value. For instance, the statement:

    for(x=1 to 3) {
       out("mugga")
    }

executes the out( ) statement three times; whereas the statement:

    for(x=3 to 3) {
       out("mugga")
    }

executes it once.

Also, the statement:

    for(x=3 to 1 step -1) {
       out("scud")
    }

causes the word "scud" to be output 3 times; whereas the statement:

    for(x= 3 to 1) {
       out("scud")
    }

will never output the word "scud", since the step size is presumed to be +1.

In Statement

The format of the in() statement is:

    in("a prompt",x,y,z,...,"\nanother prompt",a,b,....)

The in statement scans its argument list from left to right. Each time it encounters a string, it copies it to the current output. Each time it encounters a cell name, the input statement scans the input stream for a value to place into that cell. If there is nothing else in the input stream, it sets the eof system variable to 1.

Whenever "\n" appears as a string in an input statement, it is output as a newline.


Out Statement

The format of the out( ) statement is:

    out( list of expressions separated by commas )

 Sample output statements:

    out("damned spot!",34,x,"or all the seas with oysters")
    out("\nPounds of butter:",butter)

or

    out(x,y,z)

Whenever "\n" appears in a string in the output statement it is output as a newline.

Report Statement

The format of the report( ) statement is:

    report(x,y,another_cellname,z,w.....)

When executed, the report statement sends to the current output a report on each of the cells in its argument list, in the order encountered, using the current report type and format.

Exit Statement

The exit statement consists simply of the word:

    exit

No matter where the statement is encountered, it causes the immediate terminaiton of script execution, and the issuance of the message:

    EXIT REQUESTED IN CELL xxxxx

Brk Statement

The format of the brk( ) statement is:

    brk( expr )

The brk() statement issues to the output window of the screen the character string:

    <brk: expr>

If script execution was begin with a Run to Brk selection (or Alt-B) accelerator, execution of the script pauses with the call stack in the cell name combo box. While execution is paused the user if free to examine and change the values of any cells in the web, though not any settings or text or script fields. When ready to resume execution, the user may do so by choosing Run from the Actions menu, or Run to Brk. In the former case, the script will then run to completion. In the latter case, it will run until it encounters the next brk( ) statement. Alternatively, the user may choose to select Stop from the Actions menu, in which case, execution will terminate immediately with the message:

Run halted IN CELL xxxxx

Compound Statement

A compound statement consists of a left curly brace followed by zero or more statements followed by a right curly brace:

    {
       if(a){
          out("\nRound the corner off")
       }
       out("\nEat pie for dessert")
    }

Expression Statement (Formula)

An expression statement is an expression, such as shown on each of lines below, which appears where a statement is expected:

1
17
a<b
NOT x!
a+14*sin(221-4)
(((1)))
(a(x,1) AND b)+14

 

NOTE: Whenever the script interpreter encounters an expression when it is looking for a statement, it sets the value of the cell in which it finds the expression to the value returned by the expression. The effect of this feature can catch the uninitiated off guard.  If a cell's value field is being used as a variable, it is not a good idea to allow any expression statements in that cell's script field.  On the other hand, if a cells script field contains expression statements, one should be very careful about the way one uses that cell's value field.

Sogol Grammar

The permissable content of a script field is zero or more statements. Lines beginning with a '#' character are taken to be comment lines. Wherever a '#' character appears in a formula, the remainder of that line is taken to be a comment.

The grammar recognized by the Sogol interpreter is shown in Backus Naur Form below (items in [ ]are optional):

<script> ::= <stmtlist>

<stmtlist> ::= empty
| <stmt> <stmtlist>

<stmt> ::= <compound stmt>
| <set stmt>
| "if" "(" <expr> ")" <compound stmt> <optelse>
| "while" "(" <expr> ")" <compound stmt>
| "do" <compound stmt> "while" "(" <expr> ")"
| "for" "(" <cellname> "=" <expr> "to" <expr>
["step" <expr>] ")" <compound stmt>
| "in" "(" <inlist> ")"
| "out" "(" <outlist> ")"
| "report" "(" <cellist> ")"
| "brk" "(" <expr> ")"
| "exit"
| <expr>

<compound stmt> ::= "{" <stmtlist> "}"

<set stmt>::= "set" <configwd> ["to"] <configval>
| "set" <configwd> ["to"] <string>
| "set" <configwd> ["to"] number
| "set" <cellname> ["to"] <expr>
| "set" <cellname> "[" <expr>"]" ["to"] <expr>

<optelse> ::= empty
| "else" <compound stmt>
| "elseif" "(" <expr> ")" <compound stmt> <optelse>

<inlist> ::= <inspec>
| <inspec> "," <inlist>

<inspec> ::= <string> | <cellname>

<outlist> ::= <expr>
| <expr> "," <outlist>

<cellist> ::= <cellname>
| <cellname> "," <cellist>

<expr> ::= <pexpr>
| <pexpr> <relop> <pexpr>

<relop> ::= "=" | "<" | "<=" | ">=" | "<>"

<pexpr> ::= <term prefix> <termlist>

<term prefix> ::= empty | "+" | "-"

<termlist> ::= <term>
| <term> <termop> <termlist>

<termop> ::= "+" | "-" | "OR" | "CAT"

NOTE: CAT is the string concatenation operator 

<term> ::= <factor>
| <factor> <factop> <term>

<factop> ::= "*" | "/" | "%" | "AND"

<factor> ::= <cellname>
| <cellname> "!"
| <cellname> "(" <arglist> ")"
| <cellname> "[" <expr> "]"
| <cellname> "[" <expr> "]"!
| <cellname> "[" <expr> "]" "(" <arglist> ")"
| a number
| <string>
| "%" integer
| "NOT" <factor>
| "pi"
| "deg"
| "e"
| "eof"
| <builtin>
| "(" <expr> ")"

<builtin> ::= <funcname> "(" <arglist> ")"

<funcname> ::= "min" | "max" | "mean" | "abs" | "sign" |
"stp"| "sig" | "sin" | "cos" | "tan" |
"asin" | "acos" | "atan"| "sqrt" | "ln" |
"exp" | "log" | "pow" | "rand" | "first"|
"last" | "butfirst" | "butlast" | "slen" |
"rref" | "gaussj" | "lookup" 

<arglist> ::= empty
| <expr>
| <expr> "," <expr>
| <expr> "," <expr> "," ... "," <expr>

<configwd> ::= rptfmt | rpttype | intype | inname
| outtype | outname
| numfmt | numdec | trigunits

<configval> ::= formatted | inptrs | outptrs
| trail | fixed | expn
| general | degrees | radians | cell
| file | screen | keyboard
| quoted cell or file name

<string> ::= <quote> zero or more characters <quote>
| <identifier> which is not a <configwd>,
<configval>,"pi","e","deg","eof", a
<funcname>, a cellname, or a reserved word.

<quote> ::= ' | "

NOTE: Ending quote character must be same as beginning one.

<cellname>::= <identifier> that is not a <configwd>,
a <configval>, "pi", "e", "deg", "eof",
a <funcname> or a reserved word.

<identifier> ::= A letter followed by zero or more
letters, digits, or underscores


Menubar

pSogol Menubar


The menubar has four popup menus, called File, Edit, Cell, and Help, and three buttons.  The dialogs and functions invoked are described below:


File Menu

The File menu has New, Open, Save, and SaveAs options.

Edit Menu

In addition to the usual Edit menu entries, this one contains the Settings selection, which brings up the settings property sheet, which has seven tabs: Links, Report, Output, Input, Number, Execute, and Plot. Use of these tabbed dialogs is described above. The edit menu also has the Zoom selection, which allows you to change the size of Font used in the Text, Value, Script, and Console, and panes.  The ErasePlot choice clears the plot pane.

Cell Menu

The Cell menu has selections to create a ‘New’ cell or ‘Clone’ a new cell from an existing one, It allows you to ‘Delete’ the current cell, or Run the script of the current cell until a BRK statement is encountered.

Help Menu

The Help menu provides a short selection of help topics, which when selected, are output to the currently selected Output. It also has an About pSogol selection which gives pSogol copyright and version information, as well as giving information on how to register the program, and providing a registration dialog. The registration dialog and information only apper if the program has not yet been registered.

Report Button

This printed page representation causes the report generator to run, using its current settings.  If the "Report on All Cells" box in report settings is not checked, the report is generated for every cellname in the selected text of the text or script tab, whichever is selected.  If the "Report on All Cells" is selected, the report is generated for all cells.

Run Button

Click on this running figure to execute the script of the selected cell the number of times specified in the execute settings iteration field.

Stop Button

This red circle with an 'X' button stops the execution of the current cell.  It is also cancels console input if pSogol is waiting for that.


Errors and Limits

pSogol Error Conditions

Script Errors

When a script is executed, there are several error messages that can result. These messages are listed below:

Bad Identifier in Cell xxxxx
One of the identifiers in the formula for the cell named xxxx is neither a cell name nor a built-in function.

Illegal Character in Cell xxxxx
There is a character in formula xxxx that is not permitted.

Stack Overflow in Cell xxxxx
The formula in cell xxxx contains a cell reference which is part of a circular chain of cell references, which is not permissable when all the references in the circular chain are execution references.

Missing Paren in Cell xxxx
Self Explanatory.

Missing '{' in Cell xxxxx
An If statement is missang a left curly brace in the script field of cell xxxx.

Missing '}' in Cell xxxxx
An If statement is missang a right curly brace in the script field of cell xxxx.

Subscript Missing ']' in Cell xxxxx
A subscript was not terminated with a right bracket.

Subscript out of range in Cell xxxxx
A subscript was less than zero or greater than the number of cells in the web.

Invalid Expression in Cell xxxxx
Problem with expression syntax.

Expected Format String (in Quotes) in Cell xxxx
Set statement expected calculation or report format string. It got something else.

Invalid Report Type in Cell xxxxx
Set statement expected a report type of Inptrs, Outptrs, Trail or Formatted. It found something else.

Illegal Statement in Cell xxxxx.
Script interpreter was looking for a statement and found something that wasnt.

Bad Set Stmt in Cell xxxxx
A set statement had improper syntax.

Object of Set must be reserved word in Cell xxxxxx
The word set was not followed by either a cellname or a valid configuration word of RptType, RptFmt, NumFmt, NumDec, or TrigUnits.

Number format should be fixed, exp, or general in Cell xxxxx.
A 'set NumFmt' statement should have set the value to fixed, exp, or general.

Bad number of decimal places in Cell xxxxx.
The number of decimal places specified in a 'set NumDec" statement was less than zero or greater than 15 or not numeric.

Trig units type should be degrees or radians in Cell xxxxx
Set statement setting trig units set it to something illegal.

Builtin Function Call Error in Cell xxxxx
There is a problem with a comma or parenthesis in a built-in function reference in the formula field of cell xxxx.

Builtin Function Arg Error in Cell xxxxx
There is a problem with the number or type of arguments to a built-in function in the script field of cell xxxx.

Argument List Error in Cell xxxxx
There is a problem with the argument list of an execution reference to another cell from the cell named.

Expected Argument Number in Cell xxxxx
In the script of the specified cell, a percent sign was not followed by an integer denoting the argument number.

Argument Number Invalid in Cell xxxxx
An argument number following a percent sign is either too big or negative in the script of the cell specified.

Poorly formatted cell list in Cell xxxxx
A report statement had an improperly formatted cell list.

Bad Do stmt syntax in Cell xxxxx
Bad syntax in a do statement.

Bad For statement in Cell xxxxx.
A for statement in the specified cell had an error in some portion of the statement other than the compound statement portion.

Expected '=' in Cell xxxxxx
An error in a for statement.

Expected 'to' in Cell xxxxxxx
An error in a for statement.

Syntax Error in Cell xxxxx
There is an error in the formula field syntax of cell xxxx.

Missing ',' or ')' in out stmt in Cell xxxxx
Self Explanatory.

Expected '(' in Cell xxxxx
A left parenthesis was expected, but not found, in the formula field of cell xxxxx..

Expected ')' in Cell xxxxx
A right parenthesis was expected, but not found, in the formula field of cell xxxx.

Attempted to read past end of file in Cell xxxxxx
Self Explanatory.

Bad in statement in Cell xxxxx.
Error in an in statement.

Script error in Cell xxxxx.
There is an otherwise unclassified error in the script of the specified cell.

Internal Software Error in Cell xxxxx
There is a bug in Cellweb. Please report the circumstances to david clifton at david@codelode.com.

Misuse of Reserved Word in Cell xxxxx
One of the reserved words, (any word in quotes in the grammar), is out of place in cell XXXXX.

Unexpected end of script in cell xxxxx
The script field of cell xxxx ended before a complete expression was parsed.

Bad xcell spec in plot dialog
The first name (before the comma) in the X,Y Cells part of the plot dialog is not a valid cell name for this web.

Bad ycell spec in plot dialog
The second name (after the comma) in the X,Y Cells part of the plot dialog is not a valid cell name for this web.

Invalid Plot Limits
The value of xmin, xmax, ymin, and ymax are such that the difference of the x's or the diffferences of the y's are zero, or so small or large that they cannot be expressed as a floating point number within the arithmetic routines.

pSogol Program Limits

The following limits apply to version 1.2 of pSogol:

  • Maximum Size of a Cell Name: 48
  • Maximum Characters in a Text Field: limited by available memory
  • Maximum Characters in a Value Field: limited by available memory
  • Maximum Characters in a Script Field: limited by available memory
  • Maximum Number of digits in a number: 24
  • Maximum Significant digits in a number: 15
  • Maximum displayable significant digits in a number: 8
  • Maximum Number of Cells: 256


Limited Warranty, License, Registration, Distribution, and Support

Limited Warranty



LIMITED WARRANTY

THE PSOGOL SOFTWARE AND ACCOMPANYING WRITTEN MATERIALS (INCLUDING INSTRUCTIONS FOR USE) ARE PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. FURTHER, NEITHER CODELODE NOR DAVID CLIFTON PROVIDES ANY WARRANT, GUARANTEE, OR MAKES ANY REPRESENTATIONS REGARDING THE USE, OR THE RESULTS OF USE, OF THE SOFTWARE OR WRITTEN MATERIALS IN TERMS OF CORRECTNESS, ACCURACY, RELIABILITY, CURRENTNESS, OR OTHERWISE. THE ENTIRE RISK AS TO THE RESULTS AND PERFORMANCE OF THE SOFTWARE IS ASSUMED BY YOU THE USER. IF THE SOFTWARE OR WRITTEN MATERIALS ARE DEFECTIVE YOU, AND NOT DAVID CLIFTON, CODELODE, OR ITS DEALERS, DISTRIBUTORS, AGENTS, OR EMPLOYEES, ASSUME THE ENTIRE COST OF ALL NECESSARY SERVICING, REPAIR, OR CORRECTION.
THE ABOVE IS THE ONLY WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, THAT IS MADE BY CODELODE OR DAVID CLIFTON, ON THIS PRODUCT. NO ORAL OR WRITTEN INFORMATION OR ADVICE GIVEN BY DAVID CLIFTON, CODELODE, ITS DEALERS, DISTRIBUTORS, AGENTS, OR EMPLOYEES SHALL CREATE A WARRANTY OR IN ANY WAY INCREASE THE SCOPE OF THIS WARRANTY AND YOU MAY NOT RELY ON ANY SUCH INFORMATION OR ADVICE. YOU MAY HAVE OTHER RIGHTS WHICH VARY FROM STATE TO STATE.
NEITHER DAVID CLIFTON, CODELODE, NOR ANYONE ELSE WHO HAS BEEN INVOLVED IN THE CREATION, PRODUCTION, OR DELIVERY OF THIS PRODUCT SHALL BE LIABLE FOR ANY DIRECT, INDIRECT, CONSEQUENTIAL, OR INCIDENTAL DAMAGES (INCLUDING DAMAGES FOR LOSS OF BUSINESS PROFITS, BUSINESS INTERRUPTION, LOSS OF BUSINESS INFORMATION, AND LIKE) ARISING OUT OF THE USE OR INABILITY TO USE SUCH PRODUCT EVEN IF CODELODE OR DAVID CLIFTON HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
THIS LIMITED WARRANTY SHALL BE GOVERNED AND CONSTRUED IN ACCORDANCE WITH THE LAWS OF THE STATE OF COLORADO.

ACKNOWLEDGEMENT

BY USING THE DEMO OR REGISTERED VERSION OF PSOGOL, YOU ACKNOWLEDGE THAT YOU HAVE READ THIS LIMITED WARRANTY, UNDERSTAND IT, AND AGREE TO BE BOUND BY ITS TERMS AND CONDITIONS. YOU ALSO AGREE THAT THE LIMITED WARRANTY IS THE COMPLETE AND EXCLUSIVE STATEMENT OF AGREEMENT BETWEEN THE PARTIES AND SUPERSEDES ALL PROPOSALS OR PRIOR AGREEMENTS, ORAL OR WRITTEN, AND ANY OTHER COMMUNICATIONS BETWEEN THE PARTIES RELATING TO THE SUBJECT MATTER OF THE LIMITED WARRANTY.

License

After you have registered pSogol, you may use the program for as long as you like, and make as many backup copies as necessary on the computer for which it is registered.  If you change operating systems, mother boards, or root disk drives after registering, that will likely necessitate re-registering the program.  As long as there is a record of your previous registration, you can obtain a new registration key simply by requesting one from registration@codelode.com.  Each registered user will be limited to no more than three free reregistrations during the course of a single year.

You may use pSogol without registering it, provided that you do not attempt to enable printing, which has been disabled as an incentive to register the program, and you do not attempt to disable Nagging, which as been provided as an incentive to register the program.

Any attempt to enable printing or disable nagging in the unregistered program voids your right to use the program or even to keep it on your computer.

Registration

Registration t