rename sample_normal_from_90_ci and add to squiggle.h

This commit is contained in:
NunoSempere 2023-12-14 12:37:12 +00:00
parent 95cedff3ab
commit c3de336a5b
2 changed files with 4 additions and 3 deletions

View File

@ -70,7 +70,7 @@ double sample_lognormal(double logmean, double logstd, uint64_t* seed)
return exp(sample_normal(logmean, logstd, seed)); return exp(sample_normal(logmean, logstd, seed));
} }
inline double sample_normal_from_90_confidence_interval(double low, double high, uint64_t* seed) double sample_normal_from_90_ci(double low, double high, uint64_t* seed)
{ {
// Explanation of key idea: // Explanation of key idea:
// 1. We know that the 90% confidence interval of the unit normal is // 1. We know that the 90% confidence interval of the unit normal is
@ -101,10 +101,10 @@ double sample_to(double low, double high, uint64_t* seed)
// returns a sample from a lognorma with a matching 90% c.i. // returns a sample from a lognorma with a matching 90% c.i.
// Key idea: If we want a lognormal with 90% confidence interval [a, b] // Key idea: If we want a lognormal with 90% confidence interval [a, b]
// we need but get a normal with 90% confidence interval [log(a), log(b)]. // we need but get a normal with 90% confidence interval [log(a), log(b)].
// Then see code for sample_normal_from_90_confidence_interval // Then see code for sample_normal_from_90_ci
double loglow = log(low); double loglow = log(low);
double loghigh = log(high); double loghigh = log(high);
return exp(sample_normal_from_90_confidence_interval(loglow, loghigh, seed)); return exp(sample_normal_from_90_ci(loglow, loghigh, seed));
} }
double sample_gamma(double alpha, uint64_t* seed) double sample_gamma(double alpha, uint64_t* seed)

View File

@ -15,6 +15,7 @@ double sample_unit_normal(uint64_t* seed);
double sample_uniform(double start, double end, uint64_t* seed); double sample_uniform(double start, double end, uint64_t* seed);
double sample_normal(double mean, double sigma, uint64_t* seed); double sample_normal(double mean, double sigma, uint64_t* seed);
double sample_lognormal(double logmean, double logsigma, uint64_t* seed); double sample_lognormal(double logmean, double logsigma, uint64_t* seed);
double sample_normal_from_90_ci(double low, double high, uint64_t* seed);
double sample_to(double low, double high, uint64_t* seed); double sample_to(double low, double high, uint64_t* seed);
double sample_gamma(double alpha, uint64_t* seed); double sample_gamma(double alpha, uint64_t* seed);