bool TrigonometricFunction::unaryAcot(ExecutionContext *context, QString *err) { switch (context->obligArg().type()) { case PretexVariant::Int: context->setReturnValue(acot(context->obligArg().toInt())); break; case PretexVariant::Real: context->setReturnValue(acot(context->obligArg().toReal())); break; case PretexVariant::String: default: return bRet(err, tr("Invalid argument type", "error"), false); } return bRet(err, QString(), true); }
double LagrangianPropagator::CalculateUniversableVariableInitialGuess(double r0, double v0, double rdotv, double alpha, double seconds, double mu) { double x = 1.0; double alphaThreshold = 0.000001 * (ASTRO_MU_EARTH / mu); // Reference? if (alpha > alphaThreshold) // Circle or Ellipse { x = sqrt(mu) * alpha * seconds; } else if (alpha < -alphaThreshold) // Hyperbola { double a = 1.0 / alpha; x = Sign(seconds) * sqrt(-a) * log((-2.0 * mu * alpha * seconds) / (rdotv + Sign(seconds) * sqrt(-mu * a) * (1.0 - r0 * alpha))); } else // Parabola { double h = 0.5 * SQR(v0) - mu / r0; double p = SQR(h) / mu; double s = 0.5 * acot(3.0 * sqrt(mu / pow(p, 3.0)) * seconds); double w = pow(tan(s), 1.0 / 3.0); x = 2.0 * sqrt(p) * cot(2.0 * w); } return x; }
BigReal rAcot(const BigReal &x, size_t digits) { static const BigReal &c1 = BIGREAL_HALF; DigitPool *pool = x.getDigitPool(); if(x.isZero()) { return pi(e(_1,-(int)digits - 8), pool) * c1; } return acot(x,e(_1, min(0,-BigReal::getExpo10(x)) - digits - 8)); }
constexpr double atan(double x){ return x < 0.0? -atan(-x): x > 1.0? acot(1.0/x): 4*_impl::atan_impl2(_impl::atan_impl3(x, 0, 2)); }