Post Reply 
HP 38G: Old Programme - What Does It Do?
06-03-2015, 12:43 PM
Post: #1
HP 38G: Old Programme - What Does It Do?
I found one of my old programmes recently & can't work out what it does.

Input is a real via Ans, output is a list of 3 integers in Ans, positive or negative.

Can anyone say what the programme is for?

MAX(ABS(Ans),2)►N:
DO
ROUND(N*(RANDOM,RANDOM),0):
{RE(Ans)^6,RE(Ans)^4,RE(Ans)^3,RE(Ans)^2,RE(Ans),
IM(Ans)^6,IM(Ans)^4,IM(Ans)^3,IM(Ans)^2,IM(Ans)}:
IFTE(RANDOM<.5,{Ans(7)+8*Ans(3)*Ans(10),4*(Ans(2)-Ans(5)*Ans(8)),Ans(6)-20*Ans(3)*Ans(8)-8*Ans(1)},
{6*Ans(4)*Ans(9)-3*Ans(2)+Ans(7),6*Ans(9)*Ans(4)-Ans(7)+3*Ans(2),6*(3*Ans(2)+Ans(7))*Ans(10)*Ans(5)}):
UNTIL
ΠLIST(Ans)
END:
Find all posts by this user
Quote this message in a reply
06-03-2015, 12:54 PM
Post: #2
RE: HP 38G: Old Programme - What Does It Do?
Not having messed with my 38G in a while, what does Ans(7) (and the like) do? Is it implied multiplication, or does that index into a list of previous answers like on the TI-92/89? Or something else entirely?
Visit this user's website Find all posts by this user
Quote this message in a reply
06-03-2015, 01:04 PM
Post: #3
RE: HP 38G: Old Programme - What Does It Do?
Ans(7) in this case gets the 7th element of the list in Ans.
Find all posts by this user
Quote this message in a reply
06-03-2015, 01:23 PM
Post: #4
RE: HP 38G: Old Programme - What Does It Do?
So let's see, take the input value, or 2 if it's less than that, and multiply it by a random complex number.

Then build an 8-element list of the real and imaginary parts of that result raised to the powers 6, 4, 3, and 2.

Then take that list, flip a coin, and return one of two three element lists composed of various sums/products of those real/imaginary parts.

If any of those three elements is zero, i.e. ΠLIST(Ans) returns 0, start again from the beginning with a new random complex number.

So I know what it's doing, but I haven't a clue why. It honestly just looks like a simple list and Ans manipulation test program.

Does the program name indicate anything?
Visit this user's website Find all posts by this user
Quote this message in a reply
06-03-2015, 01:26 PM
Post: #5
RE: HP 38G: Old Programme - What Does It Do?
It's a 10 element list.

Name of programme is P224- which doen't say much to me now & I never named the programmes consecutively.
Find all posts by this user
Quote this message in a reply
Post Reply 




User(s) browsing this thread: 1 Guest(s)