I have a function f(t)f(t) defined as

f(t)=t∫0(t−ξ)α−1 cos(ξ) dξf(t)=\int\limits_0^t(t-\xi)^{\alpha-1}\ \cos(\xi)\ d\xi

where 0<α<10<\alpha<1. I now want to evaluate this integral at various values of time. Therefore, my code for the function definition reads: f[t_] := NIntegrate[(t-x)^(a-1) Cos[x], {x, 0, t}] For the sake of this example, let us choose α=.3\alpha=.3, and let us attempt to evaluate f(t)f(t) at t=0.2t=0.2. Calling f[.2] returns the following error: NIntegrate::zeroregion: Integration region {{0.2,0.200000000000000011102230246246115891736237825076626353161415959706}} cannot be further subdivided at the specified working precision. NIntegrate assumes zero integral there and on any further indivisible regions. NIntegrate::inumri: The integrand Cos[x]/(0.2 -x)^0.7 has evaluated to Overflow, Indeterminate, or Infinity for all sampling points in the region with boundaries {{0.200000000000000011102230246246115891736237825076626353161415959706,0.200000000000000011092200115363618871738896620143270802392916628941}}. What is most puzzling is that there exists an analytical solution this integral in terms of the hyper-geometric function. Defining f(t)f(t) as f[t_] := Integrate[(t-x)^(a-1) cos[x], {x, 0, t}] and then calling f[.2] returns the correct value of the integral with no errors: f(.2)=2.02934f(.2)=2.02934. In fact, the analytical solution is f[t] = ConditionalExpression[3.33333 t^0.3 HypergeometricPFQ[{1}, {1.15, 0.65}, -(t^2/4)], Re[t] > 0 && Im[t] == 0]

Does this error has something to do with WorkingPrecision? I am relatively new to Mathematica, so forgive me if this is trivial.

UPDATE

My ultimate goal is to make this function Listable so that I can pass a list of times as the function argument. Consider again the function defined in terms of Integrate (and not NIntegrate). Here α−0.1\alpha-0.1. I now define an array to form my list of times.

time = Array[#/5 – .2 &, 11];

Passing this to f(t)f(t) as f[time] gives me the error

Power::infy: “Infinite expression 1/0^1.9 encountered.”

Infinity::indet: Indeterminate expression 0. ComplexInfinity encountered.

I note that it does give me the output, despite the error. However, if I pass the list of times manually I get the desired output:

f[{0, 0.2, 0.4, 0.6, 0.8, 1, 1.2, 1.4, 1.6, 1.8, 2}]

{0, 8.36644, 8.50035, 8.06263, 7.20356, 6.00083, 4.52232, 2.83781, 1.02105, -0.851216, -2.70136}

Is this also related to WorkingPrecision and how Array defines its entries?

=================

2

Yes you need to increase the WorkingPrecision to 20 for instance. Also dont forget to give the reals to at least that precision for example a=0.3`20

– Spawn1701D

Apr 21 ’13 at 5:01

Thanks, that was helpful. I have updated my question with another related issue I had.

– G. H. Hardly

Apr 21 ’13 at 5:29

You can of course make a definition as a function of two variables: hardly[a_, t_] := t^a HypergeometricPFQ[{1}, {(a + 1)/2, a/2 +1}, -t^2/4]/a

– J. M.♦

Apr 21 ’13 at 6:52

=================

1 Answer

1

=================

f[t_] := NIntegrate[(t – x)^(0.3 – 1) Cos[x], {x, 0, t}, WorkingPrecision -> 10]

f[0.2`20]

Gives:

2.029340978

For the listable situation, it is due to WorkingPrecision as before. You can do the following:

time = Array[#/5 – .2`20 &, 11];

Then Map f across as follows:

f /@ time

Which gives:

{0, 2.029340978, 2.398210571, 2.524050347, 2.479729745, 2.294755393,

1.989951583, 1.585123960, 1.101227368, 0.5608006799, -0.01230648010}