# HP Forums

Full Version: Namir, Byte and REXX
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
A blast from the past.

While browsing a 1996 backup of an old computer of mine, I found a directory with my dabbling exercises in Personal REXX 2.0 in the late 80ies.
And, lo and behold, there I found some examples - bundled with the program - from Namir's review of the product on BYTE.

Here's one:

Code:
 /*______________________________________________________________________________*​/ /*ROOT.REX Accompanies the review, "Personal REXX" by Namir Clement Shammas, Byte, January 1988, page 167*/ /*______________________________________________________________________________*​/ /* Root seeing using Newton's method */ /* Personal REXX version */ NUMERIC DIGITS 10 NUMERIC FORM SCIENTIFIC SAY 'Enter expression (of variable X) ' pull fstring fstring = 'Y = '||fstring SAY 'Enter guess and accuracy ' pull guess accr diff = 2 * accr iter = 0 MAXITER = 30 DO WHILE ABS(diff) > accr   IF ABS(guess) > 1.0 THEN h = 0.01 * guess; ELSE h = 0.01   SAY 'guess = ' guess   diff = 2.0 * h * FF(guess) / (FF(guess + h) - FF(guess - h))   guess = guess - diff   iter = iter + 1   IF iter > MAXITER THEN diff = 0 END SAY ' ' SAY ' ' SAY 'Root = ' guess SAY ' ' SAY 'Number of iterations = ' iter EXIT FF: PROCEDURE EXPOSE fstring  arg X  INTERPRET fstring  /* variable Y is part of the interpreted fstring */  RETURN Y

Serendipity... :)
BYTE

Ahhhhh ......Great magazine , brings back memories
Holy cow!

Used to manage a VM/ESA system. Used EXEC2 & REXX a lot. Often wrote my own quick & dirty stuff in REXX. Always impressed me between REXX and XEDIT/macros the amount of power you could have; realatively easily.

Is Personal REXX still available? Wouldn't mind a full(er) version of XEDIT that ran under Windows or DOS also. Guess I could search.

How often I missed the VM system; though somewhat perculiar it was.
(09-09-2018 05:36 AM)Duane Hess Wrote: [ -> ]Holy cow!

Used to manage a VM/ESA system. Used EXEC2 & REXX a lot. Often wrote my own quick & dirty stuff in REXX. Always impressed me between REXX and XEDIT/macros the amount of power you could have; realatively easily.

I started on VM/CMS and VM EXEC.

(09-09-2018 05:36 AM)Duane Hess Wrote: [ -> ]Is Personal REXX still available? Wouldn't mind a full(er) version of XEDIT that ran under Windows or DOS also. Guess I could search.

You could try Regina REXX or Open Object REXX.
Regarding XEDIT, there's KEDIT (but hurry up, if you really want it ;) )

(09-09-2018 05:36 AM)Duane Hess Wrote: [ -> ]How often I missed the VM system; though somewhat perculiar it was.

I loved it too.
(09-09-2018 10:34 AM)Massimo Gnerucci Wrote: [ -> ]You could try Regina REXX or Open Object REXX.
Regarding XEDIT, there's KEDIT (but hurry up, if you really want it )

I loved it too.

I just sent the company an email asking them to release it to the Public Domain. Many other companies have done this when they stopped selling software. There's a benefit for hobbyists and no downside for the company.
(09-07-2018 11:32 AM)Massimo Gnerucci Wrote: [ -> ]A blast from the past.

While browsing a 1996 backup of an old computer of mine, I found a directory with my dabbling exercises in Personal REXX 2.0 in the late 80ies.
And, lo and behold, there I found some examples - bundled with the program - from Namir's review of the product on BYTE.

Here's one:

