The original thread appeared in comp.lang.fortran, not here.
For some reason I decided to ask here instead. This was a problem of a
small particle hitting a large particle and then calculating how much
energy was lost in the collision. The original program had big
problems with numerical instability owing to the subtraction of nearly
equal quantities. The problem was reformulated by several people, the
last version posted did suffer from this problem. While this may be
more of a general programing problem than a Fortran problem, IMO we
see enough FAQs about non-language specific numerical problems that I
think it would be a good idea to handle these topics either here or in
CLF. Why? Because I would like to encourage the use of Fortran for
numeric computation. So some "off topic" material is actually
relevant, again IMO.
I also think that some general problem solving techniques are also
somewhat relevant to CLF. After all CLF is NOT comp.lang.c!
I understand more about this problem as a programming exercise than I
know about the physics. I was curious as to what physical principles
allowed the reformulation into a program that actually gave reasonable
results in single precision. Was it some conservation principle?
I also found the multiplier sin^2(theta) / (1 + cos (theta)) to be
interesting. It's an expansion of 1-cos(theta). I would have thought
of the half angle formula 2 sin^2(theta/2) first.
Elliot