Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I hope the title is not misleading:

Suppose I have a function that is quite complicated, e.g.

f[u_] := Exp[-Exp[- Abs[c.u]^a] Sin[d.u] Sin[(Abs[c.u]^a) ...

I want to use this function for numerical integration NIntegrate[f, {s, bound1, bound2}] that is prone to numerical error. Mathematica keeps telling me, that the function evaluates not to the desired precision, I have chosen for the numerical integration. Is there a way to improve the precision of the function evaluation, e.g. using arbitrary precision packages/functions? What could I do?

Thanks for your help, it is highly appreciated.


To be a bit more precise: I am trying to do an oscillatory Hilbert transform for a function (King 2002: "Numerical Evaluation of Hilbert transforms for oscillatory functions"). So the error is scaled up with $t^{-1}$ around the singularity. So far the values I obtain are far from being precise, so maybe the technique won't work at all. But I wanted to give it a try. I now use exact number constants like a := 1/10 and T := N[Tan[Pi*a/2], 100]. I hope that Pi will also have the required number of digits then.

share|improve this question
could you show a concrete example? Otherwise it is hard to know what to suggest. – acl Feb 24 '12 at 14:19
could you post some code that doesn't work? I think that not many will be motivated to find the article you mention, read it, guess what went wrong in the implementation, and fix it. also, you probably want T=Tan[Pi*a/2], not := – acl Feb 24 '12 at 16:31
Giving exact input and setting WorkingPrecision-><something high>, PrecisionGoal-><something more modest> might be a way to get what you want without too much sacrifice of speed. For your specific problem though it might make sense to integrate away from the singularity, and handle the region around it differently. A series approximation for the integrand might be useful for that latter part. – Daniel Lichtblau Feb 24 '12 at 16:56

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.