Special Relativity

Special Relativity preview image

1 collaborator

Jose_valenzuela Jose Valenzuela (Author)

Tags

(This model has yet to be categorized with any tags)
Visible to everyone | Changeable by everyone
Model was written in NetLogo 5.2.0 • Viewed 339 times • Downloaded 36 times • Run 0 times
Download the 'Special Relativity' modelDownload this modelEmbed this model

Do you have questions or comments about this model? Ask them here! (You'll first need to log in.)


Comments and Questions

Please start the discussion about this model! (You'll first need to log in.)

Click to Run Model

;;Special Relativity Simulation


;;Defines Global variables
Globals
[gamma
  t
  rocket1-time
  rocket2-time
  rocket-size-%]


;;Sets the environment

to setup                                     
  
  clear-all                                                                                            
  imPort-drawing "space-09.jPg"    
  setup-rockets                                      
  set t 0
end 

;;Creates the rockets
breed [rocket1]
breed [rocket2]

to setup-rockets
  
  create-rocket1 1
  set-default-shape turtles "rocket1"
  ask rocket1 [
   set size (8)
   setxy 2 3
   set color red
   set heading 90]
  
   create-rocket2 1
  set-default-shape turtles "rocket2"
  ask rocket2 [
;;Let 8 be the proper lenght of the object
   set size (8)
   setxy 2 -2
   set color blue
   set heading 270]
end 


;;Makes the rockets go

to go
  
  ask rocket1 [set heading 90]
 
  ask rocket2 [set heading 270
              forward (RelativeSpeed ) ]
;;The relative speed input by the user is enter as a fraction of the speed of light. 
;;Each tick the rockets moves 1 light year.  
  
;;Sets Value for Gamma
  set gamma sqrt(1 - ( RelativeSpeed ^ 2 )) 
  
  calculate-lenght-contraction
  calculate-time-dilatation
  
  set t (t + 1)
end 


;;Calculate the lenght depending on the relativistic speed

to calculate-lenght-contraction
  
  ask rocket2
  [set size ( 8 * gamma)
   set rocket-size-% (size / 8) * 100]
  ;;Note the Proper lenght of the object is 8 light years long. 
end 


;;Calculates the time dilation of the object. 

to calculate-time-dilatation
  
  set rocket1-time  (t)
  set rocket2-time  ( (t) / gamma )
end 

;;By Jose Vanir Valenzuela

There is only one version of this model, created about 9 years ago by Jose Valenzuela.

Attached files

File Type Description Last updated
Special Relativity.png preview Preview for 'Special Relativity' about 9 years ago, by Jose Valenzuela Download

This model does not have any ancestors.

This model does not have any descendants.