From acd13504159e4a4f828002a8226a1a9371e37420 Mon Sep 17 00:00:00 2001
From: tomrink <rink@ssec.wisc.edu>
Date: Fri, 16 Oct 2020 14:31:48 -0500
Subject: [PATCH] add 3pt quadratic minimization function

---
 modules/util/util.py | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/modules/util/util.py b/modules/util/util.py
index 3af55ece..01bbb909 100644
--- a/modules/util/util.py
+++ b/modules/util/util.py
@@ -108,4 +108,11 @@ def pressure_to_altitude(pres, temp, prof_pres, prof_temp, sfc_pres, sfc_temp, s
 
     z = thickness_hydrostatic(prof_pres, prof_temp) + sfc_elev
 
-    return z
\ No newline at end of file
+    return z
+
+
+# http://fourier.eng.hmc.edu/e176/lectures/NM/node25.html
+def minimize_quadratic(xa, xb, xc, ya, yb, yc):
+    x_min = xb + 0.5*(((ya-yb)*(xc-xb)*(xc-xb) - (yc-yb)*(xb-xa)(xb-xa)) /
+                      ((ya-yb)*(xc-xb) + (yc-yb)*(xb-xa)))
+    return x_min
\ No newline at end of file
-- 
GitLab