#--------------# # Blatt 10 # #--------------# # Aufgabe 1e) n = 1000 theta = seq(0,pi,length=n) Y00 = sqrt(1/4/pi) Y10 = sqrt(3/4/pi)*( cos(theta) ) Y11 = sqrt(3/8/pi)*( sin(theta) ) Y20 = sqrt(5/16/pi)*( 3 * (cos(theta))^2 - 1 ) Y21 = sqrt(15/8/pi)*( cos(theta) * sin(theta) ) Y22 = sqrt(15/32/pi)*( sin(theta) * sin(theta) ) x00 = abs(Y00)^2 * sin(theta) z00 = abs(Y00)^2 * cos(theta) x10 = abs(Y10)^2 * sin(theta) z10 = abs(Y10)^2 * cos(theta) x11 = abs(Y11)^2 * sin(theta) z11 = abs(Y11)^2 * cos(theta) x20 = abs(Y20)^2 * sin(theta) z20 = abs(Y20)^2 * cos(theta) x21 = abs(Y21)^2 * sin(theta) z21 = abs(Y21)^2 * cos(theta) x22 = abs(Y22)^2 * sin(theta) z22 = abs(Y22)^2 * cos(theta) par(mfrow=c(2,3)) info = "polar plot |Y00|^2" plot(x00,z00,xlim=c(-0.4,0.4),ylim=c(-0.4,0.4),main=info) points(-x00,z00) info = "polar plot |Y10|^2" plot(x10,z10,xlim=c(-0.4,0.4),ylim=c(-0.4,0.4),main=info) points(-x10,z10) info = "polar plot |Y11|^2" plot(x11,z11,xlim=c(-0.4,0.4),ylim=c(-0.4,0.4),main=info) points(-x11,z11) info = "polar plot |Y20|^2" plot(x20,z20,xlim=c(-0.4,0.4),ylim=c(-0.4,0.4),main=info) points(-x20,z20) info = "polar plot |Y21|^2" plot(x21,z21,xlim=c(-0.4,0.4),ylim=c(-0.4,0.4),main=info) points(-x21,z21) info = "polar plot |Y22|^2" plot(x22,z22,xlim=c(-0.4,0.4),ylim=c(-0.4,0.4),main=info) points(-x22,z22) # zu Aufgabe 3) dx = 10^(-3) x = seq(from=-1+dx, to=1-dx, by=dx) Q = 1/2*log( (1+x)/(1-x) ) P1 = x P3 = (5*x^3-3*x)/2 c1 = sum(Q*P1)*dx c1 # 1, nicht 0.. c3 = sum(Q*P3)*dx c3 # 1/6, nicht 0 require(gsl) # hat Legendre-Polynome ?gsl plot(x,legendre_Pl(3,x)) # ok, geht.. m = 9 par(mfrow=c(3,3)) X = legendre_Pl(0,x) for(k in 1:m) { X = cbind( X , legendre_Pl(k,x) ) res = lm( Q ~ -1+X ) info = paste("ell =",k) plot(x,Q,main=info) points(x,res\$fit,col="red",cex=0.75) #readline() }