1. Multiplexing varibles by subscripts

Hi Everybody:
First, I will like to thank you for your help in advance.

I was looking at how to count and add a variable's subcripts


Ex.
I have a set of 20 variables
the variables contain three subcripts

ex
Variable #1 is sequence with three subcripts
{ 8,1,5}

I want to compare the list of 10 variables with 4 variables
that were selected at random with  a Rand(10) = VariableX function



so, if the rand function gave me a value of 10... the rountine will find 

the 10Th variable from the list of the 10 variables and put the 2nd 
subcript of the 10th variable 
into a temp variable for counting.

the routine would need to check 4 random selected values and see which 
of the 4 contain one of two
values in the subscript. THe values being 1 or 0

let's say


of the 4 random variables  when compared with the listofvariables  would 
have selected

variable#1, with subscript#2 at 1
variable#2, with subscript#2 at 0
variable#7, with subscript#2 at 1
variable#8, with subscript#2 at 1

the routine would give the following result

1) total 1 = 3
2) total 0 = 1

I tried to put the subsript into another variable but it will not let me

ex

x = variable[2]

I also tried putting the value of x into a variable subcript with no 
luck

variable[2] = x


Any help would be appreciated

Regards
Shep

new topic     » topic index » view message » categorize

2. Re: Multiplexing varibles by subscripts

--=======AVGMAIL-3FDC862F4FB6=======
boundary="----=_NextPart_000_000A_01C3C2B5.D9C2D780"

------=_NextPart_000_000A_01C3C2B5.D9C2D780


----- Original Message -----
From: <shepardmar at yahoo.com>
To: <EUforum at topica.com>
Sent: Monday, December 15, 2003 1:39 AM
Subject: Multiplexing varibles by subscripts


============ The Euphoria Mailing List ============ 
I hope this helps. I'm not quite clear how may variables you are 
testing but here goes.
I think this is what you are trying to do. The function below will 
check a variable with
ten embeded sequences, randomly pick a sequence and check its subscript#2
and count the 1's and 0's. It repeats four times. (Tested and works).

global function test_var(sequence variable)
integer ran,total_1,total_0
sequence gran_total
total_0 = 0 ---------------------------------------> initailize total_0
total_1 = 0 ---------------------------------------> initailize total_1
for i = 1 to 4 do ----------------------------------> do 4 tests.
     ran = rand(10) ---------------------------------> get the rand number
     if variable[ran][2] = 1 then ---------------------> look at 
subscript#2 at random variable
         total_1 += 1 -------------------------------->If subscript#2 
= 1 then +1 to total_1
         elsif variable[ran][2] = 0 then
             total_0 += 1 -----------------------------> if 
subscript#2  = 0  then +1 to total_0
     end if
end for ------------------------------------------> repeat 'till i = 4
gran_total = total_1 & total_0 -------------------> append total_1 & 
total_0 to a sequence
return gran_total ---------------------------------> return the sequence.
end function
-----------------------------------<Start the 
funtcion>---------------------------------------
sequence result
result = test_var({{0,1,0},{1,0,7},{5,1,9},{9,0,6},....through to 10}) 
--------> a variable containg the 10 variables.
print(1,result) ----------------------------------> {0,0} where 
result[1] is how many 1's & result[2] is how many 0's




Hi Everybody:
First, I will like to thank you for your help in advance.

I was looking at how to count and add a variable's subcripts


Ex.
I have a set of 20 variables
the variables contain three subcripts

ex
Variable #1 is sequence with three subcripts
{ 8,1,5}

I want to compare the list of 10 variables with 4 variables
that were selected at random with  a Rand(10) = VariableX function



so, if the rand function gave me a value of 10... the rountine will find 

the 10Th variable from the list of the 10 variables and put the 2nd 
subcript of the 10th variable 
into a temp variable for counting.

the routine would need to check 4 random selected values and see which 
of the 4 contain one of two
values in the subscript. THe values being 1 or 0

let's say


of the 4 random variables  when compared with the listofvariables  would 
have selected

variable#1, with subscript#2 at 1
variable#2, with subscript#2 at 0
variable#7, with subscript#2 at 1
variable#8, with subscript#2 at 1

the routine would give the following result

1) total 1 = 3
2) total 0 = 1

I tried to put the subsript into another variable but it will not let me

ex

x = variable[2]

I also tried putting the value of x into a variable subcript with no 
luck

variable[2] = x


Any help would be appreciated

Regards
Shep

--^----------------------------------------------------------------
This email was sent to: hmck1 at dodo.com.au

EASY UNSUBSCRIBE click here: http://topica.com/u/?b1dd66.b60Ray.aG1jazFA
Or send an email to: EUforum-unsubscribe at topica.com

