1. RE: math combinations

This message is in MIME format. Since your mail reader does not understand
this format, some or all of this message may not be legible.

------_=_NextPart_000_01C20524.85047AA0
 charset=iso-8859-2

Have a look at Ricardo Forno's general utility package in th contributions
page. It has a Permutations function in it which sounds like it might work
for you.

==================================================================
De informatie opgenomen in dit bericht kan vertrouwelijk zijn en 
is uitsluitend bestemd voor de geadresseerde. Indien u dit bericht 
onterecht ontvangt wordt u verzocht de inhoud niet te gebruiken en 
de afzender direct te informeren door het bericht te retourneren. 
==================================================================
The information contained in this message may be confidential 
and is intended to be exclusively for the addressee. Should you 
receive this message unintentionally, please do not use the contents 
herein and notify the sender immediately by return e-mail.


==================================================================

------_=_NextPart_000_01C20524.85047AA0
Content-Type: application/ms-tnef

new topic     » topic index » view message » categorize

2. RE: math combinations

This is a multi-part message in MIME format.

------=_NextPart_000_000C_01C20504.40453280
	charset="iso-8859-2"

where is {'c','a','b'}? :)
  -----Original Message-----
  From: tone.skoda at siol.net [mailto:tone.skoda at siol.net]
  Sent: Sunday, May 26, 2002 8:58 PM
  To: EUforum
  Subject: math combinations



  How would I write a routine which would shuffle all members in a sequence
so that all possible combinations would be gotten?
  Also, input sequence could have two or more equal members.

  For example, all combinations for {'a','b','c'} would be:
  {'a','b','c'}
  {'a','c','b'}
  {'b','a','c'}
  {'b','c','a'}
  {'c','b','a'}






------=_NextPart_000_000C_01C20504.40453280
Content-Type: text/html;
	charset="iso-8859-2"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META content=3D"text/html; charset=3Diso-8859-2" =
http-equiv=3DContent-Type>
<META content=3D"MSHTML 5.00.3315.2870" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT color=3D#0000ff face=3DArial size=3D2><SPAN =
class=3D402222503-27052002>where=20
is {'c','a','b'}? :)</SPAN></FONT></DIV>
<BLOCKQUOTE=20
style=3D"BORDER-LEFT: #0000ff 2px solid; MARGIN-LEFT: 5px; MARGIN-RIGHT: =
0px; PADDING-LEFT: 5px">
  <DIV align=3Dleft class=3DOutlookMessageHeader dir=3Dltr><FONT =
face=3DTahoma=20
  size=3D2>-----Original Message-----<BR><B>From:</B> =
tone.skoda at siol.net=20
  [mailto:tone.skoda at siol.net]<BR><B>Sent:</B> Sunday, May 26, 2002 8:58 =

  PM<BR><B>To:</B> EUforum<BR><B>Subject:</B> math=20
  =
combinations<BR><BR></DIV></FONT><PRE>=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
 The Euphoria Mailing List =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=20
</PRE>
  <DIV><FONT face=3DArial size=3D2>How would I write a routine which =
would shuffle=20
  all members in a sequence so that&nbsp;all possible combinations would =
be=20
  gotten?</FONT></DIV>
  <DIV><FONT face=3DArial size=3D2>Also, input sequence could have two =
or more equal=20
  members.</FONT></DIV>
  <DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
  <DIV><FONT face=3DArial size=3D2>For example, all combinations for =
{'a','b','c'}=20
  would=20
  =
be:<BR>{'a','b','c'}<BR>{'a','c','b'}<BR>{'b','a','c'}<BR>{'b','c','a'}<B=
R>{'c','b','a'}</FONT></DIV>
  <DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
  <DIV><FONT face=3DArial =
size=3D2></FONT>&nbsp;</DIV><PRE>=3D=3D^=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
This email was sent to: cklester at yahoo.com

EASY UNSUBSCRIBE click here: <A =
href=3D"http://topica.com/u/?b1dd66.b2Iiq0">http://topica.com/u/?b1dd66.b=
2Iiq0</A>
Or send an email to: EUforum-unsubscribe at topica.com

T O P I C A -- Register now to manage your mail!
<A =
href=3D"http://www.topica.com/partner/tag02/register">http://www.topica.c=
om/partner/tag02/register</A>
=3D=3D^=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D</PRE></BLOCKQUOTE></B=

------=_NextPart_000_000C_01C20504.40453280--

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

3. RE: math combinations

There is a little weakness in the Permutation function in R. Forno's Genfunc.e.
It does not correctly manage a sequence that contains sequences as elements.
You can convince yourself with the following:
------------------------------------------
include genfunc.e
sequence S
S = {{1},2,{3,4}}
for i = 1 to 6 do		-- 6 = 3! (factorial, the number of permutations of 3
objects)
	?Permutation(S,length(S),i)
end for
----------------------------------------
But the correction seems straightforward. 
In genfunc.e (version 1.3) on line 2072, replace:
    return set[a] & Permutation(set[1..a-1] & set[a+1..len], size - 1, which)
with:
    return {set[a]} & Permutation(set[1..a-1] & set[a+1..len], size - 1, which)


Have a nice day, all.

Henri Goffin

> -----Original Message-----
> From:	tone.skoda at siol.net [SMTP:tone.skoda at siol.net]
> Sent:	27 May, 2002 05:49
> To:	EUforum
> Subject:	Re: math combinations
> 
> 
> I figured it out now after I searched mailing list archives.
> 
> for i = 1 to 10 do
>     ?  Permutation({1, 2, 3}, 3, i)
> end for
> 
> Still an example for every function would be very nice.
> 
> ----- Original Message -----
> From: <tone.skoda at siol.net>
> To: "EUforum" <EUforum at topica.com>
> Sent: Monday, May 27, 2002 5:01 AM
> Subject: Re: math combinations
> 
> 
> >
> > Thanks, but I really don't know how to use that function.
> > It would       help   if it had examples cause with examples you can see
> the
> > most clear what something does.
> >
> > Here it is with all its documentation:
> >
> > Permutation(sequence set, integer size, integer which)
> > --Returns a sequence containing the permutation with size 'size',
> > -- numbered 'which', from the set 'set'.
> > --The set is any sequence of objects, and so is the result.
> > --'which' starts at 1 and goes to the number of existing permutations
> > -- of this size.
> > --In case 'which' is out of bounds, an atom containing -1 is returned.
> >
> > ----- Original Message -----
> > From: "Derek Parnell" <Derek.Parnell at SYD.RABOBANK.COM>
> > To: "EUforum" <EUforum at topica.com>
> > Sent: Monday, May 27, 2002 4:13 AM
> > Subject: RE: math combinations
> >
> >
> > >
> > > Have a look at Ricardo Forno's general utility package in th
> contributions
> > > page. It has a Permutations function in it which sounds like it might
> work
> > > for you.
> > >
> > > is uitsluitend bestemd voor de geadresseerde. Indien u dit bericht
> > > onterecht ontvangt wordt u verzocht de inhoud niet te gebruiken en
> > > de afzender direct te informeren door het bericht te retourneren.
> > > and is intended to be exclusively for the addressee. Should you
> > > receive this message unintentionally, please do not use the contents
> > > herein and notify the sender immediately by return e-mail.
> > >
> > >
> > >
> 
>

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

Search



Quick Links

User menu

Not signed in.

Misc Menu