From 5a7eb37c19cccc6cac3d1620d603cf953d7bdece Mon Sep 17 00:00:00 2001 From: NevinBR Date: Wed, 11 Nov 2020 14:05:55 -0500 Subject: [PATCH] Cleaned up some comments --- Sources/ComplexModule/ElementaryFunctions.swift | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Sources/ComplexModule/ElementaryFunctions.swift b/Sources/ComplexModule/ElementaryFunctions.swift index 49050fa..8f20a58 100644 --- a/Sources/ComplexModule/ElementaryFunctions.swift +++ b/Sources/ComplexModule/ElementaryFunctions.swift @@ -35,7 +35,6 @@ import RealModule -// TODO: uncomment conformance once all implementations are provided. extension Complex: ElementaryFunctions { // MARK: - exp-like functions @@ -343,10 +342,11 @@ extension Complex: ElementaryFunctions { // be quite painful to calculate. Instead, we can use an approach that // NevinBR suggested on the Swift forums: // - // Re(log 1+z) = (log 1+z + log 1+z̅)/2 - // = log((1+z)(1+z̅)/2 - // = log(1+z+z̅+zz̅)/2 - // = log((2+x)x + y²)/2 + // Re(log(1+z)) = (log(1+z) + log(1+z̅)) / 2 + // = log((1+z)(1+z̅)) / 2 + // = log(1 + z + z̅ + zz̅) / 2 + // = log(1 + 2x + x² + y²) / 2 + // = log(onePlus: (2+x)x + y²) / 2 // // So now we need to evaluate (2+x)x + y² accurately. To do this, // we employ augmented arithmetic; the key observation here is that