Number Is Inside Fn


Number Is Inside Fn is a
direct subtype of Real To Real Function
aaaaaaaa aaaaaaaa aaaaaaaa aaaaaaaa aaaaaaaa aaaaaaaa aaaaaaaa aaaaaaaa aaaaaaaa aaaaaaaa aaaaaaaa aaaaaaaa aaaaaaaa aaaaaaaa aaaaaaaa aaaaaaaa
with functions Number Is Inside Fn Functions, keys Number Is Inside Fn keys and example object NumInsideFn

TYPE INCLUSION RELATIONSHIPS

Real To Real Function

Number Is Inside Fn

</defs>

AVAILABLE FUNCTIONS

Create

</defs>

AVAILABLE CREATE FUNCTION KEYS

Boolean Op

Interval

Itemized Output

Ref Values

Use Mask

</defs>

TYPICAL OBJECTS OF TYPE Number Is Inside Fn

NumInsideFn

</defs>

This type represents - in its basic form, but see also the variant forms below - a function ƒ that maps u real variable numbers x₁ , x₂ , ... , xᵤ to either 0 (FALSE) or 1 (TRUE) depending on what extent the input variables x₁ , x₂ , ... , xᵤ are within given lower and upper boundaries in accordance with a specified boolean transformation.
Note, this is essentially a predicate function since it only returns the real numbers 0 and 1 that are interpreted as FALSE and TRUE respectively.
Any mention below on FALSE and TRUE will mean 0 and 1 respectively.

Two cases must be distinguished:

Case 1:One input variable, i.e. u == 1

If the function receives only one input variable x₁, the default output will be TRUE if x₁ is within the given interval and no boolean transformation is applied.
Note in this case the default boolean transformation is
ID that is equivalent to no transformation.
But if the boolean transformation were specified as
NOT, the output would change to FALSE.

Case 2:More than one input variables, i.e. u > 1

If the function processes u input variables with u > 1, then u intervals and u - 1 boolean transformations B₁ , B₂ , ... , Bᵤ₋₁ must be also specified, at least implicitly.
Concretely, if fewer than u intervals are specified, the last specified interval is deemed to apply to all remaining input variables.
Similarly if fewer than u - 1 boolean transformations are specified, the last specified boolean transformation is deemed to apply to all remaining input variables.
The exact processing is as follows:
At first, the first variable x₁ alone is tested against the corresponding interval and produces a corresponding boolean result b₁
b₁ = TRUE if x₁ lies within the interval and FALSE otherwise.
Next, the second variable x₂ alone is tested against the corresponding interval and produces a corresponding boolean result b₂
b₂ = TRUE if x₂ lies within the interval and FALSE otherwise.
Before moving to the valuation of any remaining variables, an intermediate boolean output b'₂ corresponding to the already processed x₁ and x₂ is produced by applying the first boolean transformation B₁ on b₁ and b₂:
b'₂ = B₁(b₁ , b₂)
b'₂ will be the final output if no other variable follows x₂
But if a variable x₃ does exist, it will be tested against the corresponding interval and produce a corresponding boolean result b₃
Then the second boolean transformation B₂ will be applied to b₃ and b'₂ to produce the boolean b'₃, which will be the cummulative result so far.
If x₃ is the last input variable, b'₃ will be the final output, otherwise the process will continue.

As an example, below is the chart of a Number Is Inside Fn function that expects as input one real variable x and returns TRUE if x ∊ [0 , 1]



Below is the chart of a Number Is Inside Fn function that expects as input two real variables x₁ , x₂ and returns TRUE if both x₁ ∊ [0 , 1] and x₂ ∊ [0 , 1]



For simplicity, it is assumed in the description here the regular case whereby all input variables x₁ , x₂ , ... , xᵤ are processed in the given order by the function, but it is possible to process only a selected subset of this variables and/or under a different order through the use of the optional key
Input Variables

Variant forms of the function

'1) Using ' Growth Factors rather than the original numbers:
The processing described above may be applied to the growth factors x₁/x⁰₁ , x₂/x⁰₂ , ... , xᵤ/x⁰ᵤ rather than the original input numbers x₁ , x₂ , ... , xᵤ
This is possible by specifying the initial reference values x⁰₁ , x⁰₂ , ... , x⁰ᵤ through the key
Ref Values
A practical application of this variant is when x₁ , x₂ , ... , xᵤ represent market prices of u stocks at some particular time and the final payoff depends on the least performer stock.
Then the key
Ref Values could be set to hold the reference initial stock prices x⁰₁ , x⁰₂ , ... , x⁰ᵤ
Then the growth factors become x₁/x⁰₁ , x₂/x⁰₂ , ... , xᵤ/x⁰ᵤ which represent the stock performances in that time interval on which the final payoff depends.

2) Assume selected input variables are within their corresponding intervals.
The key
Use Mask can be used to instruct the function to refrain from checking whether certain input variables are within their corresponding intervals and instead assume they are.
If
Use Mask = true, the first input variable acts as the mask.
Specifically, its binary representation specifies which input variables will be affected in the mentioned way.

'3) Returning ' several booleans rather than a single boolean (in the form of 0 or 1):
The key
Itemized Output can be used to instruct the function to return detailed information about whether each of the input variables x₁ , x₂ , ... , xᵤ is within its corresponding interval.
If
Itemized Output = true, the function returns a number, the binary representation of which contains the mentioned information.