Post Reply 
[hp50g] how enter the rand function for graphing?
10-09-2022, 05:09 PM
Post: #11
RE: [hp50g] how enter the rand function for graphing?
(09-27-2022 04:28 PM)ahahah Wrote:  my question: how to not have a value when i enter the rand function in y1(x) equation?
thx

RAND on the 50g is considered a command as opposed to a function. As a result, you can't use it in an algebraic expression for plotting. You can, however, still plot its result. You just need to enter a program instead of a function for plotting.

Start off with a "clean slate". If you already have any of these variables in the current directory of your 50g, either create a new (empty) directory or delete them from the current one:

X
Y
EQ
PPAR
ZPAR


Note that if any of the above are also in your HOME directory, those will need to be deleted as well to make sure that lingering variables in the search path aren't confusing things.

Create the small program to be plotted:
« RAND »

Save the above program in the reserved variable "EQ":
STEQ

Set the X-range to match the display width (this will also create a default PPAR for a function):
1
131
XRNG


The RAND result will never be < 0 or >= 1. So set the Y-range accordingly to maximize the vertical coverage:
0
1
YRNG


The default for a function graph is to plot every other column, but in this case we want every column plotted:
1 RES

We don't need the axes drawn for this:
-29 SF

Likewise, we just want the points. Not the lines between the points:
-31 SF

Clear any previous plots from PICT:
ERASE

Left-shift<HOLD>-D will activate the PLOT SETUP dialog. Press "F/F6" to DRAW the plot. This should result in a random pattern of dots across the PICT image.

The only reason you would want to use RDZ here is if you want to show an example of the output that you would want to repeat exactly. In that case, you would provide a number (the more digits the better) to RDZ immediately before any drawing is executed in order to have predictable results. As an example, this is the resulting plot when drawing is prefaced by "123456789 RDZ":
[Image: rand_plot.png]

You should be able to replicate that exact pattern by executing 123456789 RDZ right before ERASEing and DRAWing.
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: [hp50g] how enter the rand function for graphing? - DavidM - 10-09-2022 05:09 PM



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