From: Dave Arnett <dave_arnett@hp.com>
Newsgroups: comp.sys.hp48
Subject: Re: Two Point Geometry Program
Date: Wed, 04 Nov 1998 14:59:56 -0800
Organization: HP Vancouver Site
Lines: 38
Message-ID: <3640DC6C.5EDB@hp.com>
References: <F1wLHn.FGJ.0.sheppard@torfree.net>
Reply-To: dave_arnett@hp.com
NNTP-Posting-Host: vcsdarnett2.vcd.hp.com
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
X-Trace: wwproxy.vcd.hp.com 910220460 26839 15.36.131.112 (4 Nov 1998 23:01:00 GMT)
X-Complaints-To: news@news.vcd.hp.com
NNTP-Posting-Date: 4 Nov 1998 23:01:00 GMT
X-Mailer: Mozilla 3.01C (WinNT; I)
Xref: republic.btigate.com comp.sys.hp48:18214

Bill Markwick wrote:
> 
> Inspired by Chris's recent post, I wrote a program that takes any two
> points and returns the function, the slope, the distance, and the X and
> Y intercepts; it also stores them as global variables. A PRGE program
> deletes all the created vars. PLOTF plots the function using autoscale
> (it overwrites EQ).
> 
> I hope it's useful for geometry, or an example of programming (it
> probably could be more efficient in finding solutions).

In the interest of efficiency, here's an example solution that 
simply returns the results to the stack with tags, and doesn't 
fiddle with any of the stored variables.  I haven't attempted to
squeeze bytes out of it, only to simplify the process.

The input would be two points, in complex number form, such as:

		2:          (3,5)
		1:         (-2,7)

Checksum: #1Eh   Bytes: 162.0

<< 
DUP2				Copy of points, for user's reference
- DUP ARG TAN "Slope" ->TAG	Calculate slope (m)
SWAP ABS "Distance" ->TAG	Calculate distance between points
4 PICK C->R SWAP  
4 PICK * - "Y-Int" ->TAG	Calc Y-intercept (b) as Y1-mX1
DUP 4 PICK / NEG "X-Int" ->TAG  Calc X-intercept as -b/m
'Y' 5 PICK 'X' * 4 PICK + =	Compose equation in Slope-Intcpt Form
"Funct" ->TAG
>>

Good Day!
Dave.
-----
I don't speak for HP when I post here.