TOPICA - Start your own email discussion group. FREE!
http://www.topica.com/partner/tag02/create/index2.html
--^----------------------------------------------------------------





-- 
Incoming mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.551 / Virus Database: 343 - Release Date: 11/12/03



---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.551 / Virus Database: 343 - Release Date: 11/12/03
------=_NextPart_000_000A_01C3C2B5.D9C2D780
Content-Type: text/html; charset=iso-8859-1
Content-Transfer-Encoding: 8bit

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=iso-8859-1">
<META content="MSHTML 6.00.2800.1276" name=GENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>----- Original Message ----- </FONT>
<DIV><FONT face=Arial size=2>From: &lt;</FONT><A
href="mailto:shepardmar at yahoo.com"><FONT face=Arial
size=2>shepardmar at yahoo.com</FONT></A><FONT face=Arial 
size=2>&gt;</FONT></DIV>
<DIV><FONT face=Arial size=2>To: &lt;</FONT><A
href="mailto:EUforum at topica.com"><FONT face=Arial
size=2>EUforum at topica.com</FONT></A><FONT face=Arial 
size=2>&gt;</FONT></DIV>
<DIV><FONT face=Arial size=2>Sent: Monday, December 15, 2003 1:39
AM</FONT></DIV>
<DIV><FONT face=Arial size=2>Subject: Multiplexing varibles by
subscripts</FONT></DIV></DIV>
<DIV><FONT face=Arial><BR><FONT size=2></FONT></FONT></DIV>
<DIV><FONT face=Arial size=2>&gt; ============ The Euphoria Mailing List
============&nbsp;<BR>I hope this helps. I'm not quite clear how may 
variables
you are testing but here goes.</FONT></DIV>
<DIV><FONT face=Arial size=2>I think this is what you are trying to 
do. The
function below will check a variable with </FONT></DIV>
<DIV><FONT face=Arial size=2>ten embeded sequences, randomly pick a 
sequence and
check its subscript#2</FONT></DIV>
<DIV><FONT face=Arial size=2>and count the 1's and 0's. It repeats 
four times.
(Tested and works).</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>global function test_var(sequence
variable)<BR>integer ran,total_1,total_0<BR>sequence 
gran_total<BR>total_0 = 0
---------------------------------------&gt; initailize 
total_0<BR>total_1 = 0
---------------------------------------&gt; initailize total_1<BR>for 
i = 1 to 4
do ----------------------------------&gt; do 4 
tests.<BR>&nbsp;&nbsp;&nbsp; ran
= rand(10) ---------------------------------&gt; get&nbsp;the rand
number<BR>&nbsp;&nbsp;&nbsp; if variable[ran][2] = 1 then
---------------------&gt;&nbsp;look at subscript#2 at random
variable<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; total_1 +=
1&nbsp;--------------------------------&gt;If&nbsp;subscript#2 = 1 
then&nbsp;+1
to total_1<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; elsif 
variable[ran][2]
= 0 then </FONT></DIV>
<DIV><FONT face=Arial
size=2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
total_0 += 1&nbsp;-----------------------------&gt; if 
subscript#2&nbsp; =
0&nbsp; then +1 to total_0<BR>&nbsp;&nbsp;&nbsp; end if<BR>end for
------------------------------------------&gt; repeat 'till i = 
4<BR>gran_total
= total_1 &amp; total_0 -------------------&gt; append total_1 &amp; 
total_0 to
a sequence<BR>return gran_total ---------------------------------&gt; 
return the
sequence.<BR>end function</FONT></DIV>
<DIV><FONT face=Arial
color=#0000a0><STRONG>-----------------------------------&lt;Start the
funtcion&gt;---------------------------------------<BR></STRONG></FONT><FONT 

