# Rcjp's Weblog

## September 12, 2007

### Inspirational

Filed under: physics — rcjp @ 4:09 pm

Everytime I look at this image, I have to stare at it for several minutes in sheer astonishment. Kudos to NASA for making these images available.

## April 12, 2007

### Circular Halo

Filed under: physics — rcjp @ 12:53 pm

I hardly noticed this without my Polaroid sunglasses on, as the colours were quite faint (and I’m fairly colour-blind), but the camera seemed to pick it out reasonably well; though its not as impressive as this one.

I tried to estimate the angular measurement of the halo and got my measurements wrong by quite a bit. From the sun to the start of the arc was the distance from my thumb to little finger tips with my hand held spread out at arms length. That’s 2 feet away from my eye and 8 inches across (I’ve measure that before and its easy to remember – all nice round numbers; no metric system centimeters here for estimating thank you – those units are too small.) This gives the halo an angular radius of about… (using a handy Common Lisp prompt)


CL-USER> (* (/ 180 pi) (atan 8/24))
18.434948654789338d0


that’s nowhere near the 22 degrees its supposed to be. But of course, holding your arm up at an angle reduces the distance between your eye and your hand that I’d measured before with my arm out horizontally. Re-measuring at around 45 degrees the hand-eye distance is down to 20″ and directly overhead 16″:


CL-USER> (* (/ 180 pi) (atan 8/20))
21.801408877810637d0


much better, phew.

## April 5, 2007

### Patterns

Filed under: physics, python — rcjp @ 3:56 pm

I think I got the matrix formula for this pattern from “Introduction to Dynamics” by Percival and Richards (its certainly the pattern I remember from the book cover)

You can get different patterns if you move the slider. Python gtk code…

 import pygtk pygtk.require('2.0') import gtk, math class Pattern(object): x, y = 0, 0 points=[] alpha = 76.11 def __init__(self, xsize, ysize): self.xsize, self.ysize = xsize, ysize window = gtk.Window(gtk.WINDOW_TOPLEVEL) window.set_title("Pattern") window.connect("destroy", lambda w: gtk.main_quit()) vbox = gtk.VBox(homogeneous=False, spacing=5) window.add(vbox) self.area = gtk.DrawingArea() self.area.set_size_request(xsize, ysize) self.area.connect("expose-event", self.area_expose_cb) self.area.connect("size-allocate", self.calculate_points) slider = gtk.Adjustment(value=self.alpha, lower=0.0, upper=100.0, step_incr=0.01) slider.connect("value-changed", self.slider_changed) self.hscale = gtk.HScale(slider) vbox.pack_start(self.area, expand=True, fill=True, padding=0) vbox.pack_start(self.hscale, expand=False) window.show_all() def slider_changed(self, slider): self.alpha = slider.get_value() self.calculate_points() def calculate_points(self, area=None, event=None): x, y, self.xsize, self.ysize = self.area.get_allocation() xscale = self.xsize/2.0 yscale = self.ysize/2.0 m = 52 angle = self.alpha*math.pi/180.0 c = math.cos(angle) s = math.sin(angle) self.points=[] try: for j in range(m): x = 0 y = j/float(m) for n in range(200): w = x x = x*c - (y - x*x)*s y = w*s + (y - w*w)*c if abs(x)>4 or abs(y)>4: raise StopIteration() if x>1 or y>1: continue self.points.append((int(x*xscale+xscale), int(y*yscale+yscale))) except StopIteration: self.area.queue_draw() def area_expose_cb(self, area, event): blue = self.area.get_colormap().alloc_color("#0000FF") pointgc = self.area.window.new_gc() pointgc.set_foreground(blue) area.window.draw_point(pointgc, 20, 10) self.area.window.draw_points(pointgc, self.points) def main(): gtk.main() return 0 if __name__ == '__main__': Pattern(600, 500) main() 

## November 16, 2006

### Pattern Formation

Filed under: physics — rcjp @ 10:09 am

## February 23, 2005

### Snowbow

Filed under: physics — rcjp @ 12:04 pm

ok, I made that name up. It seem there is officially no such thing as a snowbow, but I think its a good name (as it was starting to snow when I took this picture).

So why is it different from a rainbow? Well, when you see a rainbow the sun is always behind you and the sunlight is being refracted from water droplets back towards you – but in the picture the sun is infront of me and I’m leaning out of my window and looking up (you can just see the guttering at the eaves of the house at the top of the picture).

