Math Is Fun Forum

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

You are not logged in.

#126 2012-04-30 07:58:36

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

Re: Generating Functions

I did use my function:

Input:

list : [6,6,6,6]$
expand(CombOGF(list)/6^4);

Output:

x^24/1296+x^23/324+(5*x^22)/648+(5*x^21)/324+(35*x^20)/1296+(7*x^19)/162+(7*x^18)/108+(29*x^17)/324+(149*x^16)/1296+(5*x^15)/36+(103*x^14)/648+(14*x^13)/81+(77*x^12)/432+(14*x^11)/81+
(103*x^10)/648+(5*x^9)/36+(149*x^8)/1296+(29*x^7)/324+(7*x^6)/108+(7*x^5)/162+(35*x^4)/1296+(5*x^3)/324+(5*x^2)/648+x/324+1/1296

And the term with exponent 20 has the coefficient of 35/1296.

Last edited by anonimnystefy (2012-04-30 08:00:36)


“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

#127 2012-04-30 08:05:40

bobbym
bumpkin
From: Bumpkinland
Registered: 2009-04-12
Posts: 109,606

Re: Generating Functions

Now supposing 2 die had faces of 2,4,6,8,10,12 and 2 other die had faces of 1,3,5,7,9,11.
All four die are thrown once. What is the probability of them summing to 20 or more?


In mathematics, you don't understand things. You just get used to them.
If it ain't broke, fix it until it is.
Always satisfy the Prime Directive of getting the right answer above all else.

Offline

#128 2012-04-30 08:15:03

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

Re: Generating Functions

493/648?


“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

#129 2012-04-30 08:19:42

bobbym
bumpkin
From: Bumpkinland
Registered: 2009-04-12
Posts: 109,606

Re: Generating Functions

That is not correct.


In mathematics, you don't understand things. You just get used to them.
If it ain't broke, fix it until it is.
Always satisfy the Prime Directive of getting the right answer above all else.

Offline

#130 2012-04-30 08:31:03

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

Re: Generating Functions

Thought so. hmm


“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

#131 2012-04-30 08:32:33

bobbym
bumpkin
From: Bumpkinland
Registered: 2009-04-12
Posts: 109,606

Re: Generating Functions

What did you have a problem with?


In mathematics, you don't understand things. You just get used to them.
If it ain't broke, fix it until it is.
Always satisfy the Prime Directive of getting the right answer above all else.

Offline

#132 2012-04-30 09:01:19

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

Re: Generating Functions

Altering the code to acompany the numbers on the dice.


“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

#133 2012-04-30 09:04:08

bobbym
bumpkin
From: Bumpkinland
Registered: 2009-04-12
Posts: 109,606

Re: Generating Functions

There is a rather succinct method to do that in mathematics. It is called
summation notation. It is perfect. It is implemented in Maxima. That is why I suggested you use
math commands to do math tasks.


In mathematics, you don't understand things. You just get used to them.
If it ain't broke, fix it until it is.
Always satisfy the Prime Directive of getting the right answer above all else.

Offline

#134 2012-04-30 09:07:46

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

Re: Generating Functions

I did use the summation un a part of my code.


“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

#135 2012-04-30 09:10:42

bobbym
bumpkin
From: Bumpkinland
Registered: 2009-04-12
Posts: 109,606

Re: Generating Functions

But you did not use parameters with the summation. Then the code is simple, fast and
complete.


In mathematics, you don't understand things. You just get used to them.
If it ain't broke, fix it until it is.
Always satisfy the Prime Directive of getting the right answer above all else.

Offline

#136 2012-04-30 21:43:42

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

Re: Generating Functions

Iwill try today you function. But I do not like that I have to type everything agin to make a GF for more dice.Here for 100 dice,I could just make code (agin to your disliking) to make me a list of 100 omes. I just put that list into my function and I am done.


“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

#137 2012-04-30 21:48:06

bobbym
bumpkin
From: Bumpkinland
Registered: 2009-04-12
Posts: 109,606

Re: Generating Functions

You are misunderstanding my reasoning. It is not an arbitrary decision. It is not bobbym's
function.

