-
Notifications
You must be signed in to change notification settings - Fork 69
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add typing and better identifiers to FukushimaEllipticBDJ.
- 2025012913-Kuratowski
- 2024123022-Kummer
- 2024120106-Крылов
- 2024110113-Kronecker
- 2024100219-Колмогоров
- 2024090302-von Koch
- 2024080411-Klein
- 2024070523-Kleene
- 2024060613-𒁹𒆠𒁷𒉡
- 2024050803-کاشانی
- 2024040818-Καραθεοδωρή
- 2024031009-Канторович
- 2024020923-掛谷
- 2024011112-Julia
- 2023121300-Jordan
- 2023111209-賈憲
- 2023101418-𓇹𓄟𓋴𓏲
- 2023091502-Jensen
- 2023081610-Jacobi
- 2023071719-岩澤
- 2023061805-伊藤
- 2023051916-ابن الهيثم
- 2023042004-Ὑπατία
- 2023032117-Hurwitz
- 2023022007-Householder
- 2023012121-Horner
- 2022122310-l’Hôpital
- 2022112323-Ἱπποκράτης
- 2022102511-Ἱππίας
- 2022092522-Ἵππασος
- 2022082708-Ἵππαρχος
- 2022072818-Hilbert
- 2022062903-Hesse
- 2022053012-Ἥρων
- 2022043020-Hermite
- 2022040106-Heine
- 2022030218-Hausdorff
- 2022020106-हरीशचंद्र
- 2022010219-Hardy
- 2021120408-Hamilton
- 2021110421-Halley
- 2021100611-Hadamard
- 2021090701-Haar
- 2021080814-Grothendieck
- 2021071001-Grossmann
- 2021061011-Gröbner
- 2021051119-Green
- 2021041203-Grassmann
- 2021031310-Goldbach
- 2021021119-Gödel
- 2021011305-Germain
- 2020121416-Гельфонд
- 2020111505-Гельфанд
- 2020101620-Gauss
- 2020091711-Gateaux
- 2020081903-Galois
- 2020072018-Gallai
- 2020062107-Galileo
- 2020052218-Fuchs
- 2020042302-Fubini
- 2020032409-Frobenius
- 2020022316-Frenet
- 2020012422-Frege
- 2019122605-Fréchet
- 2019112615-פרנקל
- 2019102804-Fourier
- 2019092818-Fibonacci
- 2019083011-del Ferro
- 2019080103-Ferrari
- 2019070219-Fermat
Showing
4 changed files
with
78 additions
and
47 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,6 +6,7 @@ | |
#include "numerics/elliptic_integrals.hpp" | ||
#include "gtest/gtest.h" | ||
#include "quantities/numbers.hpp" | ||
#include "quantities/si.hpp" | ||
#include "testing_utilities/almost_equals.hpp" | ||
#include "testing_utilities/is_near.hpp" | ||
#include "testing_utilities/serialization.hpp" | ||
|
@@ -14,6 +15,8 @@ | |
|
||
namespace principia { | ||
|
||
using quantities::Angle; | ||
using quantities::si::Radian; | ||
using testing_utilities::AlmostEquals; | ||
using testing_utilities::IsNear; | ||
using testing_utilities::ReadFromTabulatedData; | ||
|
@@ -28,42 +31,42 @@ class EllipticIntegralsTest : public ::testing::Test {}; | |
TEST_F(EllipticIntegralsTest, Xelbdj) { | ||
auto const xeldbj_expected = | ||
ReadFromTabulatedData(SOLUTION_DIR / "numerics" / "xelbdj.proto.txt"); | ||
double Δnc, Δmc, Δφ, nc, nn, mc, mm, φ, b, d, j; | ||
int lend, kend, iend; | ||
|
||
lend = 5; | ||
kend = 5; | ||
iend = 4; | ||
Δnc = 1.0 / static_cast<double>(lend - 1); | ||
Δmc = 1.0 / static_cast<double>(kend - 1); | ||
Δφ = (π / 2) / static_cast<double>(iend); | ||
|
||
constexpr int lend = 5; | ||
constexpr int kend = 5; | ||
constexpr int iend = 4; | ||
constexpr double Δnc = 1.0 / static_cast<double>(lend - 1); | ||
constexpr double Δmc = 1.0 / static_cast<double>(kend - 1); | ||
constexpr Angle Δφ = (π / 2) * Radian / static_cast<double>(iend); | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
pleroy
Author
Member
|
||
std::printf( | ||
"%10s%10s%10s%25s%25s%25s\n", "n", "m", "φ / π", "elb", "eld", "elj"); | ||
|
||
int expected_index = 0; | ||
for (int l = 1; l <= lend; ++l) { | ||
nc = static_cast<double>(l - 1) * Δnc; | ||
double nc = static_cast<double>(l - 1) * Δnc; | ||
if (nc <= 1.05e-8) { | ||
nc = 1.05e-8; | ||
} | ||
float rnc = static_cast<float>(nc); | ||
if (rnc <= 2.44e-4) { | ||
nc = 2.44e-4; | ||
} | ||
nn = 1.0 - nc; | ||
double const nn = 1.0 - nc; | ||
for (int k = 1; k <= kend; ++k) { | ||
std::printf("\n"); | ||
mc = static_cast<double>(k - 1) * Δmc; | ||
double mc = static_cast<double>(k - 1) * Δmc; | ||
if (mc <= 0.0) { | ||
mc = 1.21e-32; | ||
} | ||
mm = 1.0 - mc; | ||
double const mm = 1.0 - mc; | ||
for (int i = 0; i <= iend; ++i) { | ||
φ = Δφ * static_cast<double>(i); | ||
double b, d, j; | ||
Angle const φ = Δφ * static_cast<double>(i); | ||
FukushimaEllipticBDJ(φ, nn, mc, b, d, j); | ||
std::printf("%10.5f%10.5f%10.5f%25.15f%25.15f%25.15f\n", | ||
nn, | ||
mm, | ||
φ / π, | ||
φ / (π * Radian), | ||
b, | ||
d, | ||
j); | ||
|
@@ -77,7 +80,8 @@ TEST_F(EllipticIntegralsTest, Xelbdj) { | |
auto const expected_value_j = expected_entry.value(2); | ||
EXPECT_THAT(nn, IsNear(expected_argument_n, 1.001)); | ||
EXPECT_THAT(mm, IsNear(expected_argument_m, 1.001)); | ||
EXPECT_THAT(φ / π, IsNear(expected_argument_φ_over_π, 1.001)); | ||
EXPECT_THAT(φ / (π * Radian), | ||
IsNear(expected_argument_φ_over_π, 1.001)); | ||
EXPECT_THAT(b, AlmostEquals(expected_value_b, 0, 8)); | ||
|
||
// TODO(phl): xelbdj_all.txt enshrines values that are incorrect for | ||
|
@@ -104,7 +108,7 @@ TEST_F(EllipticIntegralsTest, MathematicaMNear1) { | |
for (auto const& entry : elliptic_integrals_expected.entry()) { | ||
double const argument_n = entry.argument(0); | ||
double const argument_m = entry.argument(1); | ||
double const argument_φ = entry.argument(2); | ||
Angle const argument_φ = entry.argument(2) * Radian; | ||
double const expected_value_b = entry.value(0); | ||
double const expected_value_d = entry.value(1); | ||
double const expected_value_j = entry.value(2); | ||
|
I don't think the explicit casts are needed.