Description
Return logRatio=((second-mean)^2-(first-mean)^2)/(2*deviation^2), requiring positive deviation.
Products of small probabilities can round to zero in floating-point arithmetic. Natural logarithms turn products into sums, and centering or expm1-based expressions can reduce avoidable numerical loss. A finite log weight is different from a raw probability and cannot directly represent an exact zero probability.
Return logRatio=((second-mean)^2-(first-mean)^2)/(2*deviation^2), requiring positive deviation.
When to use this tool
Use Normal Density Log Ratio Two Points when you need the stated natural-log contribution or stable conversion between a finite log representation and an ordinary value.
How to use the tool and how it works
- Enter first, second, mean, deviation. Use the units and conventions below.
- Run the tool. Correct any format, range, or cross-field input error before interpreting the output.
- Read logRatio. Use the output convention below.
Return logRatio=((second-mean)^2-(first-mean)^2)/(2*deviation^2), requiring positive deviation.1
| Input field | Meaning and units | Accepted input |
|---|---|---|
| first | First | Required. Finite number. |
| second | Second | Required. Finite number. |
| mean | Mean | Required. Finite number. |
| deviation | Positive normal standard deviation in the same unit as first, second, and mean. | Required. Finite number; strictly above 0. |
| Output field | Interpretation | Returned shape |
|---|---|---|
| logRatio | Log Ratio | Required. Finite number. |
{
"input": {
"first": 1,
"second": 3,
"mean": 0,
"deviation": 2
},
"output": {
"logRatio": 1
}
} Limitations and assumptions
- This is the natural log of the first-point normal density divided by the second-point density for one common mean and scale. It is a density ratio, not an event-probability ratio.
- Inputs must satisfy both the field types and the cross-field conditions above. Invalid input causes an error; a successful false flag or documented placeholder is a different result.
- Numeric calculations use binary floating point unless exact decimal-integer arithmetic is explicitly stated. No hidden measurement tolerance or decimal rounding is added; nonfinite or out-of-contract results are rejected. Signed zero is exported as zero.
Alternative or Complementary methods
Keep long products or normalizations in the log domain when feasible. Check whether exact zeros need a separate flag and whether the final ordinary-scale result is representable.
References
Similar or alternative tools
- Binary Observation Log Likelihood Ratio Term
For binary outcome and modelMass and referenceMass strictly between zero and one return ln(modelMass/referenceMass) for outcome one, otherwise ln((1-modelMass)/(1-referenceMass)).
- Log Probability Logsum Two Weights
Set max=max(left,right) and return logSum=max+ln(exp(left-max)+exp(right-max)).