Numerical contour integral – Mathematica Stack Exchange

I am trying to compute the double integral for fixed $m,z>0$:

   Integrate((Gamma(y/2) Sqrt(Gamma(3 - y)/Gamma(y)))/
  Gamma((3 - y)/2) z^(3 - y)
   (Exp(-m x) - 1) x^(y - 3)/x, {x, 0, (Infinity)},{y, 
  3/2 - I (Infinity), 3/2 + I (Infinity)})

The integral over $x$ can be done analytically, and the result depends on the product $mz$, so there is effectively just one parameter. The $x$ integral needs to be split into two regions I suspect, and in one region the contour of the $y$ integral would need to be deformed so that it remains convergent. Since the $y$ integral involves complicated branch cuts, I wanted to be able to do it numerically for a range of $mz$, to get a least a few digits of precision. I am having difficulty getting stable results numerically tho.

integration – Integral from Mathematica’s documentation: $int_0^1 frac{log left(frac{1}{2} left(1+sqrt{4 x+1}right)right)}{x} , dx = frac{pi^2}{15} $

I like to puruse Mathematica’s documentation and look at the ‘Neat Examples’: this is one I managed to figure out. Apparently it’s due to Ramanujan:
$$
I=int_0^1 frac{log left(frac{1}{2} left(1+sqrt{4 x+1}right)right)}{x}
, dx = frac{pi^2}{15}
$$


Here are the steps for my solution:

  1. Make the substitution $x=y^2-y$, yielding
    $$
    I= int _{1}^{phi}frac{log(y)(2y-1)}{y(y-1)},dy,
    $$
    where $displaystyle{phi = frac{1+sqrt{5}}{2}}$ is the golden ratio.
  2. Factor out the $log(y)$ term and use partial fractions to write
    $$I = underbrace{int _{1}^{phi}frac{log(y)}{y},dy}_{I_1} + underbrace{int _{1}^{phi}frac{log(y)}{y-1},dy}_{I_2}
    $$
    $I_1$ can be evaluated using a simple substitution, yielding $displaystyle{I_1 = frac{log ^2(phi )}{2}}$.
  3. Use the Taylor series for $log(y)$ centered at $y=1$ and interchange the sum and integral to show
    $$
    I_2 = -sum_{k=1}^{infty} frac{(1-phi)^{k}}{k^2}= -sum_{k=1}^{infty} frac{(-phi^{-1})^{k}}{k^2}= – text{Li}_2(-phi^{-1})
    $$
  4. $text{Li}_2$ has the following properties:
  • $text{Li}_2(x) + text{Li}_2(-x) = frac{1}{2}text{Li}_2(x^2)$
  • $text{Li}_2(x) + text{Li}_2(1-x) = zeta(2) – log(x)log(1-x)$
  • $text{Li}_2(1-x) + text{Li}_2(1-x^{-1}) = -frac{1}{2}log^2(x)$

Put $x=phi^{-1}$ and use $phi^2=phi+1$; this gives:
$$
text{Li}_2(phi^{-1}) + text{Li}_2(-phi^{-1}) = frac{1}{2}text{Li}_2(1-phi^{-1})
$$

$$
text{Li}_2(phi^{-1}) + text{Li}_2(1-phi^{-1}) = zeta(2) -2 log^2(phi)
$$

$$
text{Li}_2(1-phi^{-1}) + text{Li}_2(-phi^{-1}) =-frac{1}{2}log^2(phi)
$$

5. Relabel for clarity. Let $A=text{Li}_2(phi^{-1})$, $B=text{Li}_2(-phi^{-1})$, $C=text{Li}_2(1-phi^{-1})$, and $L= log^2(phi)$. This gives the system
$$
begin{cases}
A+ B & = frac{1}{2}C\
A+ C&= zeta(2)- 2L\
C+B &= -frac{1}{2}L
end{cases}
$$
Solving gives $B=-I_2=displaystyle{frac{1}{2}L-frac{2}{5}Z}$, whence $displaystyle{I = frac{pi^2}{15}}.$


I’d be curious to see if there are any other methods of proof, perhaps involving simpler substitutions than the ones I used.

calculus – Integral transform reduced?

I discovered that the following integrals are equal:

$$ int_0^1sx^{s-1}expbigg(frac{t}{log(x)}bigg)~dx=int_0^1expbigg(frac{st}{log(x)}bigg)~dx $$

