|
Complex Library / General Info |
|
Omikron Basic on the Internet: http://www.berkhan.com |
|
|
1.1 System Requirements 1.2 Installation 1.3 Copyright 1.4 Hotline, Reporting Errors/Bugs and Suggestions 1.5 Information about Using the Library
Complex numbers are indispensable aids in many areas of science and technology to formulate complex tasks elegantly and to perform calculations quickly and easily. The Complex Library now offers you the option to utilize the advantages of calculating with complex numbers using Omikron Basic. The Complex Library offers predefined procedures and functions, which perform input, output, and the calculation of complex operations. In addition to the basic functions and analytical standard functions, the Complex Library also performs null calculations of complex polynomials (differential equations with constant coefficients), as well as many levels of linear complex sets of equations. Such diverse functions as used for the handling of matrices of complex numbers and complex polynomials complete the Library. All functions of the Complex Library calculate with double precision. Strings are used to save the complex numbers (REAL and IMAG). It is thus possible to allocate the numbers directly and check them for equality using "=". The Complex Library has been created and developed from real life applications and needs and thus already contains a fair number of functions. Of course, we all know that there always will be a few unfulfilled wishes and if there is a function you would like to see added to the Complex Library, please contact us. We might be able to consider your suggestion when writing the next version. |
| 1.1 System Requirements The Library does not require any special system settings from your computer. Of course, you do need Omikron Basic 6 and an Apple computer with PowerPC processor in order to be able to use the Library. |
| 1.2 Installation In order to be able to use the Complex Library in your programs, you have to load the Library with the menu option 'Load LIBRARY ...' to be found in the 'Edit' menu of the Omikron Basic editor and add it to your program. The Complex Library is saved in a specially encoded process (token code), which enables Omikron Basic to load the Library in an especially speedy manner. The Library will be automatically appended to the end of your program and is there visible as follows: |
| In order to be able to use the Complex Library in your programs, you have to load the Library with
the menu option 'Load LIBRARY ...' to be found in the 'Edit' menu of the Omikron Basic editor and add it to your
program. The Complex Library is saved in a specially encoded process (token code), which enables Omikron Basic
to load the Library in an especially speedy manner. The Library will be automatically appended to the end of your program and is there visible as follows: |
| LIBRARY CODE Complex 'Version X.YZ, TT.MM.JJJJ |
| The line containing the LIBRARY CODE cannot be modified. At most, it is possible to delete the line
([Alt] + [Delete]). This will remove the Library from your program once again. After removal, you should also click
on 'Program/Clean Sweep' in the editor to remove the now superfluous Complex Library variables from the table.
When writing new programs, it is best to load the Library first and then to write the accompanying program. This allows for immediate testing of the program. |
| 1.3 Copyright The Complex Library may be copied for your own use. You may transfer it to your hard drive or store it in each of your data disk. However, you have to make sure that neither copies nor originals falls into the hands of third parties; after all, you are responsible for any bootleg copies that might be created. If you would like to pass on programs, which require the Complex Library, you have to take care to protect the Library against misuse by third parties. It is best to pass on only compiled programs, since it is not possible to reconstruct neither the source code of your program nor the Library from a compiled program. |
|
1.4 Hotline, Reporting Errors/Bugs and Suggestions
|
| 1.5 Information about Using the Library - Before you use any of the functions of the Complex Library, you have to initialize the Library by calling the procedure Cinit. This procedure sets a few standard constants, which are global and may also be used in your programs. Please make sure that you do not modify these variables or use them for other purposes in your program. This concerns the following constants: |
| C_Z$ | Complex zero |
| C_R$ | Real unit |
| C_M_R$ | Negative real unit |
| C_I$ | IMG unit |
| C_M_I$ | Negative IMG unit |
| Pi2# | PI*2 |
- Strings are used in the Complex Library to depict complex numbers. At first glance, this might seem unusual, but it offers the advantage that a complex number can be depicted through a single variable. This is especially useful in the case of matrices, where it offers a much increased and easier overview. In addition, this makes it easier to check the numbers for equality and to assign them. The depiction is as a string 16 characters in length; the first 8 characters are the MKD$ of the REAL, the subsequent 8 characters are the MKD$ of the IMAG. You thus may generate any complex number yourself using |
| Z$=MKD$(REAL#)+MKD$(IMAG#). However, our advice is to use the assigned function from the Library, which will render your program resistant against any possible later changes of the number format. - String variables, which have not been used yet, are empty. An empty string does not represent an complex zero! You have to replace the non-initialized variables with C$=C_Z$ and thus set them to zero before you use them for any calculations. This is important especially when using complex polynomials and matrices; otherwise, false results or error messages might be generated. - When data fields are being passed to procedures or functions, you have to indicate the address of the desired field by applying the address operator to the field, e.g., &Array(,) or VARPTR(Array(0,0)). |
| - The first and last index with a colon between is used to indicate if only a part of the field
is to be considered. For example: X#(1:5,2) means
that all data of the field X# is to be considered
with a setting of the first index between 1 and 5 and the second index as 2. Of course, this is not a valid way
to write in BASIC but rather serves to illustrate the description in the manual. - The manual shows an "R" preceding some parameters when describing procedures. This is to indicate that the Complex Library procedure will return a value. At that point you then have to indicate a variable and not a numerical expression. Of course, when calling the procedure, you have to omit the "R". - Parts shown in square brackets are optional and may also be omitted. - If variables or functions do not have a postfix, then it is a long integer type. - Functions and procedures of the Complex Library are written in Courier bold. - You have to set a few additional COMPILER control words at the beginning of your program as indicated in the programs included in the DEMO folder, if you would like to try out the sample programs. In order to run the sample programs from this manual, you best proceed as follows: Load one of the sample programs from the DEMO folder in the Omikron Basic editor. Delete all of the program code with the exception of the COMPILER control words and the line containing the Library. Then copy the sample code and paste it to the BASIC program between the COMPILER control words and the line with the LIBRARY CODE. Now you are ready to try out the program using 'Compile & Run'. |
|
|
|
Omikron Basic on the Internet: http://www.berkhan.com |