Message Boards Message Boards


Line integral with Wolfram|Alpha?

Posted 8 months ago
15 Replies
4 Total Likes

Hey there! I would like to calculate a Line integral such as e^zcos(piz)/(z^2+z) through to |z|=1

How can I do that with Wolfram?

15 Replies

Please use spaces and parentheses to clarify the complex function. For example, does piz mean Pi z? And does the formula involve Exp[z] or Exp[z Cos[Pi z]]?

Also, do you mean to integrate around the circle Abs[z]==1?

Did you try to parametrize the circle and reduce the line integral to an ordinary integral (of a complex-valued function of a real variable)?

Posted 8 months ago

Hey! thanks for trying to help me. I will clarify the function: exp(z)*cos(pi * z)/(z^2+2) around abs(z), How would you insert that in the Wolfram!Alpha?

Is the denominator z^2 + 2 or z^2 + z?

I suspect that Wolfram|Alpha cannot directly evaluate a contour integral, but that you will have to do the first step yourself, namely, parameterizing the contour (in the standard way?), etc.

I did do the usual parameterization to evaluate the integral, but using Mathematica and found it was divergent.

Integrate works with complex numbers. For this region you can simply let $z=e^{it}$ for $t\in[0,2\pi)$. Does this work?

Integrate[(E^z Cos[\[Pi] z])/(z^2 + z) /. z -> Exp[I t],{t,0,2\[Pi]}]

Your integrand is divergent at $z=-1$, and Mathematica correctly finds that it is divergent. If you're looking for the residue, try

Integrate[(E^z Cos[\[Pi] z])/(z^2 + z) /. z -> .5 Exp[I t],{t,0,2\[Pi]}]

where I have replaced $z$ with $.5e^{it}$ to avoid any other poles.

Am I missing something -- didn't you neglect to insert the dz multiplier after the parameterization?

Effectively I'm letting $z(t)=.5e^{it}$, and computing $\int_0^{2\pi}\frac{\exp(z(t))\cos(\pi z(t))}{z(t)^2+z(t)}dt$. The parameter of integration and its bounds are specified by {t,0,2\[Pi]}, just notation. Mathematica can typeset it nicely too, though with

With[{z=Exp[I t]}, Inactive@Integrate[(E^z Cos[\[Pi] z])/(z^2 + z),{t,0,2\[Pi]}]]

On the subject of contour integrals, I suppose Mathematica can't handle complex regions--most of their Region related functions are explicitly $\mathbb R^n$. That being said, it handles arbitrary real regions as integration bounds no problem, and even some basic complex bounds (ha) like piecewise linear or circular, consider (from the docs)

Integrate[1/(z + 1/2), {z, 1, E^((I \[Pi])/3), E^((2 I \[Pi])/3), -1, E^(-((2 I \[Pi])/3)), E^(-((I \[Pi])/3)), 1}]

Definition (or formula from a theorem) of contour integral of complex function $f(z)$ over a contour $C$: let $\gamma: [a, b] \rightarrow \mathbb{C}$ be a parameterization of $C$. Then $\int_C f(z) dz = \int _a^b f(\gamma(t)) \gamma'(t) dt$.

Your expression for the integral seems to be missing the factor $ \gamma'(t)$, which for $\gamma(t) = 0.5 e^{i t}$ should be $0.5 i e^{i t}$.

Yes, I forgot this! My bad. Proper code is

Integrate[Unevaluated@D[z,t](E^z Cos[\[Pi] z])/(z^2+z) /. z -> .5 Exp[I t],{t,0,2\[Pi]}]

though it appears to not be able to find the closed form and just approximates $2\pi i$. And the previous code yielding 0 is a dead giveaway.

I guess this is a standard example for the use of residues! The function

f[z_] := Exp[z]*Cos[Pi*z]/(z^2 + z)

has two poles:

poles = Solve[z^2 + z == 0, z]
(*  Out:  {{z\[Rule]-1},{z\[Rule]0}}  *)

The one at z=-1 is on the contour:

ComplexPlot3D[f[z], {z, -1.1 - 1 I, 1 + 1 I}, RegionFunction -> (Abs[#] <= 1 &), BoxRatios -> {Automatic, Automatic, 1}]

enter image description here

The respective residues are:

Residue[f[z], {z, #}] & /@ {0, -1}
(*  Out:   {1,1/\[ExponentialE]}   *)

So - according to residue theorem - we find for the line integral along Abs[z]==1 (the residue on the pole counts half!):

2 Pi I (1 + 1/(2 E))

But Mathematica can actually handle those integrals directly; because of the pole on the contour the option PrincipalValue -> True is needed:

Integrate[f[Exp[I \[Phi]]] I Exp[I \[Phi]], {\[Phi], 0, 2 Pi}, PrincipalValue -> True]
(*  Out:   \[ImaginaryI] (2+1/\[ExponentialE]) \[Pi]  *)

Counting the residue at the pole on the contour itself seems to require a bit of justification, as in answers to:

Counting the residue at the pole on the contour itself seems to require a bit of justification, ...

Well, yes! But the pole in question is of first order, the path of integration is sufficiently well behaving, and in those cases the calculation (I think / I learned at school) is that simple. Or do you disagree with the result?

I do not disagree with the result, but rather meant to suggest that some kind of rigorous justification is really needed for such things, as in the math.stackexchange reference I cited.

It should be emphasized that this path integral actually is divergent, and only exists in the sense of a principal value integration.

Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
or Discard

Group Abstract Group Abstract