---------------- # Aufgabe 2b # ---------------- hochzahl = (-8):8 r = 10^hochzahl r # wir nehmen 10^(-8) bis 10^8 = 100 Mio n = 100000 phi = seq(from=0,to=pi,length=n) for(rr in r) { z = rr*exp(1i*phi) dz = diff(z) z = z[-1] fz = exp(1i*z)/z result = sum( fz*dz ) print(result) } # checken wir noch das reelle Integral # int_{-infty}^{infty} sin(x)/x xmax = 10000 x = seq( from=-xmax, to=xmax, by=0.001 ) dx = diff(x) x = x[-1] fx = ifelse( x^2>0 , sin(x)/x , 1 ) sum( fx*dx )