System FunctionsYou can use system functions and system variables to change general program settings and output behavior, and to manage the variables and functions in memory.
System variablesThe System variables in SpeQ can be changed from within the Workarea or in the Settings window. In the Workarea you can just enter the following to change for example the Angles setting.
To check the current setting of a System variable, you can enter
Angles = Deg Angles mode set to Degrees
SpeQ has the following system variables, which can be found in the Functionstree under the header System, Variables.
Angles Angles = Deg
When you've set the scientific notation Off, you can come across the problem of precision loss. The computer does calculate with a finite precision of about 16 digits. When the scientific notation is Off and you get a result that is larger than 10^16 the answer will end with # characters, which means that the exact value of these digits is unknown. See the examples below for a demonstration.
System functionsThere are two functions for cleaning up memory: Clear and ClearAll. With these functions you can remove earlier defined variables and functions from memory. You can read how to define functions and variables on the pages Defining Variables and Defining Functions
'Examples of changing the Angles mode 'Change the angles mode. A circle contains 2*Pi radians, 'so 0.25*Pi is a quarter of a circle. Angles = Rad Angles mode set to Radians Sin(0.25 * Pi) Ans = 0.707106781 Cos(0.25 * Pi) Ans = 0.707106781 'This is equal to the Sine at 45 degrees. Angles = Deg Angles mode set to Degrees Sin(45) Ans = 0.707106781
'Examples of using the system variable Decimals Decimals = Float Decimals set to Float Pi Ans = 3.141592654 Decimals = 3 Decimals set to 3 Pi Ans = 3.142 2/4 Ans = 0.500 'Get the current setting of Decimals Decimals Decimals = 3
'Examples of using Representation ' Set the default representation to hexadecimal Representation = Hex Representation set to Hex 15 + 12 Ans = 0x1B ' Set the default representation to fraction Representation = Fraction Representation set to Fraction 0.125 Ans = 1/8 ' Set the default representation back to decimal Representation = Dec Representation set to Dec 15 + 12 Ans = 27
'Examples of using Scientific Notation SciNotation = Auto SciNotation set to Auto 2000+300 Ans = 2300 SciNotation = On SciNotation set On 2000+300 Ans = 2.3e2 3/1000 Ans = 2.727e-3
'Examples of using the system functions Clear and ClearAll 'Create a few variables. '(Press F9 to show or hide the Memorylist) var1 = 2.25 var1 = 2.25 var2 = 4* (2 + Sqrt(var1)) var2 = 14 Clear(var1) Variable var1 is deleted 2 * var1 Error: Unknown variable var1 ClearAll Memory cleared
'Examples of using the system function Run 'Run the provided example "geometric forms.spq" 'this file creates functions to calculate the circumreference, 'surface, and volume of various geometric forms Run(examples\geometric forms.spq) Done 'now you can use the functions created in the file 'calculate the area and circumreference of a circle with radius of 15 cm radius = 15 cm; C_circle(radius) Ans = 94.247779608 cm A_circle(radius) Ans = 706.858347058 cm²
' Demonstration of precision loss SciNotation = Auto; 111111111 * 111111111 Ans = 1.234567899e16 SciNotation = Off; 111111111 * 111111111 Ans = 123456789876543## SciNotation = Auto;
See AlsoDefining Functions, Defining Variables, Memorylist, Settingswindow, Statusbar