size=2><FONT face=Arial><FONT color=#0000a0><STRONG>sequence 
result<BR>result
=&nbsp;test_var({{0,1,0},{1,0,7},{5,1,9},{9,0,6},....through to 10})
--------&gt; a variable containg the 10 variables.<BR>print(1,result)
----------------------------------&gt; {0,0} where result[1] is how 
many 1's
&amp; result[2] is how many 0's<BR><BR></STRONG></FONT>&gt; <BR>&gt; 
<BR>&gt;
<BR>&gt; Hi Everybody:<BR>&gt; First, I will like to thank you for 
your help in
advance.<BR>&gt; <BR>&gt; I was looking at how to count and add a 
variable's
subcripts<BR>&gt; <BR>&gt; <BR>&gt; Ex.<BR>&gt; I have a set of 20
variables<BR>&gt; the variables contain three subcripts<BR>&gt; <BR>&gt;
ex<BR>&gt; Variable #1 is sequence with three subcripts<BR>&gt; { 
8,1,5}<BR>&gt;
<BR>&gt; I want to compare the list of 10 variables with 4 
variables<BR>&gt;
that were selected at random with&nbsp; a Rand(10) = VariableX 
function<BR>&gt;
<BR>&gt; <BR>&gt; <BR>&gt; so, if the rand function gave me a value of 
10... the
rountine will find <BR>&gt; <BR>&gt; the 10Th variable from the list 
of the 10
variables and put the 2nd <BR>&gt; subcript of the 10th variable 
<BR>&gt; into a
temp variable for counting.<BR>&gt; <BR>&gt; the routine would need to 
check 4
random selected values and see which <BR>&gt; of the 4 contain one of
two<BR>&gt; values in the subscript. THe values being 1 or 0<BR>&gt; 
<BR>&gt;
let's say<BR>&gt; <BR>&gt; <BR>&gt; of the 4 random variables&nbsp; when
compared with the listofvariables&nbsp; would <BR>&gt; have 
selected<BR>&gt;
<BR>&gt; variable#1, with subscript#2 at 1<BR>&gt; variable#2, with 
subscript#2
at 0<BR>&gt; variable#7, with subscript#2 at 1<BR>&gt; variable#8, with
subscript#2 at 1<BR>&gt; <BR>&gt; the routine would give the following
result<BR>&gt; <BR>&gt; 1) total 1 = 3<BR>&gt; 2) total 0 = 1<BR>&gt; 
<BR>&gt; I
tried to put the subsript into another variable but it will not let 
me<BR>&gt;
<BR>&gt; ex<BR>&gt; <BR>&gt; x = variable[2]<BR>&gt; <BR>&gt; I also 
tried
putting the value of x into a variable subcript with no <BR>&gt; 
luck<BR>&gt;
<BR>&gt; variable[2] = x<BR>&gt; <BR>&gt; <BR>&gt; Any help would be
appreciated<BR>&gt; <BR>&gt; Regards<BR>&gt; Shep<BR>&gt; <BR>&gt;
--^----------------------------------------------------------------<BR>&gt; 
This
email was sent to: </FONT></FONT><A href="mailto:hmck1 at dodo.com.au"><FONT
face=Arial size=2>hmck1 at dodo.com.au</FONT></A><BR><FONT face=Arial 
size=2>&gt;
<BR>&gt; EASY UNSUBSCRIBE click here: </FONT><A
href="http://topica.com/u/?b1dd66.b60Ray.aG1jazFA"><FONT face=Arial
size=2>http://topica.com/u/?b1dd66.b60Ray.aG1jazFA</FONT></A><BR><FONT
face=Arial size=2>&gt; Or send an email to: </FONT><A
href="mailto:EUforum-unsubscribe at topica.com"><FONT face=Arial
size=2>EUforum-unsubscribe at topica.com</FONT></A><BR><FONT face=Arial 
size=2>&gt;
<BR>&gt; TOPICA - Start your own email discussion group. FREE!<BR>&gt; 
</FONT><A
href="http://www.topica.com/partner/tag02/create/index2.html"><FONT 
face=Arial
size=2>http://www.topica.com/partner/tag02/create/index2.html</FONT></A><BR><FONT

face=Arial size=2>&gt;
--^----------------------------------------------------------------<BR>&gt; 

<BR>&gt; <BR>&gt; <BR>&gt; <BR>&gt; <BR>&gt; -- <BR>&gt; Incoming mail is
certified Virus Free.<BR>&gt; Checked by AVG anti-virus system (</FONT><A
href="http://www.grisoft.com"><FONT face=Arial
size=2>http://www.grisoft.com</FONT></A><FONT face=Arial 
size=2>).<BR>&gt;
Version: 6.0.551 / Virus Database: 343 - Release Date: 11/12/03<BR>&gt;
</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=Arial size=2><BR>---<BR>Outgoing mail is certified Virus
Free.<BR>Checked by AVG anti-virus system (<A
href="http://www.grisoft.com">http://www.grisoft.com</A>).<BR>Version: 
6.0.551 /

------=_NextPart_000_000A_01C3C2B5.D9C2D780--
--=======AVGMAIL-3FDC862F4FB6=======
Content-Type: text/plain; x-avg=cert; charset=iso-8859-2
Content-Transfer-Encoding: 8bit
Content-Disposition: inline
Content-Description: "AVG certification"

Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.551 / Virus Database: 343 - Release Date: 11/12/03

--=======AVGMAIL-3FDC862F4FB6=======--

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu