Wednesday, March 18, 2015

Gravitate

Here's a python script "gravitate.py" that I wrote based on the "bouncing balls" demo at:
https://python4astronomers.github.io/contest/bounce.html

This script qualitatively illustrates the gravitational motion of massless test particles in response to two uniform-density spherical potentials of radius R=1 and mass M=1.  In units where G=1 as well, the acceleration outside the spheres is 1/d^2, and within the spheres is ((d/R)^3)/d^2 = d/R^3 = d.

Notice that the structures which have collapsed by the end of the script are elongated as expected.

Updated: script below runs in ipython.

# run using:
# ipython --pylab
# execfile("gravitate.py")
#
# ..."ipython --pylab" should do the following, according to http://ipython.org/ipython-doc/2/api/generated/IPython.core.magics.pylab.html?highlight=pylab
# import numpy as np
# from matplotlib import pyplot as plt
# from matplotlib import pylab, mlab
# from IPython.display import display
# from IPython.core.pylabtools import figsize, getfigs
#
figure(1) # change number to create new fig instead of overwriting
clf()
#axis([-10, 10, -10, 10])
# Scale the axes:
siz=2.5
axis([-siz*10, siz*10, -siz*10, siz*10])
plt.gca().set_aspect('equal', adjustable='box')

# Define properties of the "gravitating spheres"
n = 999
# Factor 1.5 means starting positions can be off screen
pos = 1.5*siz*(20 * random_sample(n*2) - 10).reshape(n, 2)
vel = (0.003 * normal(size=n*2)).reshape(n, 2)
radius = 10.0
# radius=0.10 # uncomment to plot particle tracks
sizes = radius * random_sample(n) + radius

# Colors where each row is (Red, Green, Blue, Alpha).  Each can go
# from 0 to 1.  Alpha is the transparency.
colors = random_sample([n, 4])

# Draw all the circles and return an object ``circles`` that allows
# manipulation of the plotted circles.
circles = scatter(pos[:,0], pos[:,1], marker='o', s=sizes, c=colors)

# Gravitational clustering of massless particles near two mass overdensities
# located at lower left (ll) and upper right (ur) of figure area
ten=7.5 #10.0 # initial overdensity coords: -ten,-ten and +ten,+ten
hlf=1.0 #1.0 # scale factor for gravitational force inside overdensity
scl=0.1 #0.1 # scale factor for overall acceleration on test particles
for i in range(200):
    ten=ten-scl*sqrt(hlf)/ten**2.0 # move the overdensities closer over time
    # Renormalize positions from (-ten,+ten) to (0,2)*sqrt(hlf)
    posll=(pos+ten)*sqrt(hlf)/10. ; posur=(ten-pos)*sqrt(hlf)/10. # -posll
    # Compute distances in renormalized units to overdensity centres
    dll = sqrt(posll[:,0]**2.+posll[:,1]**2.)
    dur = sqrt(posur[:,0]**2.+posur[:,1]**2.)
    # Set flags: dll1=1 for dll>1, dll0=1 for dll<1; same for ur
    dll1 = 0.5*(1.0+(dll-1.0)/abs(dll-1.0)) ; dll0 = 1.0-dll1
    dur1 = 0.5*(1.0+(dur-1.0)/abs(dur-1.0)) ; dur0 = 1.0-dur1
    # At d<1, x acceleration \propto (x/d)*(rho*d**3.)*(1/d**2) = x
    # At d>1, x acceleration \propto (x/d)*(1/d**2) = x/d**3
    # ...and similarly for y acceleration.
    # Use flags to set one acceleration term to zero for each sphere
    xllaccel = (-posll[:,0]*(dll0+sqrt(hlf)*dll1/(dll)**3.0)).reshape(n,1)
    yllaccel = (-posll[:,1]*(dll0+sqrt(hlf)*dll1/(dll)**3.0)).reshape(n,1)
    xuraccel = (posur[:,0]*(dur0+sqrt(hlf)*dur1/(dur)**3.0)).reshape(n,1)
    yuraccel = (posur[:,1]*(dur0+sqrt(hlf)*dur1/(dur)**3.0)).reshape(n,1)
    #print(pos,xuraccel,yuraccel)
    llaccel = np.append(xllaccel,yllaccel,axis=1)
    uraccel = np.append(xuraccel,yuraccel,axis=1)
    pos = pos + vel + scl*(llaccel+uraccel)
    #bounce = abs(pos) > 10*siz      # Find balls that are outside walls
    #vel[bounce] = -vel[bounce]  # Bounce if outside the walls
    circles.set_offsets(pos)    # Change the positions
    draw() # comment out this line & uncomment next line & above to plot tracks
    #scatter(pos[:,0], pos[:,1], marker='o', s=sizes, c=colors) # will be slow!

