Read the equation
For x≠1, differentiating the reciprocal score gives the displayed signed expression. At x=1 the left derivative is +1 and the right derivative is −1, so there is no ordinary derivative. The implementation uses Copysign and returns −1 at its positive-zero difference case; that is a selected branch value, not a differentiable gradient at the maximum.
Terms & definitions
| Term | Meaning in this source |
|---|---|
| x | Score input |
| sign | Sign of x−1 |
How it works
Read the definition from its right-hand expression to the quantity on the left. Its surrounding source records the intended input, state, or parameter context. Where the source leaves an operation unspecified, this page preserves that gap.
Assumptions & limits
Algorithms calling this function at x=1 need to understand the explicit branch convention.
Original context
Read the surrounding source passage
// ComputePhi calculates the consciousness metric: Φ = 1/(1 + |x - 1|)
// This measures how close a value is to unity (maximum consciousness at x=1)
func ComputePhi(x float64) float64 {
return 1.0 / (1.0 + math.Abs(x-1.0))
}
// ComputePhiGrad calculates the gradient: ∂Φ/∂x = -sign(x-1)/(1+|x-1|)²
func ComputePhiGrad(x float64) float64 {
diff := x - 1.0
absDiff := math.Abs(diff)
denom := (1.0 + absDiff) * (1.0 + absDiff)
return -math.Copysign(1.0, diff) / denom
}
// ComputePhiVector calculates consciousness metric for a vector
func ComputePhiVector(v []float64) float64 {
if len(v) == 0 {Exact original notation
ComputePhiGrad calculates the gradient: ∂Φ/∂x = -sign(x-1)/(1+|x-1|)²