65 std::size_t max_intervals,
double rel_tol,
double abs_tol,
74 double correction = 0;
76 const double deriv = profiles.
derivative_at(i, 1, domain_end);
77 correction += 0.5 * deriv * deriv;
81 = [&profiles,
n_fields, d, correction](
double rho)
86 result += 0.5 * deriv * deriv;
90 result *= std::pow(rho, d - 1);
96 abs_tol, rel_tol, max_intervals, rule);
98 const auto error = std::get<0>(result);
101 + std::to_string(error));
140 std::size_t max_intervals,
double rel_tol,
double abs_tol,
148 double correction = potential(profiles.
evaluate_at(domain_end));
151 = [&potential, &profiles, d, correction](
double rho)
153 double result = potential(profiles.evaluate_at(rho));
154 result -= correction;
155 result *= std::pow(rho, d - 1);
161 abs_tol, rel_tol, max_intervals, rule);
163 const auto error = std::get<0>(result);
166 + std::to_string(error));
169 return 2. *
area_n_sphere(d - 1) * std::get<1>(result) / (2. - d);
200 std::size_t max_intervals,
double rel_tol,
209 double correction = 0.;
210 for (
int i = 0; i <
n_fields; ++i) {
211 const double deriv = profiles.
derivative_at(i, 1, domain_end);
212 correction += 0.5 * deriv * deriv;
214 correction += potential(profiles.
evaluate_at(domain_end));
217 = [&potential, &profiles,
n_fields, d, correction](
double rho)
220 for (
int i = 0; i <
n_fields; ++i) {
221 const double deriv = profiles.derivative_at(i, 1, rho);
222 result += 0.5 * deriv * deriv;
225 result += potential(profiles.evaluate_at(rho));
226 result -= correction;
227 result *= pow(rho, d - 1);
233 abs_tol, rel_tol, max_intervals, rule);
235 const auto error = std::get<0>(result);
238 + std::to_string(error));
259 std::size_t max_intervals,
double rel_tol,
265 rel_tol, abs_tol, rule) :
267 rel_tol, abs_tol, rule);
contains the definition of the Field_profiles clas
contains helper functions for calculating the Euclidean action
double get_domain_end() const
double calculate_potential_action(const Potential &potential, const Field_profiles &profiles, std::size_t max_intervals=1000, double rel_tol=1.e-4, double abs_tol=1.e-4, Integration_rule rule=Integration_rule::GK31)
Calculates the action using only the potential term contributions.
double derivative_at(int field, int order, double rho) const
Take the radial derivative of a field at a given radius.
double get_domain_start() const
double calculate_kinetic_action(const Potential &potential, const Field_profiles &profiles, std::size_t max_intervals=1000, double rel_tol=1.e-4, double abs_tol=1.e-4, Integration_rule rule=Integration_rule::GK31)
Calculates the action using only the kinetic term contributions.
std::tuple< int, double, double > integrate_gsl_qag(F f, double a, double b, double abs_tol, double rel_tol, std::size_t max_intervals, Integration_rule rule)
Eigen::VectorXd evaluate_at(double rho) const
Get all field values at a given radius.
int get_number_of_dimensions() const
double area_n_sphere(int n)
int get_number_of_fields() const
Numerical functions for one-dimensional shooting method and area of -sphere.
double calculate_full_action(const Potential &potential, const Field_profiles &profiles, std::size_t max_intervals=1000, double rel_tol=1.e-4, double abs_tol=1.e-4, Integration_rule rule=Integration_rule::GK31)
Calculates the action using all terms in the action integrand.
Abstract base class for a generic potential.
Exception indicating generic numerical error.
double calculate_action(const Potential &potential, const Field_profiles &profiles, std::size_t max_intervals=1000, double rel_tol=1.e-4, double abs_tol=1.e-4, Integration_rule rule=Integration_rule::GK31, bool use_kinetic=true)
Calculates the action using either the kinetic or potential terms.
Discretized set of field profiles.