| Prev | Next | Start of Chapter | End of Chapter | Contents | Index | (24 out of 25)

Arithmetic Function


The Arithmetic Function block lets you use a function or procedure as a block in a diagram. The block applies the function or procedure to its input value and passes the result. Specify the name of the function in the attribute Arithmetic Function.

You can use any:


Note: The input value for this block can be text, symbolic, or numeric.

Built-in G2 Function

You may set the attribute Arithmetic Function to any of these built-in G2 functions:

abs
arctan
ceiling
cos
exp
floor
int
ln
log
random
sin
sqrt
tan
truncate


This figure shows a diagram that computes the absolute value of the difference of two values:


User-Defined Function

You may use any user-defined function that accepts one quantitative argument and returns one quantitative value. Set the attribute Arithmetic Function to the name of the function. This figure shows a diagram that figures the factorial of a value:


Procedure

You can use a procedure that accepts three arguments, described in the following table, and returns a single value. Set the attribute Arithmetic Function to the name of your procedure. The block passes the procedure's return value as its output value. The block automatically passes the Collection-time and Quality of the block's input data path.

Argument Type Description
input-value
value
The block's input value.
collection-time
float
The Collection-time of the block's input path.
quality
symbol
The Quality of the block's input path.

This figure shows a diagram with an Arithmetic Function block that uses a procedure:


Tabular Function

You can use a tabular-function-of-1-arg that accepts one argument and returns a value. Set the attribute Arithmetic Function to the name of your function. The block passes its input value to the function as an argument and passes the function's return value as its output value. If the function cannot evaluate the input value, NOL signals an error. For information on a G2 tabular-function-of-1-arg, see the G2 Reference Manual.

This table shows a diagram with an Arithmetic Function block that uses a tabular- function-of-1-arg:


Configuring

This is the configuration panel for the Arithmetic Function block.


Attribute Description
Arithmetic Function
The name of a G2 function that the block executes.

See Also

For more information on attributes and menu choices that are not described in this section, see the sections below.

Click here for more information...
Basic Block Behavior
Editing Attribute Displays
The Arithmetic Function of Two Arguments block
Rule Action

| Prev | Next | Start of Chapter | End of Chapter | Contents | Index | (24 out of 25)

Copyright © 1996, Gensym Corporation, Inc.