Discussion about math, puzzles, games and fun.   Useful symbols: ÷ × ½ √ ∞ ≠ ≤ ≥ ≈ ⇒ ± ∈ Δ θ ∴ ∑ ∫  π  -¹ ² ³ °

You are not logged in.

## #1 2013-10-05 22:34:01

bobbym
From: Bumpkinland
Registered: 2009-04-12
Posts: 104,333

### A stumper?

Hi;

This came up on another discussion group. Here I will show how easy this is to do with mathematica.

There are 5 different red balls, 5 different green balls, 5 different blue balls and 5 different black balls. In how many ways can they be arranged so that no two balls of same color are adjacent ?

The whole problem condenses down to this expression. ( I want to thank Robert Israel for showing me this idea.)

This produces an extremely large polynomial in 4 variables. The coefficient of

is the answer. We get it with the extremely powerful command:

Coefficient[ans, w^5 x^5 y^5 z^5]

In mathematics, you don't understand things. You just get used to them.
If it ain't broke, fix it until it is.
A number by itself is useful, but it is far more useful to know how accurate or certain that number is.

Online

## #2 2013-10-06 00:19:58

anonimnystefy
Real Member
From: Harlan's World
Registered: 2011-05-23
Posts: 16,015

### Re: A stumper?

How does it work?

Here lies the reader who will never open this book. He is forever dead.
Taking a new step, uttering a new word, is what people fear most. ― Fyodor Dostoyevsky, Crime and Punishment
The knowledge of some things as a function of age is a delta function.

Offline

## #3 2013-10-06 00:23:32

bobbym
From: Bumpkinland
Registered: 2009-04-12
Posts: 104,333

### Re: A stumper?

It looks like it is the matrix version of a gf. How it works, I never did figure out, but I can use it.

In mathematics, you don't understand things. You just get used to them.
If it ain't broke, fix it until it is.
A number by itself is useful, but it is far more useful to know how accurate or certain that number is.

Online

## #4 2014-03-17 23:56:29

gAr
Member
Registered: 2011-01-09
Posts: 3,479

### Re: A stumper?

Hi,

I think I got a hang of doing things in J.

Here's a simulation for an approximate answer:

``````sim=: 3 : '0=+/+/(2 4 8 16)=/2+/\(20?20){5#1 2 4 8'
((!20)%(!5)^4)*(+/%#)(sim "0) 1000000#0``````

= 135712661.692608

"Believe nothing, no matter where you read it, or who said it, no matter if I have said it, unless it agrees with your own reason and your own common sense"  - Buddha?

"Data! Data! Data!" he cried impatiently. "I can't make bricks without clay."

Offline

## #5 2014-03-18 02:51:13

bobbym
From: Bumpkinland
Registered: 2009-04-12
Posts: 104,333

### Re: A stumper?

Hi gAr;

That is close!

In mathematics, you don't understand things. You just get used to them.
If it ain't broke, fix it until it is.
A number by itself is useful, but it is far more useful to know how accurate or certain that number is.

Online

## #6 2014-03-18 03:09:49

gAr
Member
Registered: 2011-01-09
Posts: 3,479

### Re: A stumper?

Hi,

Yes!
Is there any command in Mm to get moving averages?

"Believe nothing, no matter where you read it, or who said it, no matter if I have said it, unless it agrees with your own reason and your own common sense"  - Buddha?

"Data! Data! Data!" he cried impatiently. "I can't make bricks without clay."

Offline

## #7 2014-03-18 03:22:25

bobbym
From: Bumpkinland
Registered: 2009-04-12
Posts: 104,333

### Re: A stumper?

M, is bloated to the extreme. There is command for everything. Whenever I do not find a command that does exactly what I want I always think I did not look in the right place!

Try MovingAverage in the help.

In mathematics, you don't understand things. You just get used to them.
If it ain't broke, fix it until it is.
A number by itself is useful, but it is far more useful to know how accurate or certain that number is.

Online

## #8 2014-03-18 04:08:09

gAr
Member
Registered: 2011-01-09
Posts: 3,479

### Re: A stumper?

Ah, yes!
I should have searched before asking!

"Believe nothing, no matter where you read it, or who said it, no matter if I have said it, unless it agrees with your own reason and your own common sense"  - Buddha?

"Data! Data! Data!" he cried impatiently. "I can't make bricks without clay."

Offline

## #9 2014-03-18 04:09:15

bobbym
From: Bumpkinland
Registered: 2009-04-12
Posts: 104,333

Hi;