1) Built in functions are faster and use less memory than procedural code.

2) Your function can not handle gf's that increment by more than one. Remember yours
did not get the right answer.

3) Supposing you were throwing 10 million die? Do you want to create a list of
10 million numbers? My function does not grow in size when the problem does


In mathematics, you don't understand things. You just get used to them.
If it ain't broke, fix it until it is.
Always satisfy the Prime Directive of getting the right answer above all else.

Offline

#138 2012-04-30 21:56:18

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

Re: Generating Functions

The first one is right.

The second one is not correct. I made a new one that uses the parameter n for the increment.

Third one is also right.

4)Is yyour function applicable to dice with more sides?


“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

#139 2012-04-30 21:58:44

bobbym
bumpkin
From: Bumpkinland
Registered: 2009-04-12
Posts: 109,606

Re: Generating Functions

Of course!

About 2) Your new function is probably larger, uses more memory and is slightly slower.
In mine it easy to do things like that with no overhead increase. Bet it took you a couple of hours to
add your addition. In mine additions are part of the notation.


In mathematics, you don't understand things. You just get used to them.
If it ain't broke, fix it until it is.
Always satisfy the Prime Directive of getting the right answer above all else.

Offline

#140 2012-04-30 22:19:34

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

Re: Generating Functions

Nope,just one multiplication by n.


“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

#141 2012-04-30 22:35:57

bobbym
bumpkin
From: Bumpkinland
Registered: 2009-04-12
Posts: 109,606

Re: Generating Functions

But I hope you can see that the one I want you to use is smaller.


In mathematics, you don't understand things. You just get used to them.
If it ain't broke, fix it until it is.
Always satisfy the Prime Directive of getting the right answer above all else.

Offline

#142 2012-05-01 08:37:55

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

Re: Generating Functions

Yes,I will try your way.


“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

#143 2012-05-01 19:26:04

bobbym
bumpkin
From: Bumpkinland
Registered: 2009-04-12
Posts: 109,606

Re: Generating Functions

Is there something done?


In mathematics, you don't understand things. You just get used to them.
If it ain't broke, fix it until it is.
Always satisfy the Prime Directive of getting the right answer above all else.

Offline

#144 2012-05-01 22:41:57

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

Re: Generating Functions

Not yet. No access to Maxima yet. hmm


“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

#145 2012-05-02 02:13:43

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

Re: Generating Functions

Hi bobbym

Check out this link:A pdf file on GFs in counting problems

It isn't very much,but does explain some crucial things.


“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

#146 2012-05-02 02:50:30

bobbym
bumpkin
From: Bumpkinland
Registered: 2009-04-12
Posts: 109,606

Re: Generating Functions

Hi anonimnystefy;

I disagree it is quite good.


In mathematics, you don't understand things. You just get used to them.
If it ain't broke, fix it until it is.
Always satisfy the Prime Directive of getting the right answer above all else.

Offline

#147 2012-05-02 02:56:17

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

Re: Generating Functions

Who said it wasn't good. Everything that you need is in there. Maybe a few more solved harder examples and it would be even better.

Hay,I found somewhere a GF for partitions of a number but I disagree with the formula. Could you post the partition GF you think is right?


“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

#148 2012-05-02 03:18:36

bobbym
bumpkin
From: Bumpkinland
Registered: 2009-04-12
Posts: 109,606

Re: Generating Functions

Depends on what you are partitioning.


In mathematics, you don't understand things. You just get used to them.
If it ain't broke, fix it until it is.
Always satisfy the Prime Directive of getting the right answer above all else.

Offline

#149 2012-05-02 03:20:18

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

Re: Generating Functions

Partitions of a number.


“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

#150 2012-05-02 03:21:15

bobbym
bumpkin
From: Bumpkinland
Registered: 2009-04-12
Posts: 109,606

Re: Generating Functions

Which numbers?


In mathematics, you don't understand things. You just get used to them.
If it ain't broke, fix it until it is.
Always satisfy the Prime Directive of getting the right answer above all else.

Offline

Board footer

Powered by FluxBB