Difference between revisions of "Mid"
m (→Examples) |
m (Typo, Uniform(1,1) should be Uniform(-1,1)) |
||
(2 intermediate revisions by one other user not shown) | |||
Line 3: | Line 3: | ||
==Mid(x)== | ==Mid(x)== | ||
− | Evaluates «x» in [[Evaluation Modes|Mid-Mode]]. | + | Evaluates «x» in [[Evaluation Modes|Mid-Mode]], i.e. deterministically. |
− | Whenever an expression or subexpression is evaluated, it is evaluated either in ''Mid-mode'' or ''Sample-mode'', in which sample-mode carries through information about uncertainty whereas mid-mode does not. The article on [[Evaluation Modes]] explains this in detail. | + | Whenever an expression or subexpression is evaluated, it is evaluated either in ''Mid-mode'' or ''Sample-mode'', in which sample-mode carries through information about uncertainty whereas mid-mode does not. The article on [[Evaluation Modes]] explains this in detail. [[Mid]](x) forces the evaluation of «x» to occur in Mid-mode even when the current evaluation mode is sample-mode. |
− | The | + | The [[Sample]] function does the opposite -- forcing «x» to be evaluated in sample mode. |
− | Distribution functions return their median value in Mid-mode, or a Monte Carlo when evaluated in Sample-mode. | + | Distribution functions return their [[median]] value in Mid-mode, or a Monte Carlo when evaluated in Sample-mode. |
− | + | [[Mid]] is also used as an ''meta-expression'' in a [[MultiTable]] to show the computed value of «x». | |
== Examples == | == Examples == | ||
− | Suppose <code>x := Uniform(1,1)^2</code> | + | Suppose <code>x := Uniform(-1, 1)^2</code> |
− | :<code> | + | :<code>Mid(x) → 0</code> |
− | :<code> | + | :<code>Median(x) → 0.25</code> |
− | :<code> | + | :<code>Mean(x) → 0.3333</code> |
− | When [[Mid]] is evaluated, the median value of <code>Uniform(-1,1)</code> is used, which is 0 and is then squared to get the mid-value of x. As seen, this is not equivalent to the median of | + | |
+ | When [[Mid]] is evaluated, the median value of <code>Uniform(-1, 1)</code> is used, which is 0 and is then squared to get the mid-value of <code>x</code>. As seen, this is not equivalent to the median of <code>x</code> when uncertainty is properly accounted for. | ||
== See Also == | == See Also == | ||
* [[Evaluation Modes]] | * [[Evaluation Modes]] | ||
+ | * [[Median]] | ||
+ | * [[Mean]] | ||
* [[Sample]] | * [[Sample]] | ||
* [[Random]] | * [[Random]] | ||
+ | * [[Uniform]] | ||
* [[Function Parameter Qualifiers]] | * [[Function Parameter Qualifiers]] |
Latest revision as of 18:08, 18 July 2017
Mid(x)
Evaluates «x» in Mid-Mode, i.e. deterministically.
Whenever an expression or subexpression is evaluated, it is evaluated either in Mid-mode or Sample-mode, in which sample-mode carries through information about uncertainty whereas mid-mode does not. The article on Evaluation Modes explains this in detail. Mid(x) forces the evaluation of «x» to occur in Mid-mode even when the current evaluation mode is sample-mode.
The Sample function does the opposite -- forcing «x» to be evaluated in sample mode.
Distribution functions return their median value in Mid-mode, or a Monte Carlo when evaluated in Sample-mode.
Mid is also used as an meta-expression in a MultiTable to show the computed value of «x».
Examples
Suppose x := Uniform(-1, 1)^2
Mid(x) → 0
Median(x) → 0.25
Mean(x) → 0.3333
When Mid is evaluated, the median value of Uniform(-1, 1)
is used, which is 0 and is then squared to get the mid-value of x
. As seen, this is not equivalent to the median of x
when uncertainty is properly accounted for.
Enable comment auto-refresher