Ask Your Question
0

Residue in complex analysis

asked 2019-12-19 15:53:57 +0200

anonymous user

Anonymous

  1. is there a way to compute the residue of a meromorphic function $f(z)$ at $z=z_0$ in sage?
  2. if so, I'd like to nest such method to compute residue at a flag, $$ \operatorname{Res}_F f(x_1,\ldots,x_n) := \operatorname{Res}_{x_1=x_1^,\ldots,x_n=x_n^}\cdots\operatorname{Res}_{x_2=x_2^, x_1=x_1^} \operatorname{Res}_{x_1=x_1^} f(x_1,\ldots,x_n)$$ where starred values denote a numerical value (same as $z_0$ before) and the flag is $$F =([x_1=x_1^,\ldots,x_n=x_n^] \supset \cdots \supset [x_2=x_2^, x_1=x_1^] \supset [x_1=x_1^])$$ Notice the choice of order matters. For example, let $f = \frac1{(1-x_1)(1-x_1 x_2)}$ and $F = ( [x_1=1] \subset [x_2=1, x_1=1])$. Then $$ \operatorname{Res}_F f(x_1,x_2) = 1$$
  3. if that works, I'd like to build a function that takes as input the point $(x_1,\ldots,x_n)^*$, for various values of $n$, builds $f$ in a certain way, and gives back the residue as a function of the input: is this achievable?
edit retag flag offensive close merge delete

3 Answers

Sort by ยป oldest newest most voted
2

answered 2019-12-20 08:37:59 +0200

Emmanuel Charpentier gravatar image

Partial answer : your second question is not legible, and the third doesn't make sanse without the second.

Maxima has a residue function :

(%i2) ? residue


 -- Function: residue (<expr>, <z>, <z_0>)

     Computes the residue in the complex plane of the expression <expr>
     when the variable <z> assumes the value <z_0>.  The residue is the
     coefficient of '(<z> - <z_0>)^(-1)' in the Laurent series for
     <expr>.

          (%i1) residue (s/(s**2+a**2), s, a*%i);
                                          1
          (%o1)                           -
                                          2
          (%i2) residue (sin(a*x)/x**4, x, 0);
                                           3
                                          a
          (%o2)                         - --
                                          6

(\%o2) \mathbf{true}

which can be called via the maxima_methods() interface:

sage: (1/x).maxima_methods().residue(x,0)
1
sage: (1/x).maxima_methods().residue(x,1)
0
sage: tan(x).maxima_methods().residue(x,pi/2)
-1
sage: tan(x).maxima_methods().residue(x,0)
0

HTH,

edit flag offensive delete link more

Comments

For some reason my code above does not work. I noticed the residue in maxima, but it does not seem to work consistently.

rue82 gravatar imagerue82 ( 2019-12-27 22:07:46 +0200 )edit

it does not seem to work consistently.

Whaddayamean ?

Emmanuel Charpentier gravatar imageEmmanuel Charpentier ( 2019-12-27 22:48:50 +0200 )edit

var('x','t') (1/(t^2 - t + x)).maxima_methods().residue(t,(1+sqrt(1-4*x))/2) gives zero.

rue82 gravatar imagerue82 ( 2019-12-31 20:49:48 +0200 )edit
2

answered 2019-12-29 09:59:07 +0200

nbruin gravatar image

updated 2019-12-29 17:38:13 +0200

There's a residue method on symbolic expressions which is documented to do the thing you want, but of course you should check that it does indeed do what you want.

I think you can use:

k=3
br(x)=sqrt(x)-sqrt(1/x)
q1,q2=var('q1,q2')
X=var('x_0,x_1,x_2')
rho=[1,q1,q2]
chi=1/prod([ br(X[j])*br(q1/X[j])*X[j]*br(q2/X[j]) for j in range(k)])
[chi.residue(xi==rhoi) for xi,rhoi in zip(X,rho)]

or, if as in the example that you posted as an answer to the question here, you really want to take the residues iteratively,

for xi,rhoi in zip(X,rho):
    chi = chi.residue(xi,rhoi)
print chi

it returns almost instantaneously for me. You may want to simplify the answer a bit, with something like chi.factor() or so.

edit flag offensive delete link more

Comments

This looks nice, thanks. Last part should have again xi==rhoi. For reference, I edited my answer below, with your suggestion and the actual function I want to use.

rue82 gravatar imagerue82 ( 2019-12-31 20:56:30 +0200 )edit
0

answered 2019-12-27 22:15:30 +0200

rue82 gravatar image

updated 2019-12-31 21:14:08 +0200

I write here the function I had in mind, using the solution I found:

 def br(x):
 return sqrt(x)-sqrt(1/x)

 import sympy as sp
 k=3
 q1,q2 = var('q1,q2')
 X = sp.symbols('x_0:{}'.format(k))
 rho = [1,q1,q2]
 chi = 1/prod([ br(X[j])*br(q1/X[j])*X[j]*br(q2/X[j]) for j in range(k)])
 for i in range(k):
     chi = sp.residue(chi,X[i],rho[i])
 chi

The problem is that even for a stupid example such as the one above, it takes forever to compute it.

Here's the same (with the actual function I need), using the above suggested answer:

k=3
br(x)=sqrt(x)-sqrt(1/x)
q1,q2,q3,m=var('q1,q2,q3,m')
# X=var('x_0,x_1,x_2')
# X=var('x_0:{}'.format(k))
X = [var("x%d" % i) for i in range(k)]
rho=[1,q1,q2]
# rho=[1,q1]
chi1 = prod([ br(X[j]/m)/(br(X[j])*X[j]) for j in range(k)])
chi2 = prod([prod([br(q1*q2*X[i]/X[j])*br(q1*q3*X[i]/X[j])*br(q2*q3*X[i]/X[j]) for i in range(k) if i != j]) for j in range(k)])
chi3 = prod([prod([br(q1*X[i]/X[j])*br(q2*X[i]/X[j])*br(q3*X[i]/X[j])*br(q1*q2*q3*X[i]/X[j]) for i in range(k) if i != j]) for j in range (k)])
chi = chi1*chi2/chi3
for xi,rhoi in zip(X,rho):
    chi = chi.residue(xi==rhoi)
print chi.factor()

This gives zero (wrong) for k=3 (unless I made a stupid mistake) and it is still slow, but faster than sympy for k=2.

edit flag offensive delete link more

Comments

Your "stupid example" isn't stupid: finding a series for sqrt(x)) at x=0 involves Laurent series... It's more of a pathological example...

Emmanuel Charpentier gravatar imageEmmanuel Charpentier ( 2019-12-27 23:13:14 +0200 )edit

Well, residue is coeff -1 of Laurent series, right?

rue82 gravatar imagerue82 ( 2019-12-31 20:50:39 +0200 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

2 followers

Stats

Asked: 2019-12-19 15:53:57 +0200

Seen: 1,102 times

Last updated: Dec 31 '19