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
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> </DIV>
<DIV><FONT face=Arial size=2>----- Original Message ----- </FONT>
<DIV><FONT face=Arial size=2>From: <</FONT><A
href="mailto:shepardmar at yahoo.com"><FONT face=Arial
size=2>shepardmar at yahoo.com</FONT></A><FONT face=Arial
size=2>></FONT></DIV>
<DIV><FONT face=Arial size=2>To: <</FONT><A
href="mailto:EUforum at topica.com"><FONT face=Arial
size=2>EUforum at topica.com</FONT></A><FONT face=Arial
size=2>></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>> ============ The Euphoria Mailing List
============ <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> </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
---------------------------------------> initailize
total_0<BR>total_1 = 0
---------------------------------------> initailize total_1<BR>for
i = 1 to 4
do ----------------------------------> do 4
tests.<BR> ran
= rand(10) ---------------------------------> get the rand
number<BR> if variable[ran][2] = 1 then
---------------------> look at subscript#2 at random
variable<BR> total_1 +=
1 -------------------------------->If subscript#2 = 1
then +1
to total_1<BR> elsif
variable[ran][2]
= 0 then </FONT></DIV>
<DIV><FONT face=Arial
size=2>
total_0 += 1 -----------------------------> if
subscript#2 =
0 then +1 to total_0<BR> end if<BR>end for
------------------------------------------> repeat 'till i =
4<BR>gran_total
= total_1 & total_0 -------------------> append total_1 &
total_0 to
a sequence<BR>return gran_total --------------------------------->
return the
sequence.<BR>end function</FONT></DIV>
<DIV><FONT face=Arial
color=#0000a0><STRONG>-----------------------------------<Start the
funtcion>---------------------------------------<BR></STRONG></FONT><FONT
size=2><FONT face=Arial><FONT color=#0000a0><STRONG>sequence
result<BR>result
= test_var({{0,1,0},{1,0,7},{5,1,9},{9,0,6},....through to 10})
--------> a variable containg the 10 variables.<BR>print(1,result)
----------------------------------> {0,0} where result[1] is how
many 1's
& result[2] is how many 0's<BR><BR></STRONG></FONT>> <BR>>
<BR>>
<BR>> Hi Everybody:<BR>> First, I will like to thank you for
your help in
advance.<BR>> <BR>> I was looking at how to count and add a
variable's
subcripts<BR>> <BR>> <BR>> Ex.<BR>> I have a set of 20
variables<BR>> the variables contain three subcripts<BR>> <BR>>
ex<BR>> Variable #1 is sequence with three subcripts<BR>> {
8,1,5}<BR>>
<BR>> I want to compare the list of 10 variables with 4
variables<BR>>
that were selected at random with a Rand(10) = VariableX
function<BR>>
<BR>> <BR>> <BR>> so, if the rand function gave me a value of
10... the
rountine will find <BR>> <BR>> the 10Th variable from the list
of the 10
variables and put the 2nd <BR>> subcript of the 10th variable
<BR>> into a
temp variable for counting.<BR>> <BR>> the routine would need to
check 4
random selected values and see which <BR>> of the 4 contain one of
two<BR>> values in the subscript. THe values being 1 or 0<BR>>
<BR>>
let's say<BR>> <BR>> <BR>> of the 4 random variables when
compared with the listofvariables would <BR>> have
selected<BR>>
<BR>> variable#1, with subscript#2 at 1<BR>> variable#2, with
subscript#2
at 0<BR>> variable#7, with subscript#2 at 1<BR>> variable#8, with
subscript#2 at 1<BR>> <BR>> the routine would give the following
result<BR>> <BR>> 1) total 1 = 3<BR>> 2) total 0 = 1<BR>>
<BR>> I
tried to put the subsript into another variable but it will not let
me<BR>>
<BR>> ex<BR>> <BR>> x = variable[2]<BR>> <BR>> I also
tried
putting the value of x into a variable subcript with no <BR>>
luck<BR>>
<BR>> variable[2] = x<BR>> <BR>> <BR>> Any help would be
appreciated<BR>> <BR>> Regards<BR>> Shep<BR>> <BR>>
--^----------------------------------------------------------------<BR>>
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>>
<BR>> 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>> 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>>
<BR>> TOPICA - Start your own email discussion group. FREE!<BR>>
</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>>
--^----------------------------------------------------------------<BR>>
<BR>> <BR>> <BR>> <BR>> <BR>> -- <BR>> Incoming mail is
certified Virus Free.<BR>> 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>>
Version: 6.0.551 / Virus Database: 343 - Release Date: 11/12/03<BR>>
</FONT></DIV>
<DIV> </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=======--