Concerning setting the precision of c
: Have you seen Rationalize
and SetPrecision
? Consider using c = Rationalize[1.2]
, c = Rationalize[1.2, 0]
, c = Rationalize[Rationalize[1.2], 0]
or c = SetPrecision[1.2, Infinity]
. And so forth. You can substitute for 1.2
the computed value/variable in your actual use-cases.
I get an accuracy of 199.5 correct digits for c = 1.2`200
and 199.9 digits for c = 1.2`201
in V11.1.1. For WorkingPrecision -> 200
, the default PrecisionGoal
for a one-dimensional integral is half (I think), or 100 digits. In both cases, I'm getting considerably more accuracy than requested. So I can't really comment on your results, since I cannot reproduce them. -- Aha, I may have a guess. The 0.+<<18>>...
in the error message has a machine-precision float 0.
, which suggests a machine-precision parameter was used. There are none in your code, but if I set n = 7.
(to a machine-precision float, instead of an exact integer 7
), then the following reproduces the expression in your error message.
Sqrt[c^2 + k^2] ChebyshevU[7., k/(I c)]^2 // Short[#, 3] &
Note the differences between WorkingPrecision
, PrecisionGoal
, and AccuracyGoal
in NIntegrate
. With PrecisionGoal -> p
and AccuracyGoal -> a
, NIntegrate
tries to make the estimated error for a result
$I$ less than
$10^{-a} + |I|\,10^{-p}$. They control the algorithm. WorkingPrecision
on the other hand controls the rounding error in the computations. For convenience, when PrecisionGoal
and AccuracyGoal
are set to Automatic
, Mathematica makes them depend on WorkingPrecision
, usually setting them to half the setting for WorkingPrecision
. One generally needs a higher working precision than the precision goal.