Let $f^s(x)=x^s,$ then the LHS can be written as $$ int_0^1frac{d}{dx}bigg(x^sbigg)expbigg(frac{t}{log(x)}bigg)~dx$$

It reminds me of the Mellin transform on a bounded support.

Is the RHS a sort of Mellin transform in disguise?

It seems to be. This means that for a constant $r>0$ the following integral represents a Mellin transform where the only object in the integrand is the kernel:

$$ int_0^1 expbigg(frac{r}{log(x)}bigg)~dx $$

So for this specific kernel, I think it’s Mellin transform can be written only using the kernel itself.

Is that correct?

integration – Discard the Pettis integral over inequalities

Let $(E,leq)$ be a Partially Ordered Banach Space.

Let $X:=mathcal{C}(I,E)$ with $I:=(0,1)$.

Let $f:Itimes Erightarrow E$ be a function with $t mapsto f(t,x(t)) $ Pettis integrable
for each $xin X$.

Assume that there exists $x_1,x_2in X$ such that, $forall xin X,;forall tin I$: $$int_{0}^{t}f(s,x_1(s))ds leq int_{0}^{t}f(s,x(s))ds leq int_{0}^{t}f(s,x_2(s))ds.$$

May we discard the integral on the inequalities, and then $forall xin X,;forall tin I$: $$f(t,x_1(t))ds leq f(t,x(t))ds leq f(t,x_2(t))ds.$$

IF NOT, any counterexample is very welcomed.


N.T: I’m not very familiar with Pettis integration that deep, so my question may be not appropriate to MO.

numerics – How to verify the integral remainder of this integral formula?

The following questions are from the 2018 professional course test of numerical analysis of 武汉岩石所:

enter image description here

For the integral formula $int_{0}^{h} f(x) d x approx frac{h}{2}(f(0)+f(h))+alpha h^{2}left(f^{prime}(0)-f^{prime}(h)right)$:

1. We need to determine the value of $alpha$ to make it have the highest algebraic accuracy.
2. Suppose that the integrand f(x) has the fourth order continuous derivative, it needs to be verified that when $alpha=frac{1}{12}$, the integral remainder of this formula is $R(f)=frac{1}{720} h^{5} f^{(4)}(eta), quad eta in(0, h)$.

