10.2-5 \[\]
A \mathbb{Z}-function is an enumerated collection of objects in which repetitions are allowed and order does matter. The reason behind calling it a \mathbb{Z}-function rather than simply a sequence, is to avoid possible conflicts with other packages that use the terms Sequence and IsSequence.
‣ IsZFunction ( arg ) | ( filter ) |
Returns: true
or false
Gap-categories of \mathbb{Z}-functions
‣ IsZFunctionWithInductiveSides ( arg ) | ( filter ) |
Returns: true
or false
Gap-categories of inductive \mathbb{Z}-functions
‣ VoidZFunction ( func ) | ( function ) |
Returns: an integer
The global function has no arguments and the output is an empty \mathbb{Z}-function. That means, it can not be evaluated yet.
‣ AsZFunction ( func ) | ( attribute ) |
Returns: a \mathbb{Z}-function
The argument is a function func that can be applied on integers. The output is a \mathbb{Z}-function z_func
. We call func the UnderlyingFunction
of z_func
.
‣ UnderlyingFunction ( z_func ) | ( attribute ) |
Returns: a \mathbb{Z}-function
The argument is a z_func. The output is its UnderlyingFunction
function. I.e., the function that will be applied on index i
whenever we call z_func[i
].
‣ ZFunctionValue ( z_func, i ) | ( operation ) |
Returns: a Gap object
The argument is a \mathbb{Z}-function z_func and an integer i. The output is z_func[i].
10.2-5 \[\]
‣ \[\] ( z_func, i ) | ( operation ) |
Returns: a Gap object
The method delegates to ZFunctionValue
.
‣ ZFunctionWithInductiveSides ( n, val_n, lower_func, upper_func, compare_func ) | ( operation ) |
Returns: a \mathbb{Z}-function with inductive sides
The arguments are an integer n, a Gap object val_n, a function lower_func, a function upper_func and a function compare_func. The output is the \mathbb{Z}-function z_func
defined as follows: z_func
[i
] is equal to lower_func(z_func
[i+1
]) if i
<
n; and is equal to val_n if i
=n; and is equal to upper_func(z_func
[i-1
]) otherwise. At each call, the method compares the computed value to the previous or next value via the function compare_func; and in the affermative case, the method sets a upper or lower stable values.
gap> f := function (i) Print( "Current i is ", i, "\n" ); return i^2; end;; gap> seq := AsZFunction( f ); <ZFunction> gap> seq[ 0 ]; Current i is 0 0 gap> seq[ 0 ]; 0 gap> upper_func := function ( a ) > if a[ 2 ] <> 0 then return [ a[ 2 ], a[ 1 ] mod a[ 2 ] ]; fi; return a; end;; gap> lower_func := IdFunc;; gap> gcd_seq := ZFunctionWithInductiveSides( 0, [ 111, 259 ], > lower_func, upper_func, \= ); <ZFunction> gap> HasStableLowerValue( gcd_seq ); false gap> gcd_seq[ -1 ]; [ 111, 259 ] gap> HasStableLowerValue( gcd_seq ); true gap> StableLowerValue( gcd_seq ); [ 111, 259 ] gap> IndexOfStableLowerValue( gcd_seq ); 0 gap> gcd_seq[ 0 ]; [ 111, 259 ] gap> gcd_seq[ 1 ]; [ 259, 111 ] gap> gcd_seq[ 2 ]; [ 111, 37 ] gap> gcd_seq[ 3 ]; [ 37, 0 ] gap> HasStableUpperValue( gcd_seq ); false gap> gcd_seq[ 4 ]; [ 37, 0 ] gap> HasStableUpperValue( gcd_seq ); true gap> StableUpperValue( gcd_seq ); [ 37, 0 ] gap> IndexOfStableUpperValue( gcd_seq ); 3 gap> sum := ApplyMap( gcd_seq, Sum ); <ZFunction> gap> sum[ 0 ]; 370 gap> sum[ 100 ]; 37 gap> c := CombineZFunctions( [ gcd_seq, sum ] ); <ZFunction> gap> c[ 0 ]; [ [ 111, 259 ], 370 ]
‣ UpperFunction ( z_func ) | ( attribute ) |
‣ LowerFunction ( z_func ) | ( attribute ) |
‣ StartingIndex ( z_func ) | ( attribute ) |
‣ StartingValue ( z_func ) | ( attribute ) |
‣ CompareFunction ( z_func ) | ( attribute ) |
Returns: a function
They are the attributes that define a \mathbb{Z}-function with inductive sides.
‣ StableUpperValue ( z_func ) | ( attribute ) |
Returns: a Gap object
The argument is a \mathbb{Z}-function z_func. We say that z_func has a stable upper value val
, if there is an index n
such that z_func[i
] is equal to val
for all indices i
's greater or equal to n
. In that case, the output is the value val
.
‣ IndexOfStableUpperValue ( z_func ) | ( attribute ) |
Returns: an integer
The argument is a \mathbb{Z}-function z_func with a stable upper value val
. The output is some index where z_func starts to take values equal to val
.
‣ SetStableUpperValue ( z_func, n, val ) | ( operation ) |
Returns: nothing
The arguments are a \mathbb{Z}-function z_func, an integer n and an object val. The operation sets val as a stable upper value for z_func at the index n.
‣ StableLowerValue ( z_func ) | ( attribute ) |
Returns: a Gap object
The argument is a \mathbb{Z}-function z_func. We say that z_func has a stable lower value val
, if there is an index n
such that z_func[i
] is equal to val
for all indices i
's less or equal to n
. In that case, the output is the value val
.
‣ IndexOfStableLowerValue ( z_func ) | ( attribute ) |
Returns: an integer
The argument is a \mathbb{Z}-function z_func with a stable lower value val
. The output is some index where z_func starts to take values equal to val
.
‣ SetStableLowerValue ( z_func, n, val ) | ( operation ) |
Returns: nothing
The arguments are a \mathbb{Z}-function z_func, an integer n and an object val. The operation sets val as a stable lower value for z_func at the index n.
‣ Reflection ( z_func ) | ( attribute ) |
Returns: a \mathbb{Z}-function
The argument is a \mathbb{Z}-function z_func. The output is another \mathbb{Z}-function ref_z_func
such that ref_z_func
[i
] is equal to z_func[-i
] for all i
's in \mathbb{Z}.
‣ ApplyShift ( z_func, n ) | ( operation ) |
Returns: a \mathbb{Z}-function
The argument is a \mathbb{Z}-function z_func and an integer n. The output is another \mathbb{Z}-function m
such that m
[i
] is equal to z_func[n+i
].
‣ ApplyMap ( z_func, F ) | ( operation ) |
Returns: a \mathbb{Z}-function
The arguments are a \mathbb{Z}-function z_func and a function F that can be applied on one argument. The output is another \mathbb{Z}-function m
such that m
[i
] is equal to F(z_func[i
]).
‣ ApplyMap ( L, F ) | ( operation ) |
Returns: a \mathbb{Z}-function
The arguments are a list of \mathbb{Z}-functions L and a function F with Length
(L) arguments. The output is another \mathbb{Z}-function m
such that m
[i
] is equal to F(L[1][i
],..., L[Length
(L)][i
]). We call the list L the BaseZFunctions
of m
and F the AppliedMap
.
‣ BaseZFunctions ( z_func ) | ( attribute ) |
Returns: a list of \mathbb{Z}-functions
The argument is a \mathbb{Z}-function z_func that has been defined by applying a map F
on a list L
of \mathbb{Z}-functions. The output is the list L
.
‣ AppliedMap ( z_func ) | ( attribute ) |
Returns: a \mathbb{Z}-function
The argument is a \mathbb{Z}-function z_func that has been defined by applying a map F
on a list L
of \mathbb{Z}-functions. The output is the function F
.
‣ CombineZFunctions ( L ) | ( operation ) |
Returns: a \mathbb{Z}-function
The argument is a dense list L of \mathbb{Z}-functions. The output is another \mathbb{Z}-function m
such that m
[i
] is equal to [L[1][i
],..., L[Length
(L)][i
]] for all indices i
's in \mathbb{Z}.
‣ Replace ( z_func, n, L ) | ( operation ) |
Returns: a \mathbb{Z}-function
The argument is a \mathbb{Z}-function z_func, an integer n and a dense list L. The output is a new \mathbb{Z}-function whose values between n and n+Length
(L)-1 are the entries of L.
generated by GAPDoc2HTML