Post Reply 
Namir, Byte and REXX
09-07-2018, 11:32 AM
Post: #1
Namir, Byte and REXX
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... :)

Greetings,
    Massimo

-+×÷ ↔ left is right and right is wrong
Visit this user's website Find all posts by this user
Quote this message in a reply
09-08-2018, 06:34 PM
Post: #2
RE: Namir, Byte and REXX
BYTE

Ahhhhh ......Great magazine , brings back memories
Find all posts by this user
Quote this message in a reply
09-09-2018, 05:36 AM
Post: #3
RE: Namir, Byte and REXX
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.
Find all posts by this user
Quote this message in a reply
09-09-2018, 10:34 AM
Post: #4
RE: Namir, Byte and REXX
(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.

Greetings,
    Massimo

-+×÷ ↔ left is right and right is wrong
Visit this user's website Find all posts by this user
Quote this message in a reply
09-10-2018, 12:11 PM (This post was last modified: 09-10-2018 12:12 PM by toml_12953.)
Post: #5
RE: Namir, Byte and REXX
(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 Wink )

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.

Tom L
Cui bono?
Find all posts by this user
Quote this message in a reply
09-10-2018, 12:14 PM (This post was last modified: 09-10-2018 12:15 PM by toml_12953.)
Post: #6
RE: Namir, Byte and REXX
(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... Smile

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.

Tom L
Cui bono?
Find all posts by this user
Quote this message in a reply
09-10-2018, 12:52 PM
Post: #7
RE: Namir, Byte and REXX
(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
Find all posts by this user
Quote this message in a reply
09-10-2018, 01:26 PM
Post: #8
RE: Namir, Byte and REXX
(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

Greetings,
    Massimo

-+×÷ ↔ left is right and right is wrong
Visit this user's website Find all posts by this user
Quote this message in a reply
09-10-2018, 03:07 PM
Post: #9
RE: Namir, Byte and REXX
(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
Find all posts by this user
Quote this message in a reply
09-10-2018, 04:00 PM
Post: #10
RE: Namir, Byte and REXX
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
Find all posts by this user
Quote this message in a reply
09-11-2018, 12:35 PM
Post: #11
RE: Namir, Byte and REXX
(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!

Tom L
Cui bono?
Find all posts by this user
Quote this message in a reply
Post Reply 




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