More correctly its called a ‘Circumzenithal Arc’ according to this excellent rainbow site.

## June 8, 2004

### Transit of Venus

Filed under: physics — rcjp @ 8:31 pm

In a very peculiar coincidence, a few months ago I was talking to a neighbour about a little lane that runs off from the road a hundred yards or so up the hill from where I live, and they mentioned there was a blue plaque to commemorate an astronomer at the bottom. Intrigued, I went and had a look and sure enough there it was on a garden wall.

Looking up one the net for information I could not believe that there was shortly going to be another transit, the first for over a hundred years. So I had to take the day off work and try and record the event in honour of William.

When I was a teenager I had borrowed a small telescope and was lucky enough to have the right positioning to project the sun onto the back white wall of my bedroom. With thick curtains darkening the room and pegged together around the scope tube I achieved an image of the sun several feet across and, apart from some shimmering as the hot air rose up the walls of the house, this gave some great views of sunspots.

The weather was blazing sunshine and with my Meade ETX, some cardboard a sheet of white paper and a certain amount of swearing my contraption held steady enough for a few pictures.

## September 16, 2001

### Countdown numbers game

Filed under: physics — rcjp @ 11:57 am

No this isn’t physics, but I suppose it charitably comes under the heading of numerical methods ;) …

I wrote the following (probably badly written) program after watching Carol Vorderman struggle to find solutions for the numbers game on the Countdown TV program.

I can’t remember why I wrote it in Fortran 95 ?!? and I didn’t test it much, just on a couple of sets of numbers I don’t think she (or I!) could solve by hand in the 30 secs the contestants are given.

The problem is – given a set of 6 random integers try to arrive at a randomly chosen number just using +,-,*,/ (although, thinking about it, I’m not sure integer division is allowed)

For the second test case (try to use 50, 9, 9, 4, 7 and 10 to make 971) the program printed


***SOLUTION***
9  *   4  =  36
7  *  10  =  70
50  -  36  =  14
70  *  14  = 980
980  -   9  = 971

***SOLUTION***
9  *   7  =  63
50  +  63  = 113
113  -   4  = 109
9  * 109  = 981
981  -  10  = 971

at least            2 solutions


and the code COUNTDOWN.F90 is…


module solutions
integer, parameter::ncards=6
integer::nsols
integer::sol(1000,ncards*2)
end module solutions

program countdown
use solutions
integer::numbers(ncards)
integer::solunum(ncards)
integer::solunum1(ncards)
integer::ntarget
character::soluop(ncards)

numbers=(/50, 7, 5, 1, 8, 3/)
ntarget=684

numbers=(/50, 9, 9, 4, 7, 10/)
ntarget=971
solunum=0
solunum1=0
soluop=' '
nsols=1
call pair(numbers, ncards, solunum, solunum1, soluop, ncards, ntarget)
print *, 'at least ',nsols-1, ' solutions'
end program countdown

integer function combine(n, m, op)
character::op
integer::n, m

select case (op)
case ('*')
combine=n*m
case ('+')
combine=n+m
case ('-')
combine=n-m
case ('/')
combine=n/m
if (mod (n,m) /= 0) combine=0
case default
combine=0
end select
if (combinesolsize*2) then
print *, '***SOLUTION***'
do m=solsize, 2, -1
n1=solunum(m)
n2=solunum1(m)
select case (soluop(m))
case ('*')
n3=n1*n2
case ('+')
n3=n1+n2
case ('-')
n3=n1-n2
case ('/')
n3=n1/n2
end select
print '(i4, 2x, a, i4, 2x, a, i4)', n1,soluop(m), n2, '=', n3
enddo
sol(nsols,:)=nums
nsols=nsols+1
return
endif
enddo
end subroutine printsolution


## October 27, 1995

### Teaching MSc Numerical Methods

Filed under: physics — rcjp @ 11:51 am

Around this time I taught a few groups of MSc students some basic numerical methods – mainly to support another class in soliton theory.

One of the first programs was to plot optical reflectance against angle at a metal glass interface – this is interesting because at certain angles you will get a surface wave traveling in the metal film.

Mostly though this was just to get students comfortable using 2D plotting NAG routines…
(more…)

Older Posts »