Outer(Construct, {h/2 &, h/2 #1 &, h/2 #1^2 &, h/2 #1^3 &}, {0, 
     h}).{1, 1} + 
  Outer(Construct, {0 &, α h^2/2 &, α h^2/
       2 2 #1 &, α h^2/2 3 #1^2 &}, {0, h}).{1, -1} == 
 Integrate({1, x, x^2, x^3}, {x, 0, h})

From the results of the above code, I can know that when $alpha=frac{1}{6}$, the integral formula $int_{0}^{h} f(x) d x approx frac{h}{2}(f(0)+f(h))+alpha h^{2}left(f^{prime}(0)-f^{prime}(h)right)$ has the highest algebraic accuracy. But for the second question, I don’t know how to verify it with MMA. I want to get as many methods as possible to verify the second problem.

calculus and analysis – Eliminate a variable within an integral

I have two expressions given by,

$$a = int_0^1 dx frac{c z_s^{d+1} x^d}{sqrt{(1-(z_s/z_h)^{d+1} x^{d+1})(1-c^2 z_s^{2d} x^{2d})}} tag{1}label{1},$$

$$S = int_epsilon^{z_s} dx frac{1}{x^d} sqrt{frac{1}{(1-(x/z_h)^{d+1})(1-c^2 x^{2d})}}tag{2}label{2},$$

where $c=c(z_s)$ is a function of $z_s$, and $a$, $z_h$ are constants which can be given a value later. $d$ is just a dimension parameter which can be given a value say, $d=3$.

The goal is to find an expression of $S$ such that $c$ is eliminated. Now, one condition which can help achieve that is,

$$frac{dS}{dz_s} = 0tag{3}label{3},$$

actually I need to find an expression for the minimal $S$ (with respect to $z_s$) to which $c$ dictates.


I have asked some related problems before but for eq. $eqref{2}$ in those cases I made a transformation $x=z_sy$ so that the integral limits there is $(epsilon/z_s,1)$ and then expand out the finite and divergent terms then I just showed the finite terms there so that I allow the lower limit to be 0.

Solving a function inside an integral

Smoothen the result of FindRoot

In this case, I just start with the original integral $eqref{2}$ and set a small number for $epsilon$ (this is just a modification of my previous problem in order to eliminate the divergence contribution but the result should not differ for those regions far from the divergence region).

The problem is when I try to plot those same quantities I get a different result.

The previous code,

d = 3;
zh = 1.5;
torootL(a_, c_?NumericQ, z_) := a - NIntegrate((c z^(d + 1) xd^(d/(d + 1)))/((1 - xd (z/zh)^(d + 1)) (1 - xd^((2 d)/(d + 1)) c^2 (z)^(2 d)))^(1/2), {xd, 0, 1}, MaxRecursion -> 12, PrecisionGoal -> 6, Method -> {"GlobalAdaptive", "SingularityHandler" -> "DoubleExponential"})
cz(a_?NumericQ, z_?NumericQ) := c /. FindRoot(torootL(a, c, z), {c, 0.001, 0.0000001, 1000})
intS(a_?NumericQ, z_?NumericQ) := NIntegrate(With({b = z/zh}, (((-1)/(d - 1)) cz(a, z)^2 z^(2 d)) x^d ((1 - (b x)^(d + 1))/(1 - cz(a, z)^2 (z x)^(2 d)))^(1/2) - ((b^(d + 1) (d + 1))/(2 (d - 1))) x ((1 - cz(a, z)^2 (z x)^(2 d))/(1 - (b x)^(d + 1)))^(1/2) + (b^(d + 1) x)/((1 - (b x)^(d + 1)) (1 - cz(a, z)^2 (z x)^(2 d)))^(1/2)), {x, 0, 1}, MaxRecursion -> 12, PrecisionGoal -> 6, Method -> {"GlobalAdaptive", "SingularityHandler" -> "DoubleExponential"})
functionS(a_, z_) = ((-((1 - cz(a, z)^2 z^(2 d)) (1 - (z/zh)^(d + 1)))^(1/2)/(d - 1)) + intS(a, z) + 1)/(4 z^(d - 1));
Plot(functionS(0.1, z), {z, 1, zh}, PlotPoints -> 8, AxesLabel -> {"z_s", "S"}, AxesStyle -> Directive(Black, 18), PlotStyle -> Thick, PlotRange -> Full, ImageSize -> Large) // Quiet // AbsoluteTiming

produces this plot,

pic1

The present code where I just changed the lines corresponding to the discussion I made above,

d = 3;
zh = 1.5;
torootL(a_, c_?NumericQ, z_) := a - NIntegrate((c z^(d + 1) xd^(d/(d + 1)))/((1 - xd (z/zh)^(d + 1)) (1 - xd^((2 d)/(d + 1)) c^2 (z)^(2 d)))^(1/2), {xd, 0, 1}, MaxRecursion -> 12, PrecisionGoal -> 6, Method -> {"GlobalAdaptive", "SingularityHandler" -> "DoubleExponential"})
cz(a_?NumericQ, z_?NumericQ) := c /. FindRoot(torootL(a, c, z), {c, 0.001, 0.0000001, 1000})

intS(a_?NumericQ, z_?NumericQ) := NIntegrate((1/x^d) (1/((1 - (x/zh)^(d + 1)) (1 - cz(a, z)^2 x^(2 d))))^(1/2), {x, 10^-10, z}, MaxRecursion -> 20, PrecisionGoal -> 6, Method -> {"GlobalAdaptive"})
functionS(a_, z_) = intS(a, z) + 1/(z^(d - 1));
Plot(functionS(0.1, z), {z, 1, zh}, PlotPoints -> 8, AxesLabel -> {"z_s", "S"}, AxesStyle -> Directive(Black, 18), PlotStyle -> Thick, PlotRange -> Automatic, ImageSize -> Large) // Quiet // AbsoluteTiming

produces the plot,

pic2

where the Method I used in the present is only GlobalAdaptive since if I use the Method in the old code it produces a flat line which I don’t know why. Anyways, the old and present codes should produce the same plot especially in those region close to $z_s = 1.5$ to which in the first image you can see a minimum occurring around $z_s approx 1.4$.


Why is this so? I’m still trying to understand the NIntegrate Integration Strategies documentation although it is hard to understand for me since I’m not a heavy user maybe until now.

I was thinking of maybe there is a different strategy to eliminate $c$ in the expression for $S$ using $eqref{1}$ $eqref{2}$ $eqref{3}$ at the same time. Any comments?

calculus and analysis – Having difficulty with what seems like a standard integral

I am fairly sure the integral I am trying to evaluate has an analytical solution and I am not used to Mathematica not finding the answer relatively easily, I have tried out a few tricks and transformations but doesn’t seem to evaluate it.

Here is the integral:

$$ F(x,y,z)=int_{r=0}^{r=R} int_{phi=0}^{phi=2pi}dr dphi left(frac{r}{sqrt{(z-delta)^2+(x-r cos(phi))^2+(y-r sin(phi))^2}}right)-left(frac{r}{sqrt{(z+delta)^2+(x-r cos(phi))^2+(y-r sin(phi))^2}}right)$$

Here is the code I use for it with assumptions clarified on these parameters (everything is real)

Integrate( r/Sqrt((z - (Delta))^2 + (x - r Cos((Phi)))^2 + (y - 
 r Sin((Phi)))^2) - r/  Sqrt((z + (Delta))^2 + (x - r Cos((Phi)))^2 + (y - 
 r Sin((Phi)))^2), {r, 0, R}, {(Phi), 0, 2 (Pi)})

I tried the integration with the following assumptions:

$ {x,y,z,R,delta} in Re $ and $ R>0,delta >0$.

Not sure if this is truly uncomputable or I am missing a simple transformation. Thank you for your suggestions!

numerical integration – Error in nonlinearmodel fit for a function with Definite Integral and complex number

I am trying to fit a function fun and Here is the code which I am trying, Please find the data here dataset

Data = Import(
   "E:\Shelender\codes\Mathematica\Aelastic 
relaxation\datat.asc");
real = Data((All, {1, 2}));
imag = Data((All, {1, 3}));
w = 1.26*10^8;
k = 1.38*10^-23;

f(H_, s_, d_) := ((1/(Sqrt(2*Pi)*s*H))*Exp((-(Log((H/d)))^2/(2*s^2))))
dynamic(x_?NumericQ, s_?NumericQ, d_?NumericQ, A_?NumericQ, 
  t_?NumericQ) := 
 A*(1 - NIntegrate(
     f(H, s, d)/((1 + (I*w*t*Exp(((H)/(k*x)))))), {H, 
      0, (Infinity)}))

fit = ResourceFunction("MultiNonlinearModelFit")(
   Rationalize({real, imag}, 0), 
   ComplexExpand(ReIm@dynamic(x, s, d, A, t)), 
   Rationalize({{A, 1.0*10^-4}, {t, 1.0*10^-12}, {d, 10}, {s, 0.25}}, 
    0), {x}, PrecisionGoal -> 3, AccuracyGoal -> 3);

fit("ParameterTable")
Show(ListPlot({real, imag}), 
 Plot({fit(1, x), fit(2, x)}, {x, 0, 
   Max(real((All, 1)), imag((All, 1)))}, PlotRange -> All), 
 PlotRange -> All)

Although I am not getting any error but fit values are completely off

How can I solve this Integral?

I have a two variables function. I have to numerically integrate this function with respect to one of the variables (tau) and assume the other variable (t) is constant. Note, however, that the upper limit of the integral is t.

(Lambda)0 = 2*Pi*10*10^6; t0 = (Sqrt(2)*Pi)/(Lambda)0; T = 250/10^9; 
(Sigma) = T/8; 
 g0(t_, (Tau)_) = ((Lambda)0/Sqrt(2))*Sech(((t - (Tau)) - 0.5*T)/(Sigma)); 
 s(t_, (Tau)_) = 1 + Tanh(((t - (Tau)) - 0.5*T)/(Sigma)); 
 g1(t, (Tau)) = g0(t, (Tau))*Sin((Pi/4)*s(t, (Tau))); 
 g2(t, (Tau)) = g0(t, (Tau))*Cos((Pi/4)*s(t, (Tau))); 
 NIntegrate(g1(t, (Tau)), {(Tau), 0, t})

integration – What is the derivative w.r.t. the boundary in the following integral?

I want to solve the following derivation problem:

$ frac{d}{dc}int_{0}^{c-z}(c-x)dG(x) $

I know that in general, $frac{d}{dc}int_{0}^{g(c)}f(x)dx=f(c)times g'(c)$. Here, however, both the boundary and the integrand is a function of $c$. Furthermore, what is the implication of having $dG(x)$ instead of just $dx$?

In advance – thank you for any help!

Best,
Fredrik