1
$\begingroup$

I have the intgeral $$f(z_{0}) = \int_{z_{0}}^{\infty} |z| \exp(- a z^{2}) \, \mathrm{d}z$$

Which I compute with

Integrate[Abs[z] Exp[- a z^2], {z, z0, Infinity}]

which returns

\!\(
\*SubsuperscriptBox[\(\[Integral]\), \(z0\), \(\[Infinity]\)]\(\(
\*SuperscriptBox[\(E\), \(\(-a\)\ 
\*SuperscriptBox[\(z\), \(2\)]\)]\ Abs[z]\) \[DifferentialD]z\)\)

which is simply the symbolic form of my input. However if I now turn my integral into a function with Èvaluate with

IntegralFunction[a_, z0_] := Evaluate[Integrate[Abs[z] Exp[- a z^2], {z, z0, Infinity}]]

And then plot with some values

Plot[IntegralFunction[1, z0], {z0, -1, 1}]

enter image description here

You can see we can a result.

Why does this integral not return a symbolic result? Is this integral simply ill defined? Why does Plot return something, is it basically calling NIntegrate to do the plot?

$\endgroup$
4
  • 1
    $\begingroup$ That explains that bit! I guess Mathematica can't solve the Abs[z] bit, I suppose the solution is to use piecewise? $\endgroup$
    – user27119
    Commented Mar 24, 2020 at 23:10
  • $\begingroup$ Plot works because IntegralFunction returns numbers, which can be plotted. For example, IntegralFunction[1, -1] is a number. Indeed, Integrate[Abs[z] Exp[-a z^2], {z, -1, Infinity}] returns a conditional expression based on the sign of the real part of a. $\endgroup$
    – bill s
    Commented Mar 24, 2020 at 23:30
  • $\begingroup$ NIntegrate it is then! $\endgroup$
    – user27119
    Commented Mar 24, 2020 at 23:59
  • 1
    $\begingroup$ For real z, Abs[z] == Sqrt[z^2] then Integrate[Sqrt[z^2] Exp[-a z^2], {z, z0, Infinity}] $\endgroup$
    – Bob Hanlon
    Commented Mar 25, 2020 at 3:18

1 Answer 1

4
$\begingroup$

It's because when you give numbers for the parameters, Integrate need not assume they are complex numbers of unknown value. You can use assumptions to tell it enough to do the integral symbolically:

Assuming[ a > 0 && Element[z0, Reals], 
   Integrate[Abs[z] Exp[-a z^2], {z, z0, Infinity}]]

yields

Piecewise[{{1/(E^(a*z0^2)*(2*a)), z0 >= 0}},
           (-1 + 2*E^(a*z0^2))/(E^(a*z0^2)*(2*a))]
$\endgroup$
1
  • $\begingroup$ Give that man a coconut! $\endgroup$
    – user27119
    Commented Mar 25, 2020 at 0:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.