[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[lmi-commits] [lmi] master 4bc5b1f 4/8: Make bounds and tolerance match
From: |
Greg Chicares |
Subject: |
[lmi-commits] [lmi] master 4bc5b1f 4/8: Make bounds and tolerance match textbook examples better |
Date: |
Fri, 30 Jul 2021 16:14:47 -0400 (EDT) |
branch: master
commit 4bc5b1f6c68ad3c479ea31ac42facf9afeab5562
Author: Gregory W. Chicares <gchicares@sbcglobal.net>
Commit: Gregory W. Chicares <gchicares@sbcglobal.net>
Make bounds and tolerance match textbook examples better
---
zero_test.cpp | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
diff --git a/zero_test.cpp b/zero_test.cpp
index 896268d..f408ee7 100644
--- a/zero_test.cpp
+++ b/zero_test.cpp
@@ -886,20 +886,20 @@ void test_various_functions()
// page 96; number of iterations estimated from graphs.
// Scherer, Fig. 6.10, iteration counts for 2ϵ tolerance:
- // 10 vs. 10 here (Brent)
+ // 10 vs. 11 here (Brent)
// 7 (Chandrupatla)
auto f04 = [](double x) {return std::pow(x, 2.0) - 2.0;};
auto root_04 = std::sqrt(2.0);
- test_a_decimal_function(f04, root_04, 0.0 , 2.0, 17 , __LINE__, 10);
- test_a_function (f04, root_04, 0.0 , 2.0, 1.0e-15, __LINE__);
+ test_a_decimal_function(f04, root_04, -1.0, 2.0, 17 , __LINE__, 11);
+ test_a_function (f04, root_04, -1.0, 2.0, 0.0 , __LINE__);
// Scherer, Fig. 6.11, iteration counts for 2ϵ tolerance:
// 126 vs. 130 here (Brent)
// 59 (Chandrupatla)
- auto f05 = [](double x) {return std::pow((x - 1.0), 3);};
+ auto f05 = [](double x) {return std::pow((x - 1.0), 3.0);};
auto root_05 = 1.0;
- test_a_decimal_function(f05, root_05, 0.0 , 1.8, 17 , __LINE__, 130);
- test_a_function (f05, root_05, 0.0 , 1.8, 1.0e-15, __LINE__);
+ test_a_decimal_function(f05, root_05, 0.0, 1.8, 17 , __LINE__, 130);
+ test_a_function (f05, root_05, 0.0, 1.8, 0.0 , __LINE__);
// Scherer, Fig. 6.12, iteration counts for 1.0e-12 tolerance
// (roundoff error in the computed function precludes 2ϵ):
@@ -907,8 +907,8 @@ void test_various_functions()
// 31 (Chandrupatla)
auto f06 = [](double x) {return std::pow(x, 25.0);};
auto root_06 = 0.0;
- test_a_decimal_function(f06, root_06, -1.0 , 2.0, 12 , __LINE__, 107);
- test_a_function (f06, root_06, -1.0 , 2.0, 5.0e-13, __LINE__);
+ test_a_decimal_function(f06, root_06, -1.0, 2.0, 12 , __LINE__, 107);
+ test_a_function (f06, root_06, -1.0, 2.0, 5.0e-13, __LINE__);
// Despite its apparent insipidity, this is actually a very
// interesting test: after the first iterate has been calculated
- [lmi-commits] [lmi] master updated (028b454 -> 5d4f506), Greg Chicares, 2021/07/30
- [lmi-commits] [lmi] master 828ff21 1/8: Renumber some unit tests, Greg Chicares, 2021/07/30
- [lmi-commits] [lmi] master 0113a5d 3/8: Test three examples from a textbook, Greg Chicares, 2021/07/30
- [lmi-commits] [lmi] master 4bc5b1f 4/8: Make bounds and tolerance match textbook examples better,
Greg Chicares <=
- [lmi-commits] [lmi] master b954393 2/8: Don't hard-code sqrt(2), Greg Chicares, 2021/07/30
- [lmi-commits] [lmi] master de32b80 7/8: Add an all-platform unit-test script, Greg Chicares, 2021/07/30
- [lmi-commits] [lmi] master 5d4f506 8/8: Record speed measurements, Greg Chicares, 2021/07/30
- [lmi-commits] [lmi] master cf516cc 6/8: Remove code added in the last commit to support its conclusions, Greg Chicares, 2021/07/30
- [lmi-commits] [lmi] master ac5731f 5/8: Controvert a published claim, Greg Chicares, 2021/07/30