Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: mockingbirdnest/Principia
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 8e1ede468ad1
Choose a base ref
...
head repository: mockingbirdnest/Principia
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 9c5083534ca6
Choose a head ref
  • 8 commits
  • 6 files changed
  • 1 contributor

Commits on Dec 29, 2020

  1. Copy the full SHA
    60eee8e View commit details
  2. Copy the full SHA
    0378350 View commit details
  3. the goldens keep coming

    eggrobin committed Dec 29, 2020
    Copy the full SHA
    f6c8859 View commit details

Commits on Dec 30, 2020

  1. address some comments

    eggrobin committed Dec 30, 2020
    Copy the full SHA
    c5c4532 View commit details
  2. forgot to save some files

    eggrobin committed Dec 30, 2020
    Copy the full SHA
    cecbe33 View commit details
  3. StrReplaceAll

    eggrobin committed Dec 30, 2020
    Copy the full SHA
    abdcf4f View commit details
  4. β

    eggrobin committed Dec 30, 2020
    Copy the full SHA
    a68a6ad View commit details

Commits on Dec 31, 2020

  1. Merge pull request #2829 from eggrobin/just-say-no-to-goldens

    Make mathematica_test a little less brittle
    eggrobin authored Dec 31, 2020
    Copy the full SHA
    9c50835 View commit details
Showing with 160 additions and 409 deletions.
  1. +23 −0 mathematica/mathematica.hpp
  2. +12 −11 mathematica/mathematica_body.hpp
  3. +116 −389 mathematica/mathematica_test.cpp
  4. +2 −2 numerics/piecewise_poisson_series.hpp
  5. +2 −2 numerics/poisson_series.hpp
  6. +5 −5 numerics/polynomial.hpp
23 changes: 23 additions & 0 deletions mathematica/mathematica.hpp
Original file line number Diff line number Diff line change
@@ -222,19 +222,41 @@ template<typename R,
std::string ToMathematica(R ref,
OptionalExpressIn express_in = std::nullopt);

template<typename V, typename A, int d,
template<typename, typename, int> class E,
typename OptionalExpressIn = std::nullopt_t>
std::string ToMathematicaBody(
PolynomialInMonomialBasis<V, A, d, E> const& polynomial,
OptionalExpressIn express_in = std::nullopt);

template<typename V, typename A, int d,
template<typename, typename, int> class E,
typename OptionalExpressIn = std::nullopt_t>
std::string ToMathematica(
PolynomialInMonomialBasis<V, A, d, E> const& polynomial,
OptionalExpressIn express_in = std::nullopt);


template<typename V, int ad, int pd,
template<typename, typename, int> class E,
typename OptionalExpressIn = std::nullopt_t>
std::string ToMathematicaBody(
PoissonSeries<V, ad, pd, E> const& series,
OptionalExpressIn express_in = std::nullopt);

template<typename V, int ad, int pd,
template<typename, typename, int> class E,
typename OptionalExpressIn = std::nullopt_t>
std::string ToMathematica(PoissonSeries<V, ad, pd, E> const& series,
OptionalExpressIn express_in = std::nullopt);

template<typename V, int ad, int pd,
template<typename, typename, int> class E,
typename OptionalExpressIn = std::nullopt_t>
std::string ToMathematicaBody(
PiecewisePoissonSeries<V, ad, pd, E> const& series,
OptionalExpressIn express_in = std::nullopt);

template<typename V, int ad, int pd,
template<typename, typename, int> class E,
typename OptionalExpressIn = std::nullopt_t>
@@ -299,6 +321,7 @@ using internal_mathematica::Logger;
using internal_mathematica::Option;
using internal_mathematica::PlottableDataset;
using internal_mathematica::ToMathematica;
using internal_mathematica::ToMathematicaBody;

} // namespace mathematica
} // namespace principia
23 changes: 12 additions & 11 deletions mathematica/mathematica_body.hpp
Original file line number Diff line number Diff line change
@@ -86,7 +86,7 @@ struct TupleHelper<0, Tuple, OptionalExpressIn> : not_constructible {
template<typename V, typename A, int d,
template<typename, typename, int> class E,
typename OptionalExpressIn>
std::string ToMathematicaExpression(
std::string ToMathematicaBody(
PolynomialInMonomialBasis<V, A, d, E> const& polynomial,
OptionalExpressIn express_in) {
using Coefficients =
@@ -123,15 +123,16 @@ std::string ToMathematicaExpression(
template<typename V, int ad, int pd,
template<typename, typename, int> class E,
typename OptionalExpressIn>
std::string ToMathematicaExpression(PoissonSeries<V, ad, pd, E> const& series,
OptionalExpressIn express_in) {
std::string ToMathematicaBody(
PoissonSeries<V, ad, pd, E> const& series,
OptionalExpressIn express_in) {
std::vector<std::string> components = {
ToMathematicaExpression(series.aperiodic_, express_in)};
ToMathematicaBody(series.aperiodic_, express_in)};
for (auto const& [ω, polynomials] : series.periodic_) {
std::string const polynomial_sin =
ToMathematicaExpression(polynomials.sin, express_in);
ToMathematicaBody(polynomials.sin, express_in);
std::string const polynomial_cos =
ToMathematicaExpression(polynomials.cos, express_in);
ToMathematicaBody(polynomials.cos, express_in);
std::string const angle =
Apply("Times",
{ToMathematica(ω, express_in),
@@ -148,13 +149,13 @@ std::string ToMathematicaExpression(PoissonSeries<V, ad, pd, E> const& series,
template<typename V, int ad, int pd,
template<typename, typename, int> class E,
typename OptionalExpressIn>
std::string ToMathematicaExpression(
std::string ToMathematicaBody(
PiecewisePoissonSeries<V, ad, pd, E> const& series,
OptionalExpressIn express_in) {
std::vector<std::string> conditions_and_functions;
for (int i = 0; i < series.series_.size(); ++i) {
std::string const function =
ToMathematicaExpression(series.series_[i], express_in);
ToMathematicaBody(series.series_[i], express_in);
std::string const condition =
Apply("Between",
{"#",
@@ -443,23 +444,23 @@ template<typename V, typename A, int d,
std::string ToMathematica(
PolynomialInMonomialBasis<V, A, d, E> const& polynomial,
OptionalExpressIn express_in) {
return Apply("Function", {ToMathematicaExpression(polynomial, express_in)});
return Apply("Function", {ToMathematicaBody(polynomial, express_in)});
}

template<typename V, int ad, int pd,
template<typename, typename, int> class E,
typename OptionalExpressIn>
std::string ToMathematica(PoissonSeries<V, ad, pd, E> const& series,
OptionalExpressIn express_in) {
return Apply("Function", {ToMathematicaExpression(series, express_in)});
return Apply("Function", {ToMathematicaBody(series, express_in)});
}

template<typename V, int ad, int pd,
template<typename, typename, int> class E,
typename OptionalExpressIn>
std::string ToMathematica(PiecewisePoissonSeries<V, ad, pd, E> const& series,
OptionalExpressIn express_in) {
return Apply("Function", {ToMathematicaExpression(series, express_in)});
return Apply("Function", {ToMathematicaBody(series, express_in)});
}

template<typename OptionalExpressIn>
Loading