| Author |
Message |
Markus Dehmann science forum beginner
Joined: 29 Mar 2006
Posts: 1
|
Posted: Wed Mar 29, 2006 3:51 am Post subject:
mupad: n choose k?
|
|
|
Does anyone know how to do n choose k in mupad? I couldn't find it, not
even in the combinat package.
Thanks,
Markus |
|
| Back to top |
|
 |
Joe Riel science forum beginner
Joined: 22 Jun 2005
Posts: 19
|
Posted: Wed Mar 29, 2006 5:27 am Post subject:
Re: mupad: n choose k?
|
|
|
"Markus Dehmann" <markus.dehmann@gmail.com> writes:
| Quote: | Does anyone know how to do n choose k in mupad? I couldn't find it, not
even in the combinat package.
I don't know mupad, but does it have a binomial function? |
--
Joe Riel |
|
| Back to top |
|
 |
Mark Lawton science forum beginner
Joined: 22 Mar 2006
Posts: 11
|
Posted: Wed Mar 29, 2006 8:32 am Post subject:
Re: mupad: n choose k?
|
|
|
You can write your own functions. I don't know how to do this in Mupad,
but here's a Maxima example:
Define a "combinations" function
(%i6) c(x,y) := x!/((x-y)! * y!);
(%o6) c(x,y):=x!/((x-y)!*y!)
Use it to calculate the number of ways to select 6 from 49 where the
order is not important (which equates to the odds of winning a
"Canadian style" lottery)
(%i7) c(49,6);
(%o7) 13983816
See
http://en.wikipedia.org/wiki/Permutations_and_combinations#Summary_of_formulae
for other combinatorical formulae.
Markus Dehmann wrote:
| Quote: | Does anyone know how to do n choose k in mupad? I couldn't find it, not
even in the combinat package.
Thanks,
Markus |
|
|
| Back to top |
|
 |
Brad Cooper science forum beginner
Joined: 07 May 2005
Posts: 48
|
Posted: Wed Mar 29, 2006 10:51 am Post subject:
Re: mupad: n choose k?
|
|
|
"Markus Dehmann" <markus.dehmann@gmail.com> wrote in message
news:1143604309.689537.226230@e56g2000cwe.googlegroups.com...
| Quote: | Does anyone know how to do n choose k in mupad? I couldn't find it, not
even in the combinat package.
|
I think you require (for example)...
combinat::subsets::count(6,3);
This returns 20 as the number of combinations of 3 objects chosen from 6
i.e. 6!/(3!x3!)
Cheers, Brad
|
|
| Back to top |
|
 |
Jay Belanger science forum beginner
Joined: 12 Sep 2005
Posts: 13
|
Posted: Wed Mar 29, 2006 1:29 pm Post subject:
Re: mupad: n choose k?
|
|
|
Joe Riel <joer@k-online.com> writes:
| Quote: | "Markus Dehmann" <markus.dehmann@gmail.com> writes:
Does anyone know how to do n choose k in mupad? I couldn't find it, not
even in the combinat package.
I don't know mupad, but does it have a binomial function?
|
Yes; good call.
| Quote: | binomial(10,4)
will return 10 choose 4. |
Jay |
|
| Back to top |
|
 |
Google
|
|
| Back to top |
|
 |
|