APTECH GAUSS 8 Language Reference

  • Hello! I am an AI chatbot trained to assist you with the APTECH GAUSS 8 Language Reference. I’ve already reviewed the document and can help you find the information you need or explain it in simple terms. Just ask your questions, and providing more details will help me assist you more effectively!
GAUSSTM
Language Reference
Aptech Systems, Inc. Mathematical and Statistical System
Information in this document is subject to change without notice and does not represent
a commitment on the part of Aptech Systems, Inc. The software described in this
document is furnished under a license agreement or nondisclosure agreement. The
software may be used or copied only in accordance with the terms of the agreement.
The purchaser may make one copy of the software for backup purposes. No part of
this manual may be reproduced or transmitted in any form or by any means, electronic
or mechanical, including photocopying and recording, for any purpose other than the
purchaser’s personal use without the written permission of Aptech Systems, Inc.
c
Copyright Aptech Systems, Inc. Maple Valley WA 1984-2006
All Rights Reserved.
GAUSS,GAUSS Engine and GAUSS Light are trademarks of Aptech Systems, Inc.
GEM is a trademark of Digital Research, Inc.
Lotus is a trademark of Lotus Development Corp.
HP LaserJet and HP-GL are trademarks of Hewlett-Packard Corp.
PostScript is a trademark of Adobe Systems Inc.
IBM is a trademark of International Business Machines Corporation
Hercules is a trademark of Hercules Computer Technology, Inc.
GraphiC is a trademark of Scientific Endeavors Corporation
Tektronix is a trademark of Tektronix, Inc.
Windows is a registered trademark of Microsoft Corporation.
Other trademarks are the property of their respective owners.
Part Numbers: 005500, 005501
Version 8.0
Documentation Revision: 860 June 27, 2007
Contents
Contents
1 Introduction
1.1 Product Overview ................................. 1-1
1.2 Documentation Conventions ........................... 1-2
2 Getting Started
2.1 Installation Under UNIX/Linux ........................... 2-1
2.2 Installation Under Windows ............................ 2-2
2.2.1 Machine Requirements ......................... 2-2
2.2.2 Installation from Download ....................... 2-2
2.2.3 Installation from CD ........................... 2-3
3 Using the Command Line Interface
3.1 Viewing Graphics ................................. 3-2
3.2 Interactive Commands ............................... 3-2
3.2.1 quit .................................... 3-2
3.2.2 ed ..................................... 3-3
3.2.3 browse .................................. 3-3
3.2.4 config ................................... 3-3
3.3 Debugging ..................................... 3-4
3.3.1 General Functions ............................ 3-5
3.3.2 Listing Functions ............................. 3-5
3.3.3 Execution Functions ........................... 3-5
3.3.4 View Commands ............................. 3-6
3.3.5 Breakpoint Commands ......................... 3-7
4 Introduction to the Windows Interface
4.1 GAUSS Menus ................................... 4-1
4.1.1 File Menu ................................ 4-1
iii
GAUSS Language Reference
4.1.2 Edit Menu ................................ 4-4
4.1.3 View Menu ................................ 4-5
4.1.4 Configure Menu ............................. 4-6
4.1.5 Run Menu ................................ 4-6
4.1.6 Debug Menu ............................... 4-7
4.1.7 Tools Menu ................................ 4-8
4.1.8 Window Menu .............................. 4-9
4.1.9 Help Menu ................................ 4-10
4.1.10 GAUSS Toolbars ............................. 4-10
4.1.11 Main Toolbar ............................... 4-11
4.1.12 Working Directory Toolbar ........................ 4-12
4.1.13 Debug Toolbar .............................. 4-13
4.1.14 Window Toolbar ............................. 4-14
4.1.15 Status Bar ................................ 4-15
4.1.16 GAUSS Status .............................. 4-15
5 Using the Windows Interface
5.1 Using the GAUSS Edit Windows ......................... 5-1
5.1.1 Editing Programs ............................ 5-2
5.1.2 Using Bookmarks ............................ 5-2
5.1.3 Changing the Editor Properties ..................... 5-2
5.1.4 Using Keystroke Macros ......................... 5-2
5.1.5 Using Margin Functions ......................... 5-3
5.1.6 Editing with Split Views ......................... 5-3
5.1.7 Finding and Replacing Text ....................... 5-3
5.1.8 Running Selected Text .......................... 5-4
5.2 Using The Command Input - Output Window ................... 5-4
5.2.1 Running Commands ........................... 5-4
5.2.2 Running Programs in Files ....................... 5-5
5.3 Using Source View ................................. 5-5
5.3.1 Source Tab ................................ 5-6
5.3.2 Symbols Tab ............................... 5-6
iv
Contents
5.4 Using the Error Output Window .......................... 5-7
5.5 Using The Debugger ................................ 5-7
5.5.1 Starting and Stopping the Debugger .................. 5-7
5.5.2 Using Breakpoints ............................ 5-8
5.5.3 Setting and Clearing Breakpoints .................... 5-8
5.5.4 Stepping Through a Program ...................... 5-9
5.5.5 Viewing and Editing Variables ...................... 5-9
5.6 Customizing GAUSS ............................... 5-10
5.6.1 Preferences Dialog Box ......................... 5-10
5.6.2 Editor Properties ............................. 5-14
5.7 Using GAUSS Keyboard Assignments ...................... 5-15
5.7.1 Cursor Movement Keys ......................... 5-15
5.7.2 Edit Keys ................................. 5-16
5.7.3 Text Selection Keys ........................... 5-17
5.7.4 Command Keys ............................. 5-17
5.7.5 Function Keys .............................. 5-18
5.7.6 Menu Keys ................................ 5-19
6 Matrix Editor
6.1 Using the Matrix Editor .............................. 6-1
6.1.1 Editing Matrices ............................. 6-1
6.1.2 Viewing Variables ............................ 6-3
6.1.3 Matrix Editor Menu Bar ......................... 6-3
7 Library Tool
7.1 Using the Library Tool ............................... 7-1
7.1.1 Managing Libraries ........................... 7-1
7.1.2 Managing the Library Index ....................... 7-1
7.1.3 Managing Library Files ......................... 7-3
v
GAUSS Language Reference
8 GAUSS Source Browser
8.1 Using the Source Browser in TGAUSS ...................... 8-1
8.2 Using the Source Browser in GAUSS ....................... 8-2
8.2.1 Opening Files From the Source Browser ................ 8-4
8.2.2 Source Browser Keyboard Controls ................... 8-4
9 GAUSS Help
9.1 Help Menu ..................................... 9-1
9.2 Context-Sensitive Help .............................. 9-1
9.3 SHIFT+F1 Support ................................. 9-2
9.4 CTRL+F1 Support ................................. 9-2
9.5 ToolTips ...................................... 9-3
9.6 Other Help ..................................... 9-3
10 Language Fundamentals
10.1 Expressions .................................... 10-1
10.2 Statements ..................................... 10-2
10.2.1 Executable Statements ......................... 10-3
10.2.2 Nonexecutable Statements ....................... 10-3
10.3 Programs ...................................... 10-4
10.3.1 Main Section ............................... 10-4
10.3.2 Secondary Sections ........................... 10-5
10.4 Compiler Directives ................................ 10-5
10.5 Procedures ..................................... 10-8
10.6 Data Types ..................................... 10-9
10.6.1 Constants ................................ 10-9
10.6.2 Matrices ................................. 10-11
10.6.3 Sparse Matrices ............................. 10-18
10.6.4 N-dimensional Arrays .......................... 10-19
10.6.5 Strings .................................. 10-20
10.6.6 String Arrays ............................... 10-24
vi
Contents
10.6.7 Character Matrices ........................... 10-26
10.6.8 Date and Time Formats ......................... 10-27
10.6.9 Special Data Types ........................... 10-28
10.7 Operator Precedence ............................... 10-30
10.8 Flow Control .................................... 10-32
10.8.1 Looping ................................. 10-32
10.8.2 Conditional Branching .......................... 10-35
10.8.3 Unconditional Branching ........................ 10-36
10.9 Functions ...................................... 10-37
10.10 Rules of Syntax .................................. 10-38
10.10.1 Statements ................................ 10-38
10.10.2 Case ................................... 10-38
10.10.3 Comments ................................ 10-38
10.10.4 Extraneous Spaces ........................... 10-39
10.10.5 Symbol Names ............................. 10-39
10.10.6 Labels .................................. 10-39
10.10.7 Assignment Statements ......................... 10-40
10.10.8 Function Arguments ........................... 10-40
10.10.9 Indexing Matrices ............................ 10-41
10.10.10 Arrays of Matrices and Strings ..................... 10-42
10.10.11 Arrays of Procedures .......................... 10-43
11 Operators
11.1 Element-by-Element Operators .......................... 11-1
11.2 Matrix Operators .................................. 11-4
11.2.1 Numeric Operators ........................... 11-4
11.2.2 Other Matrix Operators ......................... 11-8
11.3 Relational Operators ................................ 11-9
11.4 Logical Operators ................................. 11-13
11.5 Other Operators .................................. 11-16
11.6 Using Dot Operators with Constants ....................... 11-21
11.7 Operator Precedence ............................... 11-22
vii
GAUSS Language Reference
12 Procedures and Keywords
12.1 Defining a Procedure ............................... 12-2
12.1.1 Procedure Declaration .......................... 12-3
12.1.2 Local Variable Declarations ....................... 12-3
12.1.3 Body of Procedure ............................ 12-4
12.1.4 Returning from the Procedure ...................... 12-5
12.1.5 End of Procedure Definition ....................... 12-5
12.2 Calling a Procedure ................................ 12-6
12.3 Keywords ...................................... 12-7
12.3.1 Defining a Keyword ........................... 12-7
12.3.2 Calling a Keyword ............................ 12-8
12.4 Passing Procedures to Procedures ........................ 12-9
12.5 Indexing Procedures ................................ 12-10
12.6 Multiple Returns from Procedures ........................ 12-11
12.7 Saving Compiled Procedures ........................... 12-13
13 Sparse Matrices
13.1 Defining Sparse Matrices ............................. 13-1
13.2 Creating and Using Sparse Matrices ....................... 13-2
13.3 Sparse Support in Matrix Functions and Operators ............... 13-3
13.3.1 Return Types for Dyadic Operators ................... 13-4
14 N-Dimensional Arrays
14.1 Bracketed Indexing ................................ 14-3
14.2 E×E Conformability ................................ 14-5
14.3 Glossary of Terms ................................. 14-5
15 Working with Arrays
15.1 Initializing Arrays .................................. 15-1
15.1.1 areshape ................................. 15-2
viii
Contents
15.1.2 aconcat .................................. 15-4
15.1.3 aeye ................................... 15-6
15.1.4 arrayinit .................................. 15-6
15.1.5 arrayalloc ................................. 15-7
15.2 Assigning to Arrays ................................ 15-8
15.2.1 index operator .............................. 15-9
15.2.2 getArray ................................. 15-12
15.2.3 getMatrix ................................. 15-13
15.2.4 getMatrix4D ............................... 15-13
15.2.5 getScalar3D, getScalar4D ........................ 15-14
15.2.6 putArray ................................. 15-15
15.2.7 setArray ................................. 15-16
15.3 Looping with Arrays ................................ 15-17
15.3.1 loopnextindex .............................. 15-19
15.4 Miscellaneous Array Functions .......................... 15-21
15.4.1 atranspose ................................ 15-21
15.4.2 amult ................................... 15-23
15.4.3 amean, amin, amax ........................... 15-25
15.4.4 getDims ................................. 15-27
15.4.5 getOrders ................................ 15-27
15.4.6 arraytomat ................................ 15-28
15.4.7 mattoarray ................................ 15-28
15.5 Using Arrays with GAUSS functions ....................... 15-28
15.6 A Panel Data Model ................................ 15-32
15.7 Appendix ...................................... 15-35
16 Structures
16.1 Basic Structures .................................. 16-1
16.1.1 Structure Definition ........................... 16-1
16.1.2 Declaring an Instance .......................... 16-2
16.1.3 Initializing an Instance .......................... 16-3
16.1.4 Arrays of Structures ........................... 16-4
ix
GAUSS Language Reference
16.1.5 Structure Indexing ............................ 16-5
16.1.6 Saving an Instance to the Disk ..................... 16-8
16.1.7 Loading an Instance from the Disk ................... 16-9
16.1.8 Passing Structures to Procedures ................... 16-9
16.2 Structure Pointers ................................. 16-10
16.2.1 Creating and Assigning Structure Pointers . . . . . . . . . . . . . . . 16-10
16.2.2 Structure Pointer References ...................... 16-11
16.2.3 Using Structure Pointers in Procedures ................ 16-13
16.3 Special Structures ................................. 16-15
16.3.1 The DS Structure ............................ 16-15
16.3.2 The PV Structure ............................ 16-16
16.3.3 Miscellaneous PV Procedures ..................... 16-20
16.3.4 Control Structures ............................ 16-22
16.4 sqpSolvemt ..................................... 16-23
16.4.1 Input Arguments ............................. 16-24
16.4.2 Output Argument ............................ 16-27
16.4.3 Example ................................. 16-29
16.4.4 The Command File ........................... 16-30
17 Run-Time Library Structures
17.1 The PV Parameter Structure ........................... 17-1
17.2 Fast Pack Functions ................................ 17-6
17.3 The DS Data Structure .............................. 17-7
18 Libraries
18.1 Autoloader ..................................... 18-1
18.1.1 Forward References ........................... 18-2
18.1.2 The Autoloader Search Path ...................... 18-3
18.2 Global Declaration Files .............................. 18-9
18.3 Troubleshooting .................................. 18-12
18.3.1 Using .dec Files ............................. 18-13
x
Contents
19 Compiler
19.1 Compiling Programs ................................ 19-2
19.1.1 Compiling a File ............................. 19-2
19.2 Saving the Current Workspace .......................... 19-2
19.3 Debugging ..................................... 19-3
20 File I/O
20.1 ASCII Files ..................................... 20-3
20.1.1 Matrix Data ................................ 20-3
20.1.2 General File I/O ............................. 20-6
20.2 Data Sets ...................................... 20-7
20.2.1 Layout .................................. 20-7
20.2.2 Creating Data Sets ........................... 20-8
20.2.3 Reading and Writing ........................... 20-8
20.2.4 Distinguishing Character and Numeric Data . . . . . . . . . . . . . . 20-9
20.3 GAUSS Data Archives ............................... 20-11
20.3.1 Creating and Writing Variables to GDA’s ................ 20-11
20.3.2 Reading Variables from GDA’s ..................... 20-12
20.3.3 Updating Variables in GDA’s ...................... 20-13
20.4 Matrix Files ..................................... 20-13
20.5 File Formats .................................... 20-14
20.5.1 Small Matrix v89 (Obsolete) ....................... 20-15
20.5.2 Extended Matrix v89 (Obsolete) .................... 20-16
20.5.3 Small String v89 (Obsolete) ....................... 20-16
20.5.4 Extended String v89 (Obsolete) ..................... 20-17
20.5.5 Small Data Set v89 (Obsolete) ..................... 20-17
20.5.6 Extended Data Set v89 (Obsolete) ................... 20-19
20.5.7 Matrix v92 (Obsolete) .......................... 20-20
20.5.8 String v92 (Obsolete) .......................... 20-20
20.5.9 Data Set v92 (Obsolete) ......................... 20-21
20.5.10 Matrix v96 ................................ 20-22
xi
GAUSS Language Reference
20.5.11 Data Set v96 ............................... 20-23
20.5.12 GAUSS Data Archive .......................... 20-24
21 Foreign Language Interface
21.1 Writing FLI Functions ............................... 21-2
21.2 Creating Dynamic Libraries ............................ 21-3
22 Data Transformations
22.1 Data Loop Statements ............................... 22-2
22.2 Using Other Statements .............................. 22-3
22.3 Debugging Data Loops .............................. 22-3
22.3.1 Translation Phase ............................ 22-3
22.3.2 Compilation Phase ........................... 22-3
22.3.3 Execution Phase ............................. 22-4
22.4 Reserved Variables ................................ 22-4
23 The GAUSS Profiler
23.1 Using the GAUSS Profiler ............................. 23-1
23.1.1 Collection ................................ 23-1
23.1.2 Analysis ................................. 23-2
24 Publication Quality Graphics
24.1 General Design .................................. 24-1
24.2 Using Publication Quality Graphics ....................... 24-2
24.2.1 Getting Started .............................. 24-2
24.2.2 Graphics Coordinate System ...................... 24-6
24.3 Graphic Panels ................................... 24-7
24.3.1 Tiled Graphic Panels .......................... 24-7
24.3.2 Overlapping Graphic Panels ...................... 24-7
24.3.3 Nontransparent Graphic Panels ..................... 24-8
xii
Contents
24.3.4 Transparent Graphic Panels ....................... 24-8
24.3.5 Using Graphic Panel Functions ..................... 24-8
24.3.6 Inch Units in Graphic Panels ...................... 24-10
24.3.7 Saving Graphic Panel Configurations .................. 24-10
24.4 Graphics Text Elements .............................. 24-10
24.4.1 Selecting Fonts ............................. 24-11
24.4.2 Greek and Mathematical Symbols ................... 24-12
24.5 Colors ....................................... 24-14
24.6 Global Control Variables .............................. 24-14
25 Time and Date
25.1 Time and Date Formats .............................. 25-2
25.2 Time and Date Functions ............................. 25-4
25.2.1 Timed Iterations ............................. 25-6
26 ATOG
26.1 Command Summary ................................ 26-1
26.2 Commands ..................................... 26-3
26.3 Examples ...................................... 26-12
26.4 Error Messages .................................. 26-15
27 Error Messages
28 Maximizing Performance
28.1 Library System ................................... 28-1
28.2 Loops ........................................ 28-2
28.3 Memory Usage ................................... 28-3
28.3.1 Hard Disk Maintenance ......................... 28-4
28.3.2 CPU Cache ............................... 28-4
xiii
GAUSS Language Reference
A Fonts
A.1 Simplex ....................................... A-2
A.2 Simgrma ...................................... A-3
A.3 Microb ....................................... A-4
A.4 Complex ...................................... A-5
B Reserved Words Appendix
C Singularity Tolerance Appendix
C.1 Reading and Setting the Tolerance ........................ C-2
C.2 Determining Singularity .............................. C-2
29 Command Reference Introduction
29.1 Documentation Conventions ........................... 29-2
29.2 Command Components .............................. 29-3
29.3 Using This Manual ................................. 29-4
29.4 Global Control Variables .............................. 29-5
29.4.1 Changing the Default Values ...................... 29-5
29.4.2 The Procedure gausset ......................... 29-6
30 Commands by Category
30.1 Mathematical Functions .............................. 30-1
30.2 Finance Functions ................................. 30-20
30.3 Matrix Manipulation ................................ 30-22
30.4 Sparse Matrix Handling .............................. 30-26
30.5 N-Dimensional Array Handling .......................... 30-27
30.6 Structures ..................................... 30-29
30.7 Data Handling (I/0) ................................. 30-30
30.8 Compiler Control .................................. 30-39
30.9 Program Control .................................. 30-40
xiv
Contents
30.10 OS Functions and File Management ....................... 30-45
30.11 Workspace Management ............................. 30-46
30.12 Error Handling and Debugging .......................... 30-47
30.13 String Handling ................................... 30-47
30.14 Time and Date Functions ............................. 30-50
30.15 Console I/O .................................... 30-52
30.16 Output Functions .................................. 30-52
30.17 Graphics ...................................... 30-54
31 Command Reference
D Obsolete Commands
E Colors
Index
xv
List of Figures
List of Figures
4.1 GAUSS Graphical User Interface ........................ 4-2
4.2 Main Toolbar ................................... 4-11
4.3 Working Directory Toolbar ........................... 4-12
4.4 Debug Toolbar .................................. 4-13
4.5 Window Toolbar ................................. 4-14
4.6 Status Bar .................................... 4-15
6.1 Matrix Editor ................................... 6-2
7.1 Library Tool ................................... 7-2
8.1 Source Browser ................................. 8-3
16.1 Structure tree for e1 ............................... 16-7
xvii
Introduction
Command Reference
Introduction 29
The GAUSS L R describes each of the commands, procedures and functions
available in the GAUSSTM programming language. These functions can be divided into four
categories:
Mathematical, statistical and scientific functions.
Data handling routines, including data matrix manipulation and description routines, and file
I/O.
Programming statements, including branching, looping, display features, error checking,
and shell commands.
Graphics functions.
The first category contains those functions to be expected in a high level mathematical language:
trigonometric functions and other transcendental functions, distribution functions, random number
generators, numerical dierentiation and integration routines, Fourier transforms, Bessel functions
and polynomial evaluation routines. And, as a matrix programming language, GAUSS includes a
variety of routines that perform standard matrix operations. Among these are routines to calculate
29-1
GAUSS Language Reference
determinants, matrix inverses, decompositions, eigenvalues and eigenvectors, and condition
numbers.
Data handling routines include functions which return dimensions of matrices, and information
about elements of data matrices, including functions to locate values lying in specific ranges or
with certain values. Also under data handling routines fall all those functions that create, save,
open and read from and write to GAUSS data sets and GAUSS Data Archives. A variety of
sorting routines which will operate on both numeric and character data are also available.
Programming statements are all of the commands that make it possible to write complex programs
in GAUSS. These include conditional and unconditional branching, looping, file I/O, error
handling, and system-related commands to execute OS shells and access directory and
environment information.
The graphics functions of GAUSS Publication Quality Graphics (PQG) are a set of routines
built on the graphics functions in GraphiC by Scientific Endeavors Corporation. GAUSS PQG
consists of a set of main graphing procedures and several additional procedures and global
variables for customizing the output.
29.1 Documentation Conventions
The following table describes how text formatting is used to identify GAUSS programming
elements.
Text Style Use Example
regular text narrative “... text formatting is used ...
bold text emphasis “...not supported under UNIX.
italic text variables “... If vnames is a string or has
fewer elements than xhas
columns, it will be ...
29-2
/