Tuesday, March 10, 2015

Informal Talk on Careers and Jobs

See this link for a PDF of my informal talk on careers and jobs given at York earlier today.

There are some very useful links in there; please check them out and let me know if any don't work.

Why get a general physics education instead of (for example) a specific computer programming education?  In the words of one employer who needs people with both skill sets: "I can teach a physicist programming.  I can't teach a programmer physics."

York U PHAS informal study sessions, Wed. March 11

Dear York PHAS students,

For Wednesday March 11 (assuming classes remain cancelled), the department has provided the following rooms for informal study sessions. Show up and study with your classmates!

In addition, all are welcome to join us and discuss the latest astronomy science and news at the Astronomy Journal Club meeting in Petrie 317 from 12:30-13:30.

In Petrie 321:
10:00-12:30 - PHYS 3040/4020, with Prof. Horbatsch
13:30-15:30 - PHYS 3010/3040/4020
16:00-18:00 - PHYS 3010/3040/4020, continued

In Life Sciences Building 101:
13:30-15:30 - PHYS 2010/2060
16:00-18:00 - MATH 2271

In Life Sciences Building 107:
13:30-15:30 - PHYS 1010
16:00-18:00 - MATH 1014

Following these events, there will be an Astronomy Club meeting in Petrie 317 from 18:00-19:30: hear astronomy graduate student George Conidis talk about “Two Galaxies to Rule Them All”. As always, food and drinks will be available for all members; non-members can purchase memberships at the meeting.

Sincerely
Prof. Patrick Hall
Undergraduate Program Director
phasupd@yorku.ca

York Physics & Astronomy March Seminar Day 1

Dear York students,

I know that many of you are stressed over the strike, but the Physics and Astronomy Department, the Physics Society at York University, and the York University Astronomy Club are collaborating to bring you full-day events during the strike.

I would like to invite you all to the first seminar day to be held TODAY, Tuesday, March 10th, with events starting at noon and ending at 9PM. Everything is free for York students, and all students are welcome.

12:00-14:00 Python Basics workshop with Dr Rafiee in TEL 2114
14:00-15:00 Snacks and refreshments in ESSE lounge
15:00-16:00 Careers presentation by Prof. Hall, Petrie 317
16:00-17:30 Creating & building your CV & resume (peer led workshop), Petrie 317
17:30-18:00 Pizza dinner, Petrie 317
18:00-21:00 Movie Night (Particle Fever) in Petrie 317
18:00-21:00 Board games in Life Sciences Building 101 (There will be Carcasonne.)


PSYU event page: https://www.facebook.com/events/858324137572422/859311044140398/

And stay tuned for info about informal study sessions on Wednesday, March 11th.

Sincerely,
Prof. Hall

Thursday, March 5, 2015

Actual Grad School Recommendation Forms

Grad schools & employers look for applicants with more than just academic skills.
What skills from the lists below can you build during the strike?
We'll have activities to help, but don't limit yourself to what we offer!


Worthwhile Non-Academic Activities, or, The Strike Made Me Blog

I'll be blogging again for a while because York University TAs are on strike.  Previous strikes were 54, 78, and 85 days; thus, we can expect this strike to last 72.3 +- 16.4 days.

For students on strike, I'll be suggesting activities you can do to build your skills during the strike.

For starters, here's a list of free online courses that offer badges or certificates as proof of completion of the course.  The list is editable, so please add other such courses of interest if you find them:

https://docs.google.com/document/d/1ry6EQ8AeQarKhVuZOtfrJVn6NyJI0-37dHMdpsnmUGo/edit#

Watch your e-mail from the department for upcoming opportunities to work on some courses together with your peers at York starting next week.

And here's a new citizen science initiative from the folks at Zooniverse.org (and check out their website for all the other science projects to which anyone can contribute):

Hi there,
I'm delighted to announce a fantastic new project from the team at the Zooniverse - Science Gossip
In the Victorian period, just like today, scientists and members of the public worked together to further scientific discovery. Before computers and cameras they had to draw what they saw. Their drawings are locked away in the pages of Victorian periodicals and books, such as Science GossipRecreative Science and The Intellectual Observer.

The ultimate goal of this new project is to understand the roots of citizen science. This is the first Zooniverse project where citizen scientists are both the researchers and the subject of the research. Help us to classify scientific drawings, and map the origins of citizen science.

Get involved in the project now at www.sciencegossip.org

Thanks,
Victoria and the Zooniverse Team