IntFormel := proc (F::procedure, a::complex, r::realcons) 
  local Nenner,Zaehler,Nenn,Nullstellen,Innen,Aussen,Peripherie,R,Kreis,Pfeil, 
        Mitte,Punkte,dots,Gebiet,tplot,g,TICKS,zeta,q,H,z,t,Abl,c1,c2,p; 
  Zaehler := numer(F(z)); Nenner := denom(F(z)); 
  Nullstellen := [solve(Nenner)];
  for zeta in Nullstellen while true do 
    if type(zeta,RootOf) then 
      error "Maple hat nicht alle Nullstellen gefunden." end if 
  end do; 
  Nenner := lcoeff(Nenner)*mul(z-zeta,zeta = Nullstellen); 
  Innen  := select(z -> is(abs(z-a) < r),Nullstellen); 
  Aussen := select(z -> is(r < abs(z-a)),Nullstellen); 
  Peripherie := select(z -> abs(z-a) = r,Nullstellen); 
  if Peripherie <> [] then 
    error "Nullstelle des Nenners auf dem Integrationsweg!" end if; 
  if Aussen = [] then R := 1/2*(1+sqrt(5))*r 
    else R := min(seq(`@`(evalc,abs)(z-a),z = Aussen)) end if; 
  
  read "../verdi.txt"; 
  g := t -> a+r*exp(Complex(1)*t); 
  c1 := 0.11; c2 := 0.02; 
  Kreis := complexplot(g,0 .. 2*Pi,color = black); 
  Pfeil := pfeil(g,Pi-1/2*c1*R/r,c1*R,black); 
  Mitte := disk(c2p(a),c2*R,color = white,style = patchnogrid); 
  dots := seq(disk(c2p(z),.8*c2*R,color = black),z = Nullstellen);
  Gebiet := disk(c2p(a),R,color = gray,style = patchnogrid); 
  tplot := textplot([Re(a)+1.18*r, Im(a), "C"]); 
  Punkte := [op(Nullstellen), a]; 
  TICKS := tickmarks= [[seq(evalf(Re(z)) = convert(Re(z),string),z = Punkte)], 
  [seq(evalf(Im(z)) =convert(Im(z),string),z = Punkte)]]; 
  p := display(Pfeil,Kreis,Mitte,dots,Gebiet,tplot,TICKS,axes = frame,
       thickness = 2,scaling = constrained); 

  Abl := diff(Nenner,z); 
  for zeta in Innen while true do 
    if subs(z = zeta,Abl) = 0 then
      error "Einfache Integralformel nicht anwendbar!" end if 
  end do; 
  q := mul(z-zeta,zeta = Innen); 
  H := normal(Zaehler*q/Nenner); 
  add(subs(z = zeta,normal(H*(z-zeta)/q)),zeta = Innen); 
  [simplify(evalc(Complex(2)*Pi*%)), p] 
end proc;

IntFormel_2 := proc (F::procedure, a::complex, r::realcons) 
  local Nenner, Zaehler, Nenn, Nullstellen, Innen, Aussen, Peripherie, R, 
        Kreis, Pfeil, Mitte, Punkte, dots, Gebiet, tplot, g, TICKS, folge, 
        j, zeta, q, h, H, v, V, w, z, c1, c2, p, M_Innen, Vfh, Folge; 
  Zaehler := numer(F(z)); Nenner := denom(F(z)); 
  Nullstellen := [solve(Nenner)]; 
  for zeta in Nullstellen while true do 
    if type(zeta,RootOf) then 
      error "Maple hat nicht alle Nullstellen gefunden." end if 
  end do; 
  Nenner := lcoeff(Nenner)*mul(z-zeta,zeta = Nullstellen); 
  Innen  := select(z -> is(abs(z-a) < r),Nullstellen); 
  Aussen := select(z -> is(r < abs(z-a)),Nullstellen); 
  Peripherie := select(z -> abs(z-a) = r,Nullstellen); 
  if Peripherie <> [] then 
    error "Mindestens eine Nullstelle des Nenners auf dem Integrationsweg." end if; 
  if Aussen = [] then R := 1/2*(1+sqrt(5))*r 
    else R := min(seq(`@`(evalc,abs)(z-a),z = Aussen)) end if; 

  read "../verdi.txt"; 
  g := t -> a+r*exp(Complex(1)*t); 
  c1 := 0.11; c2 := 0.02; 
  Kreis := complexplot(g,0 .. 2*Pi,color = black); 
  Pfeil := pfeil(g,Pi-1/2*c1*R/r,c1*R,black); 
  Mitte := disk(c2p(a),c2*R,color = white,style = patchnogrid); 
  dots := seq(disk(c2p(z),.8*c2*R,color = black),z = Nullstellen); 
  Gebiet := disk(c2p(a),R,color = gray,style = patchnogrid); 
  tplot := textplot([Re(a)+1.18*r, Im(a), "C"]); 
  Punkte := [op(Nullstellen), a]; 
  TICKS := tickmarks = [[seq(evalf(Re(z)) = convert(Re(z),string),z = Punkte)], 
                        [seq(evalf(Im(z)) = convert(Im(z),string),z = Punkte)]]; 
  p := display(Pfeil,Kreis,Mitte,dots,Gebiet,tplot,TICKS,axes = frame,
               thickness = 2,scaling = constrained); 

  M_Innen := convert(convert(Innen,set),list); 
  seq(select(u -> u = v,Innen),v= M_Innen); map(nops,[%]); 
  Vfh := zip((x, y) -> [x, y],M_Innen,%); 
  q := mul((z-zeta[1])^zeta[2],zeta = Vfh); 
  H := unapply(normal(Zaehler*q/Nenner),z); 

  Folge := NULL; 
  for zeta in Vfh while true do 
    h := unapply(normal((z-zeta[1])^zeta[2]/q),z); 
    for j from 0 to zeta[2]-1 do 
      `@@`(D,j)(h)(zeta[1])/j!; `@@`(D,zeta[2]-1-j)(H)(zeta[1])/(zeta[2]-1-j)!; 
      Folge := Folge, %*`%%` 
  end do end do; 
  add(w,w= [Folge]); 
  [simplify(evalc(Complex(2)*Pi*%)), p] 
end proc;