Code:
 /*______________________________________________________________________________*​/ /*ROOT.REX Accompanies the review, "Personal REXX" by Namir Clement Shammas, Byte, January 1988, page 167*/ /*______________________________________________________________________________*​/ /* Root seeing using Newton's method */ /* Personal REXX version */ NUMERIC DIGITS 10 NUMERIC FORM SCIENTIFIC SAY 'Enter expression (of variable X) ' pull fstring fstring = 'Y = '||fstring SAY 'Enter guess and accuracy ' pull guess accr diff = 2 * accr iter = 0 MAXITER = 30 DO WHILE ABS(diff) > accr   IF ABS(guess) > 1.0 THEN h = 0.01 * guess; ELSE h = 0.01   SAY 'guess = ' guess   diff = 2.0 * h * FF(guess) / (FF(guess + h) - FF(guess - h))   guess = guess - diff   iter = iter + 1   IF iter > MAXITER THEN diff = 0 END SAY ' ' SAY ' ' SAY 'Root = ' guess SAY ' ' SAY 'Number of iterations = ' iter EXIT FF: PROCEDURE EXPOSE fstring  arg X  INTERPRET fstring  /* variable Y is part of the interpreted fstring */  RETURN Y

Serendipity...

Has anyone tried to run this in Regina REXX? I get an error:

Code:
Enter expression (of variable X) 2*x^2+3*x-12 Enter guess and accuracy 5 .0001 guess =  5     38 +++       INTERPRET fstring     22 +++    diff = 2.0 * h * FF(guess) / (FF(guess + h) - FF(guess - h)) Error 64 running "D:\Program Files\rexx.org\Regina\demo\NewtonsRoot.rexx", line 38: [Syntax error while parsing] Error 64.1: [Syntax error at line 38]

Of course I haven't run REXX since my OS/2 days so I may be entering the data wrong.
(09-10-2018 12:14 PM)toml_12953 Wrote: [ -> ]Has anyone tried to run this in Regina REXX? I get an error:
(…)

Of course I haven't run REXX since my OS/2 days so I may be entering the data wrong.

I assume you have to write that expression as:
Code:
2*x**2+3*x-12

Cheers
Thomas
(09-10-2018 12:14 PM)toml_12953 Wrote: [ -> ]Has anyone tried to run this in Regina REXX? I get an error:

Thomas is right (as usual...)

Code:
 D:\ReginaREXX391w64>regina.exe root.rex Enter expression (of variable X)        2 * X**2 + 3 * X - 12                   Enter guess and accuracy                5 0.001                                 guess =  5                              guess =  2.695652174                    guess =  1.925113151                    guess =  1.814140206                    guess =  1.811738817                                                                                                    Root =  1.811737692                                                             Number of iterations =  5
(09-08-2018 06:34 PM)Zaphod Wrote: [ -> ]BYTE

Ahhhhh ......Great magazine , brings back memories

Always loved BYTE.

What would Jerry Pournelle have to say about current computers?

Geoff
We can use the Complex-Step Derivative Approximation mentioned in Derivatives on HP 42S to calculate with a single subroutine call both $$f(x)$$ and $$f'(x)$$ in Newton's method:

$$x_{n+1}=x_{n}-{\frac {f(x_{n})}{f'(x_{n})}}$$

Code:
00 { 34-Byte Prgm } 01▸LBL "NEWTON" 02 STO "x" 03 RCL "h" 04 COMPLEX 05 XEQ "FF" 06 COMPLEX 07 RCL÷ "h" 08 ÷ 09 STO- "x" 10 RCL "x" 11 END

For the equation $$2x^2+3x-12=0$$ of the given example this program can be used:
Code:
00 { 19-Byte Prgm } 01▸LBL "FF" 02 2 03 RCL× ST Y 04 3 05 + 06 × 07 12 08 – 09 END

Initialisation

1E-8
STO "h"

Iteration

5
XEQ "NEWTON"

y: 2.30434782609
x: 2.69565217391

R/S
y: 0.77053902071
x: 1.92511315320

R/S
y: 1.10972947392E-1
x: 1.81414020581

R/S
y: 2.40138878229E-3
x: 1.81173881703

R/S
y: 1.12553786619E-6
x: 1.81173769149

R/S
y: 2.47260969077E-13
x: 1.81173769149

Cheers
Thomas
(09-10-2018 12:52 PM)Thomas Klemm Wrote: [ -> ]
(09-10-2018 12:14 PM)toml_12953 Wrote: [ -> ]Has anyone tried to run this in Regina REXX? I get an error:
(…)

Of course I haven't run REXX since my OS/2 days so I may be entering the data wrong.

I assume you have to write that expression as:
Code:
2*x**2+3*x-12

Cheers
Thomas

Thank you! The exponentiation symbol (**) had dropped from my memory entirely!
Reference URL's
• HP Forums: https://www.hpmuseum.org/forum/index.php
• :