So; I'm creating a program called regression(n) which will do Linear Regression on a set of n sets of user inputted x and y values.

I wish them to be asked for n sets of x,y values, one-by-one that'll be assigned to two lists L1 and L2 and input as x1, y1, x2, y2, etc.

So far I have this:

[code]

regression(n)

(c)NUMBER

FnOff 1,2,3,4,5

if n<1 then

Text "Number too small"

Stop

end if

ClrHome

For z,1,n,1

"Enter X" & string(z)->Str1

Input Str1, i1

i1->L1(z)

"Enter Y" & string(z)->Str1

Input Str1, i2

i2->L2(z)

Text string(l1(z)) & ", " & string(l2(z))

EndFor

LinReg L1,L2

ShowStat

Regeq(x)->y1(x)

Text "Use y1(x) to Enter New X Values"

NewPlot 1,1,L1,L2

EndPrgm

[/code]

Pretend that (c) is the copyright symbol. I don't know how to enter code on this forum properly. When I typed colons, it just got rid of all the lines except the first and last lines.

Anyways, it is not doing as I expect it should, and I'm sure it is related to my weak understanding of Arrays and Lists.

First, ClrHome is not clearing the HOME page, as I would guess it would.

Next, I am trying to create two lists, L1 and L2, that have n number of X and Y values in them (X values in L1, Y in L2)

I tried setting:

[code]

n->dim(L1)

n->dim(L2)

[/code]

Because it says it redims it to what you put into the Dim command… also tried hardwiring it as:

[code]

5->dim(L1)

5->dim(L2)

[/code]

which also didn't work.

So, I guess both L1 and L2 would have a length of 999, then.

Next, I'm trying to use the Input function to input the X and Y values into L1(z), L2(z) … but it isn't working right:

I originally tried:

[code]

Input Str1, L1(z)

[/code]

Which is what I would think I should be able to do. But that didn't work; so, that is why I am trying to assign it to i1, then to L1(z)

It at least doesn't give me an error that way… however, it only SEEMS like it's working. In the end I get the unexpected values where L1(1) = the last thing I entered, not the first and L2(1) is the same way???

And, when I try to use the two lists L1,L2 at the LinReg line, it gives me a 'Data Type' error.

Where are my many errors (including - how does one put code into this forum without it disappearing)???