List Archives > 
Maple User Group List Archive > 
Archive by date > 
This Month By Date > 
This Month By Topic
[MUG] Set And List Problem
| [MUG] Set And List Problem |
|
Author: UKC Account
Posted: Mon, 28 Oct 2002 17:20:12 +0100
|
>> From: "UKC Account" "crp3"
I have this question on an assignment to do with sets and lists. It
reads:
'Let A be the set {1,2,3,...,25}. Create the set, B, of all subsets of A
of size 2 containging at least one odd integer (So {1,2} and {1,3} are
elements of B but {2,4} is not an element of B). Determine the number of
elements in B.'
I've set up the set A, but can't get Maple to list all of the subsets
with at least one odd integer. I know there are 244 different
combinations, but need to get Maple to display this using the 'nops'
function. Can anyone give me a hand?
Claire Pollard
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.401 / Virus Database: 226 - Release Date: 10/9/02
|
| [MUG] Re: Set And List Problem |
|
Author: Maple User Group
Posted: Fri, 1 Nov 2002 10:23:57 -0500 (
|
>> From: Maple User Group "maple_gr"
| >> From: "UKC Account" "crp3"
| I have this question on an assignment to do with sets and lists. It
| reads:
| 'Let A be the set {1,2,3,...,25}. Create the set, B, of all subsets of A
| of size 2 containging at least one odd integer. Determine the number of
| elements in B.'
-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-
Date: Tue, 29 Oct 2002 14:30:54 -0500
From: Bill Bauldry "BauldryWC"
Subject: Set And List Problem
To: "maple-list"
You could try something like:
> with(combinat):
Warning, the protected name Chi has been redefined and unprotected
> OddInt := x -> convert(map(type,x, odd), `or`);
> Size := n -> (x -> evalb(nops(x)=n));
OddInt := x -> convert(map(type, x, odd), `or`)
Size := n -> x -> evalb(nops(x) = n)
> P5 := powerset({$1..5});
P5 := {{}, {1, 4, 5}, {1, 2, 4, 5}, {2, 4, 5}, {2, 3, 4, 5},
{3, 4, 5}, {1, 3, 4, 5}, {1, 2, 3, 4, 5}, {4, 5}, {3, 5},
{2, 3, 5}, {1, 2, 3, 5}, {1, 3, 5}, {1, 5}, {2, 5}, {1, 2, 5},
{1}, {5}, {2}, {1, 2}, {3}, {1, 3}, {2, 3}, {1, 2, 3}, {4},
{1, 4}, {2, 4}, {1, 2, 4}, {3, 4}, {1, 3, 4}, {2, 3, 4},
{1, 2, 3, 4}}
> TheOdds := select(OddInt, P5);
> TheEvens := remove(OddInt, P5);
TheOdds := {{1, 4, 5}, {1, 2, 4, 5}, {2, 4, 5}, {2, 3, 4, 5},
{3, 4, 5}, {1, 3, 4, 5}, {1, 2, 3, 4, 5}, {4, 5}, {3, 5},
{2, 3, 5}, {1, 2, 3, 5}, {1, 3, 5}, {1, 5}, {2, 5}, {1, 2, 5},
{1}, {5}, {1, 2}, {3}, {1, 3}, {2, 3}, {1, 2, 3}, {1, 4},
{1, 2, 4}, {3, 4}, {1, 3, 4}, {2, 3, 4}, {1, 2, 3, 4}}
TheEvens := {{}, {2}, {4}, {2, 4}}
> Odd2 := select(Size(2), TheOdds);
> Even2 := select(Size(2), TheEvens);
Odd2 := {{4, 5}, {3, 5}, {1, 5}, {2, 5}, {1, 2}, {1, 3}, {2, 3},
{1, 4}, {3, 4}}
Even2 := {{2, 4}}
Regards,
Bill
______________________________________
Wm C Bauldry, PhD
Professor and Chairperson
Department of Mathematical Sciences
Appalachian State University
121 Bodenheimer Dr
Boone, NC 28608-2092
_____________________
phone: (828) 262-3050
fax: (828) 265-8617
"mailto:BauldryWC"
http://www.mathsci.appstate.edu/~wmcb/
______________________________________
-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-
Date: Tue, 29 Oct 2002 15:09:48 -0500 (EST)
From: Carl Devore "devore"
To: "maple-list"
Subject: Set And List Problem
A:= {$1..25};
B:= combinat[choose](A,2) minus combinat[choose]({2*k $ k= 1..12}, 2);
The answer is 234, not 244:
25*24/2 - 12*11/2;
-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-
Date: Tue, 29 Oct 2002 17:37:14 -0600
From: "ayon"
To: "maple-list"
Subject: Set And List Problem
I'm not secure if the next approaches are correct solutions to your question,
but in both cases the number of combinations appears to be 234:
> A:={$1..25};
C:=select( type, A, odd );
A := {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18,
19, 20, 21, 22, 23, 24, 25}
C := {1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25}
> B:={seq( seq( {C[i],j}, j=A minus C[1..i] ), i=1..nops(C) )}:
> nops(B);
234
The other approach is:
> {seq( seq( {i,j}, j=A minus {i} ), i=A )}:
B:=select( hastype, %, odd ):
nops(B);
234
Eloy Ayon-Beato
Physics Department
CINVESTAV-IPN
-------------------------------------------------
This mail sent through IMP: http://horde.org/imp/
-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-
Date: Tue, 29 Oct 2002 00:48:41 -0400
From: C W "sylvester7"
To: "maple-list" "crp3"
Subject: Set And List Problem
Try this :
R:=rand(25):
FS:=(proc(lO,lE) local
vO,vE;{op(combinat[choose](lO,2)),seq(seq({vO,vE},vO=lO),vE=lE)} end)@(proc(S)
(select,remove)(type,S,odd) end):
S:={seq(R(),i=1..12)};SS:=FS(S);nops(SS);
Chris
-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-
From: "Daniel Willard" "willardd"
To: "maple-list"
Subject: Set And List Problem
Date: Wed, 30 Oct 2002 10:06:48 -0500
In Abramowitz and Stegun "Handbook of Mathematical Functions"
(Published by the National Institute for Science and Technology - ex
NBS) you will find a discussion of functions very like the ones you
want.
|
Previous by date: [MUG] Maple 8 under Debian GNU/Linux, Curtis Vinson
Next by date: [MUG] solving inequality, M A Suzen
Previous thread: [MUG] How to plot with a constraint on the domain, Anders Poulsen
Next thread: [MUG] solving inequality, M A Suzen
|