 Re: Beginning programming for HP48GX? Message #26 Posted by Don Jennings on 30 Oct 2008, 10:37 a.m., in response to message #13 by Mark Edmonds
Quote:
The simplest solution is just to manipulate the stack directly in RPL. Your multiplication example would be reduced to a single multiply command (hardly worth programming!) << * >>.
If you want to give us an idea of what your program is doing, we can help you get it written in RPL, which is generally faster and more economical than algebraics.
Mark
I'll post the keystrokes I made up to get the job done manually, but need program because of hundreds of individual solutions needed, gets tiring to keep entering keystokes all day long:)
There is a part A, which calculates the distance to gravitational focus for a wavefront coming in from an infinite distance, all the rays parallel, for various radii #'s above the surface of the sun. 1Radii would be skimming the surface, one radii=440,000 miles from the center of the sun. So 1.5R would be the ray going by but 220,000 miles above the surface. 2R would be 440,000 miles high, that distance, the deflection angle is half the surface deflection of that famous Einstein # of 1.75 Seconds of arc. So here goes with part A:
1.75, ent, R#, divide, 10000, divide, 90, ent, swap, HMS, HMS>, tan, 440000, ent, R#, *, *
So if the R# is 2.5 for instance, these keystrokes returns
324130483902, in other words, two beams of light on opposite sides of the sun, like two laser beams pointing tangent to the surface but but going by the sun 1.1 million miles above the surface, those beams will meet because of the gravitational lens effect, 324 billion miles away from the sun out in space, a considerable distance to say the least:)
Now on to part B.
This set of keystrokes calcs the same thing but takes into account the fact that a closer object, like a nearby star, I use Alpha Centauri, which is about 4 light years away, one LY =5.8 E12 miles (6 trillion miles rounded out, times 4 or 24 trillion miles, or 2.5E13 miles from our sun. Now that is a huge distance but what I figured out is the light going by the surface of the sun from that distance is already slightly diverging, not parallel like something from an infinite distance away. That means the focus will be a bit further out because you have to subtract the divergence angle from the convergence angle of the focus effect, which varies linerarly by altitude above the surface of the sun, so like I said, a beam going by at 1 radii above the surface, 440,000 miles up will only be deflected by half the angle V a beam skimming the surface and so forth. So here goes:
R#, ent, 440000, *, 2.5E13, divide, invert, 1296000, divide, invert, 1.75, ent, R#, divide, swap, minus, 10000, divide, 90, ent, swap, HMS, HMS> tan, 440000, ent, R#, *, *
So if we use that same R# as in part A, 2.5, then it returns
352876845619 or 352 billion miles out, which puts the focus for that radii distance 24 billion miles further away than the light coming from an infinite distance. So there you have it, the keystrokes for both part A and part B, Thats what I need a program to do, so I can just enter an R#, and a distance #, in this case 2.5E13 which is the distance in miles to Alpha Centauri but to do other stars, that needs to be a variable too, so 8 Ly would be 5E13, etc. 8 Ly happens to be the distance to Sirius so those are the two I am studying right now. Thanks for your help! Don.
 
