|
abs - return absolute value
|
Syntax:
|
float abs(float x)
|
|
Description:
|
Returns the absolute value of each member of x
|
|
Examples:
|
x
|
abs(x)
|
|
-3
0
(-1,1)
|
3
0
(1,1)
|
|
See also:
|
int,
nint
|
accum - return accumulation of array
|
Syntax:
|
float accum(float x)
|
|
Description:
|
Returns the accumulation of values in x.
|
|
Examples:
|
x
|
accum(x)
|
|
1
0
0
1
0
2
|
1
1
1
2
2
4
|
|
Code sample 1:
|
dates = dateformat1("1/1/2000"//"3/1/2000"//"4/1/2000"//"10/1/200");
transaction_amounts = 100.00 // -32.34 // -11.75 // 50.00;
bank_balance = accum(amounts);
|
|
Code sample 2:
|
car = "NewGroup"//"Cavalier"//"Astra"//"NewGroup"//"Bentley"//
"NewGroup"//"Megane"//"Clio";
newgroup = (car="NewGroup");
groupnum = accum(newgroup);
car = mask(car, not newgroup);
groupnum = mask(groupnum, not newgroup);
groups = unique(groupnum);
for g in groups
echo("Group "+g);
echo(mask(car,groupnum=g));
endfor
|
|
See also:
|
diff
|
acos - return arc cosine
|
Syntax:
|
float acos(float x)
|
|
Description:
|
Returns
the arc cosine (cos-1) in radians of each member in x.
To convert to degrees use acos(x)*pi/180.0
If a member of x is not within the range -1 to 1, then
acos returns undef for that member
|
|
Examples:
|
x
|
acos(x)
|
|
-1
-.5
0
.5
1
1.5
|
3.14159
2.0944
1.5708
1.0472
0
UNDEF
|
|
See also:
|
asin, atan, cos
|
all - return all objects of a given
type
|
Syntax:
|
string all(string objectClass, string
parent)
|
|
Description:
|
Returns the names of all objects of the specified type.
objectClass can be:
-
Any GUI object such as "Menu", "Dialog",
or "Button"
-
Any graphical object such as "Viewport", "Graph"
or "Title"
-
"Function", "Folder" or "Dataset"
-
An empty string ("") which will return all
objects.
|
|
Examples:
|
Expression
|
Value
|
| all("Dataset") |
WORK.argv
WORK.Height
TMP.TitleText
|
|
all("Menu")
|
gsharp_1.MenuBar.File
gsharp_1.MenuBar.Create
gsharp_1.MenuBar.Edit
...
|
| all("Viewport",
"page_2")
|
page_2.viewport_1
page_2.viewport_2
|
|
all("Page")
|
page_1
page_2
|
|
Code sample:
|
function ShowAllViewports(float flag)
string VIEW;
for VIEW in all("Viewport")
if VIEW=undef continue;
$(VIEW).XuNobjectEnabled = flag;
endfor
endfunction
ShowAllViewports(false);
|
|
See also:
|
childrenof
|
and - logical and
|
Syntax:
|
float and(float x, float y)
x and y
|
|
Description:
|
Returns a logical and on the corresponding elements
of x and y.
An expression is true if it is non-zero
|
|
Examples:
|
x
|
y
|
and(x,y)
|
x and y
|
|
true
false
true
false
|
true
true
false
false
|
true
false
false
false
|
|
Code sample:
|
height=rnd(100)*2;
weight=rnd(100)*200;
tall=height>1.5;
heavy=weight>100;
tallAndHeavy = and(tall, heavy);
tallAndHeavy2 = tall and heavy; #the same result
|
|
See also:
|
if,
mask,
not,
or
|
append - append datasets
|
Syntax:
|
any append(x, y)
x // y
|
|
Description:
|
Returns y appended to x
-
If x or y are grids, blocks or rows they are transformed
into an array in the same as the list
function.
-
Unless they are rows of equal size, in which case the
rows are appended. See second example below.
|
|
Examples:
|
x
|
y
|
append(x,y)
|
|
"one"
|
"two"
"three"
|
"one"
"two"
"three"
|
|
(1,2)
|
(3,4)
|
(1,2)
(3,4)
|
|
Code sample:
|
days = "Sun"//"Mon"//"Tue"//"Wed"//"Thu"//"Fri"//"Sat";
dayCode = nint(rnd(100)*7+.5);
randomDays = slicex(days,dayCode);
|
|
See also:
|
slicex
|
appseat - test for Gsharp Application
Seat
|
Syntax:
|
float appseat()
|
|
Description:
|
Returns true if Gsharp is running in Application Seat mode.
|
|
Code sample:
|
if not appseat() then
create Menu gsharp_1.MenuBar.Tools.Browser
( XuNguiCallback = "GuiToolsBrowser"
);
endif
|
|
See also:
|
batch,
version,
webedition
|
asin - return arc sine
|
Syntax:
|
float asin(float x)
|
|
Description:
|
Returns
the arc sine (sin-1) in radians of each member in x.
To convert to degrees use asin(x)*pi/180.0
If a member of x is not within the range -1 to 1, then
asin returns undef for that member
|
|
Examples:
|
x
|
acos(x)
|
|
-1
-.5
0
.5
1
1.5
|
-1.5708
-0.523599
0
0.523599
1.5708
UNDEF
|
|
See also:
|
acos, atan, sin
|
atan - return arc tangent
|
Syntax:
|
float atan(float x)
|
|
Description:
|
Returns
the arc tangent (tan-1) in radians of each member in x.
To convert to degrees use atan(x)*pi/180.0
Values returned by atan are always in the range
-π/2 to π/2
|
|
See also:
|
acos, atan2, tan
|
atan2 - return angle given dy and
dx
|
Syntax:
|
float atan2(float dy, float dx)
|
|
Description:
|
atan2(dy,dx)
returns the angle of a point from the origin given its y displacement
(dy) and x displacement (dx).
|
|
Code sample:
|
dy = rnd(100)-.5;
dx = rnd(100)-.5;
#Convert from cartesian co-ordinates (dx, dy) to polar (r,th)
th = atan2(dy,dx);
r = sqrt(dy*dy+dx*dx);
#And back again
dy = r*sin(th);
dx = r*cos(th);
|
|
See also:
|
atan, sqrt,
sin,
cos
|
avg - average
|
Syntax:
|
float avg(float x)
|
|
Description:
|
Returns the average of all the valid elements in x.
|
|
Examples:
|
x
|
avg(x)
|
|
1
undef
2
|
1.5
|
|
See also:
|
sum,
count,
avgx
|
avgx - column averages
|
Syntax:
|
float avg(float x)
|
|
Description:
|
Returns the average of each column of x
|
|
Examples:
|
x
|
avg(x)
|
avgx(transpose(x))
|
|
1
|
1
|
4
|
1
|
2
|
|
0
|
2
|
1
|
2
|
1
|
|
2
|
3
|
1
|
2
|
2
|
|
See also:
|
avg
|
|