Quick questions

For questions that don't fall into one of the categories above, such as working with the RATS interface, using Wizards, etc.
ivory4
Posts: 144
Joined: Mon Aug 24, 2009 12:16 pm

Quick questions

Unread post by ivory4 »

1. If I declare a

Code: Select all

dec vect[serise] fc 
it seems that I need to dimension it if I will use

Code: Select all

do i =1 ,10,1
set a 1 5 =%ran(1)
set fc(i) / = a 
end do i 
Otherwise, it says SET needs parameter SERIES

I also noticed that in this way in the series window, if I use a loop where i goes to 1000, all of them will be shown.
Is there a better way to do the same thing?
And I tried rect[series] which is automatically defined if I use COMPUTE

Code: Select all

compute fc = a~a 



2.

Code: Select all

compute count = 10
display count/10 
it turns out to be 0 ?
moderator
Site Admin
Posts: 269
Joined: Thu Oct 19, 2006 4:33 pm

Re: Quick questions

Unread post by moderator »

ivory4 wrote:1. If I declare a

Code: Select all

dec vect[serise] fc 
it seems that I need to dimension it if I will use
Yes, you need to dimension FC.

For example:

Code: Select all

dim fc(10)
do i =1 ,10,1
set fc(i) 1 5 = %ran(1)
end do i 
ivory4 wrote: I also noticed that in this way in the series window, if I use a loop where i goes to 1000, all of them will be shown.
Is there a better way to do the same thing?
I'm not sure what you are asking. Do you mean a better way to view all 1,000 series?
ivory4 wrote: And I tried rect[series] which is automatically defined if I use COMPUTE

Code: Select all

compute fc = a~a 
Not sure I follow you there. I don't think that COMPUTE statement will work if A is a series and FC is a rectangular array of series.
ivory4 wrote: 2.

Code: Select all

compute count = 10
display count/10 
it turns out to be 0 ?
[/quote]

Yes, if you divide an integer by an integer in RATS you get an integer result (i.e. any remainder is truncated). If you want a real-valued answer, one or both terms needs to be real. For example:

display count/10.0

or

display float(count)/10

Regards,
Tom Maycock
ivory4
Posts: 144
Joined: Mon Aug 24, 2009 12:16 pm

Re: Quick questions

Unread post by ivory4 »

moderator wrote:
ivory4 wrote: I also noticed that in this way in the series window, if I use a loop where i goes to 1000, all of them will be shown.
Is there a better way to do the same thing?
I'm not sure what you are asking. Do you mean a better way to view all 1,000 series?
I mean by clicking DATA- Show SERIES WINDOW, all fc(i) from 1 to 1000 are there. If i is big, it takes time to show the SERIES WINDOW.
I was wondering if I am recording the series in a cumbersome way.
moderator wrote:
ivory4 wrote: And I tried rect[series] which is automatically defined if I use COMPUTE

Code: Select all

compute fc = a~a 



Not sure I follow you there. I don't think that COMPUTE statement will work if A is a series and FC is a rectangular array of series.
com a 1 10 =%ran(1)
com f = a~a
disp f(1,1)

I think it works, but it creates rect[MATRIX]?because I need to use DISPLAY



Thanks for the rest of answers.
moderator
Site Admin
Posts: 269
Joined: Thu Oct 19, 2006 4:33 pm

Re: Quick questions

Unread post by moderator »

ivory4 wrote: I mean by clicking DATA- Show SERIES WINDOW, all fc(i) from 1 to 1000 are there. If i is big, it takes time to show the SERIES WINDOW. I was wondering if I am recording the series in a cumbersome way.
It doesn't really matter how you create them--a thousand series are a thousand series, whether you have a thousand individual series or a vector of series.
ivory4 wrote: com a 1 10 =%ran(1)
com f = a~a
disp f(1,1)

I think it works, but it creates rect[MATRIX]?because I need to use DISPLAY

Thanks for the rest of answers.
That won't work as written--you would use SET, not COMPUTE, to create A. If you do:

set a 1 10 =%ran(1)
com f = a~a
disp f(1,1)

F will be an ordinary rectangular array of reals, not a rectangular array of series.

Do you just need to use DISPLAY to view the values of the series? If so, you can apply it directly to entries of the series. For example:

display a(1)

Regards,
Tom Maycock
Post Reply