Diese Datei stammt aus Wikimedia Commons und kann von anderen Projekten verwendet werden. Die Beschreibung von deren Dateibeschreibungsseite wird unten angezeigt.
English: This file recreates this file, except this one is free of copyright restrictions. I created it myself by writing an own script in Python, and I release it under CC0.
The animation shows the effect of Lorentz transform used in theory of relativity. An observer moving along a world line (red) is shown along with random events in space-time (black dots). The diagonal grey lines indicate the speed of light. Compare this to Galilean transform.
# space transformation animation in Python# by Drummyfish# released under CC0 1.0fromPILimportImageimportrandomimportmathTRANSFORM_TYPE=0# 0 = galileian, 1 = lorentzSPEED_OF_LIGHT=1SIZE=256TRAJECTORY=(" l \n"" l \n"" l \n"" l \n"" l \n"" l \n"" l \n"" l \n"" l \n"" l \n"" l \n"" l \n"" l \n"" l \n"" l \n"" l \n"" l \n"" l \n"" l \n"" l \n"" l \n"" l \n"" l \n"" l \n"" l \n"" l \n"" l \n"" l \n"" l \n"" l \n"" l \n"" l \n"" l \n"" l \n"" l \n"" l \n"" l \n"" l \n"" l \n"" l \n"" l \n"" l \n"" l \n"" l \n"" l \n"" l \n"" l \n"" l \n"" l \n"" l \n"" l \n"" l \n"" l \n"" l \n"" l \n"" l \n"" l \n"" l \n"" l \n"" l \n"" l \n"" l \n"" l \n"" l \n"" l \n"" l \n"" l \n"" l \n"" l \n"" l \n"" l \n"" l \n"" l \n"" l \n"" l \n"" l \n"" l \n"" l \n"" l \n"" l \n"" l \n"" l \n"" l \n"" l \n"" l \n"" l \n"" l \n"" l \n"" l \n"" l \n"" l \n"" l \n"" l \n"" l \n"" l \n"" l \n"" l \n"" l \n"" l \n"" l \n"" l \n"" l \n"" l \n"" l \n"" l \n"" l \n"" l \n"" l \n"" l \n"" l \n"" l \n"" l \n"" l \n"" l \n"" l \n"" l \n"" l \n"" l \n"" l \n"" l \n"" l \n"" l \n"" l \n"" l \n"" l \n"" l \n"" l \n"" l ")TRAJECTORY_POINTS=[(i.find("l")-20)*0.5foriinTRAJECTORY.split("\n")]TRAJECTORY_POINTS.reverse()random.seed(35)EVENTS=[(random.randrange(SIZE*40)-20*SIZE,random.randrange(len(TRAJECTORY_POINTS)))foriinrange(500)]defdraw_square(pixels,x,y,r,c):x-=r/2y-=r/2x2=x+ry2=y+rx=max(0,x)y=max(0,y)x2=min(SIZE-1,x2)y2=min(SIZE-1,y2)forjinrange(y,y2):foriinrange(x,x2):pixels[i,j]=cdeftransform_galilean(relative,velocity):return(int(relative[0]-velocity*relative[1]),relative[1])deftransform_lorentz(relative,velocity):sol2=SPEED_OF_LIGHT*SPEED_OF_LIGHTfactor=1.0/math.sqrt(1.0-velocity*velocity/sol2)return(int(factor*(relative[0]-velocity*relative[1])),int(factor*(relative[1]-(velocity*relative[0])/sol2)))defdraw_event(relative_event,velocity,pixels,color,size):transformed=transform_galilean(relative_event,velocity)ifTRANSFORM_TYPE==0elsetransform_lorentz(relative_event,velocity)screen=(SIZE/2+transformed[0],SIZE/2-transformed[1])draw_square(pixels,screen[0],screen[1],size,color)image=Image.new("RGB",(SIZE,SIZE),"white")pixels=image.load()v_previous=0forfinrange(len(TRAJECTORY_POINTS)):# for each frameforjinrange(SIZE):# clear the canvasforiinrange(SIZE):relative_y=SIZE/2-jhelper_line=(relative_y==0)or(relative_y%32==0andi%4==0)ifTRANSFORM_TYPE==1:relative_x=SIZE/2-iifabs(relative_x/float(relative_yifrelative_y!=0else0.0001))==SPEED_OF_LIGHT:helper_line=Truepixels[i,j]=(200,200,200)ifhelper_lineelse(255,255,255)x=TRAJECTORY_POINTS[f]# compute average velocity over several trajectory points, for smooth movement:avg=10weight_sum=0v=0forninrange(avg):index=f-n+avg/2weight=avg/2-abs(avg/2-n)+1v+=weight*(TRAJECTORY_POINTS[(index+1)%len(TRAJECTORY_POINTS)]-TRAJECTORY_POINTS[index%len(TRAJECTORY_POINTS)])weight_sum+=weightv=v/float(weight_sum)v=(v+v_previous)/2.0# this smooths accelerationv_previous=vforkinrange(-2,3):# draw eventsforeinEVENTS:relative=(e[0]-x,e[1]-f+k*len(TRAJECTORY_POINTS))draw_event(relative,v,pixels,(0,0,0),3)forninrange(SIZE):# draw the trajectoryindex=n-SIZE/2trajectory_index=(f+index)%len(TRAJECTORY_POINTS)relative=(TRAJECTORY_POINTS[trajectory_index]-x,index)draw_event(relative,v,pixels,(255,0,0),2)draw_square(pixels,SIZE/2,SIZE/2,7,(0,0,255))# draw the observerimage.save("out"+str(f).zfill(4)+".png")# save the frame
Lizenz
Ich, der Urheber dieses Werkes, veröffentliche es unter der folgenden Lizenz:
Die Person, die das Werk mit diesem Dokument verbunden hat, übergibt dieses weltweit der Gemeinfreiheit, indem sie alle Urheberrechte und damit verbundenen weiteren Rechte – im Rahmen der jeweils geltenden gesetzlichen Bestimmungen – aufgibt. Das Werk kann – selbst für kommerzielle Zwecke – kopiert, modifiziert und weiterverteilt werden, ohne hierfür um Erlaubnis bitten zu müssen.
http://creativecommons.org/publicdomain/zero/1.0/deed.enCC0Creative Commons Zero, Public Domain Dedicationfalsefalse
Kurzbeschreibungen
Ergänze eine einzeilige Erklärung, was diese Datei darstellt.
animation showing the Lorentz transformation used in theory of relativity
Diese Datei enthält weitere Informationen, die in der Regel von der Digitalkamera oder dem verwendeten Scanner stammen. Durch nachträgliche Bearbeitung der Originaldatei können einige Details verändert worden sein.
GIF-Dateikommentar
created with GIMP by Drummyfish, released under CC0