Math Is Fun Forum

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

You are not logged in.

#76 Re: Coder's Corner » Random Latin Square generation » 2011-04-27 06:14:13

Here is another approach:

for each Row
   make a String of all numbers
   make a random permutation of the String
   attempt to apply the randomized String to a Row
   if there is a conflict with some of previously filled rows - make a new permutation and repeat applying process
next Row

It looks like this algorithm works always, for example if we filled two first rows with 1234 and 4123, then there is no way to put in the third row a string with "2.1." pattern.

The only problem here is that I cannot find a more or less rigorous proof that this algorithm will always work.
Also, it is a little time consuming, especially on the last rows there can be a lot of tries to find a permutation which would work. And even on a 9x9 grid and a fast computer I can see a delay. Any ideas on how to speed up the search for a next permutation which would satisfy the rules of Latin Square?

#77 Re: Coder's Corner » Random Latin Square generation » 2011-04-27 06:00:39

Here is one promising algorithm which does not work:

for each Number
   for each Row
        take a random Column with an empty cell in the Row
        check that all cells above it do not contain Number
        if this column already occupied by this Number - find a new Column and repeat.
        once non-occupied row is found write Number in the cell
   next Row
next Number

Problem here is that in some cases this algorithm can stuck:
Working with 4x4 board:
For number 1: put it in 1, 2, 3, 4 positions in rows
For number 2: put it in 2, 3, 1, .... No where to put 2 in fourth row

12..
.12.
2.1.
...1

Any ideas why this promising algorithm fails and how to improve it to prevent blocks like this?

#78 Coder's Corner » Random Latin Square generation » 2011-04-27 05:53:11

White_Owl
Replies: 3

For the purpose of number puzzles like Sudoku or KenKen first we need to generate a randomized Latin Square.
Squares like this:

1234
2341
3412
4321

are obviously no good.

So the question is: How to generate a randomized Latin Square?

#79 Help Me ! » Number of nodes in binary tree » 2010-10-14 09:21:05

White_Owl
Replies: 1

Problem:
Show that maximum number of nodes in a binary tree of height

is

My Answer:
In a binary tree each node has two children; therefore, number of nodes on each level is twice the number of nodes on the previous level. In a recursive form number of nodes on level

is:
. Or in a closed form:
, for
.
Therefore total number of nodes in a full binary tree is:

Using induction we can prove that

Basic step for
:
and

Inductive step: Assuming
is true, then
should also be true:

by inductive hypotheses
, so

Therefore:


And now my questions:
a) I think it is obvious that

  in closed form would be
. But to be completely thorough how to convert recursive form into closed one? (Link to a book chapter would be fine.) And do I need to do it in the first place?

b) I have a strong suspicion that it is possible to solve the original problem without resorting to induction and I went a little overboard with it. If yes, please point me into the right direction on how to solve this problem easier?

#80 Re: Help Me ! » Convert sum into equation » 2010-09-28 10:29:28

I am in Algorithm Analysis class right now.
I managed to convert the set of loops into the sum form, but stuck after it...
I have Rosen's Discreet Math book but can not find there any clues on this particular formula conversion.

I have very extensive practical computer programming background, but know I am trying to study the theoretical approach to computer science. Hence the strange questions...
My calculus days was more 20 years ago and stuff like integrals and derivatives - I know what it is about but can not calculate them on paper even if it kills me.

#81 Re: Help Me ! » Convert sum into equation » 2010-09-28 10:13:58

Since I do not understand your answer, the next question would be: "What books should I read?"

And what program do you use for this formula conversion?

#83 Help Me ! » Convert sum into equation » 2010-09-28 09:15:37

White_Owl
Replies: 7

I have a sum:


How to rewrite it without sum sign and i? In other words, I need to see it in f(N) form.

#84 Help Me ! » homeomorphy of graphs » 2010-04-22 06:47:34

White_Owl
Replies: 0

According to books (and most importantly my teacher), to determine is the graph a planar one or not, I have to homeomorphy it into K3,3 or K5.
I kinda understand how to do the homeoporphy, but once I start, I do not know in what direction should I try to morph the graph, towards K3,3 or K5...
Does anyone know a good tutorial on homeomorphism?
Also, does anyone know a good freeware application which allows to play with graphs?

#85 Re: Help Me ! » functions and relations » 2010-04-20 01:39:04

Amarylli$ wrote:

i have a R as such {A -> 1, A ->2, A -> 3, B -> 2, B -> 3, C -> 3}

my domain of R is {A, B, C} or {A, A, A, B, B, C} ?

I am a little shaky on this topic myself, but...
Your R is from set {A, B, C} to set {1, 2, 3}. So the domain would be a union of those two sets: {A, B, C, 1, 2, 3}

#86 Help Me ! » Composition of relationships » 2010-04-14 10:00:51

White_Owl
Replies: 1

If we have:


What is the compositions of all those relationships to each other?
As far as I understand, all six compositions
,
, etc are equal to
.
Am I correct?

#87 Re: Help Me ! » Probability of items in three shifts » 2010-04-09 01:55:36

Imagine that each one shift produces a hundred items. The first shift produced 100 total and 1%=one item from the produced hundred is defective. The second shift: 100 total and 2%=2 items are defective. Same for the third shift. So in total, during the day, all three shifts produced 100*3=300 items. From this 300, there were 1+2+5=8 defective items. 8 items of 300 is 2.(6)%
Or, since all shifts are equal, you can simply take the average of three, but this solution would work only for equal shifts.

#88 Re: Help Me ! » three zeros in a row » 2010-04-02 03:11:43

Thank you.
Somehow I always overlook the approach by cases sad

So the recursive form should be something like this:


which can be somewhat simplified into:

hmmm.... interesting...

And now I'll embark on the quest to convert this into closed form. Wish me luck... and brain.

#89 Help Me ! » three zeros in a row » 2010-04-01 10:04:45

White_Owl
Replies: 5

The problem is: How many bit strings of length n contains three zeros in a row?
Just by brute force listing of strings I got the numbers 1, 3, 8, 20, 47, 107, 238, 520, 1121 for n=3...11.
Now I'd like to make recursive and closed-form functions to calculate those numbers, but no luck for two days...

#91 Re: Help Me ! » To solve recurrence relations by iterations » 2010-03-30 01:44:10

Izmael wrote:

I don't understand, what you want to solve. I assume that you want to find an explicit formula for your reccurence.

Yes. I work with Rosen's book "Discrete Mathematics and Its Applications"; in it the wording of the problem is "to solve the recurrence". But yes, the task is actually to convert a recurrence form into a normal function.

Izmael wrote:

Then we have

I see one difference in our approaches: you went backward (or forward?) starting from the

, not from
as was suggested by my textbook... hmm...

#92 Help Me ! » non-homogeneous recurrence with a constant for F(n) » 2010-03-29 09:58:27

White_Owl
Replies: 2

If I have a non-homogeneous recurrence with a constant for F(n):


The associated homogeneous solution is

But what is the 'particular' solution?

If I try to calculate particular solution through

, I am getting:

And at the end I receive:

Which is obviously not a correct answer...
What am I doing wrong?

#93 Help Me ! » To solve recurrence relations by iterations » 2010-03-29 06:51:02

White_Owl
Replies: 2

I have a recurrence relation:


So I am trying to write an iterative equation:

If I understand correctly, at the end I should get an expression from
, but how?

Just by looking at the iteration steps and some playing around I came up with the equation:


But I do not understand what is the 'correct' way of finding that equation?

#95 Re: Help Me ! » Distinguishable objects in indistinguishable bins » 2010-03-25 09:04:55

Ok... I finished the chapter 5.5 and at the end of it I found the description of this formula. So I tried to do a manual calculation and received -41 (negative 41)... After a while I realized that I made a mistake in writing formula down and replaced the i with j in one place (powered -1 before the binom).
But now I have an interesting equality:


I wonder, is it correct or not? How do we prove the equations with
in it? By induction?

#96 Re: Help Me ! » same area different perimeter » 2010-03-25 01:55:56

Obviously, there are infinite number of the rectangles with the area of 100 square inches. And only one of them is square, that is a rectangle with sides equal 10", and perimeter 4*10"=40". Therefore, the 'first' rectangle is a square. Since there are can be only square between all rectangles with same areas, we conclude that 'second' rectangle is not a square.

#97 Re: Help Me ! » Boolean Algebra Equivelance » 2010-03-24 02:10:12

To get rid of implication arrow you can use the conversion rule


BTW, I am not sure this rule has a name.
So the expression in the first brackets should be converted:

And the second step is using De Morgans law


#98 Re: Help Me ! » Distinguishable objects in indistinguishable bins » 2010-03-24 01:52:20

bobbym wrote:

It is just the sum of the stirling numbers of the second kind.

The problem with "stirling number of the second kind" is that I did not read about them yet smile

bobbym wrote:

Actually soroban did a really nice job on this problem.

Yes, he sure did.

#99 Re: Help Me ! » Distinguishable objects in indistinguishable bins » 2010-03-23 02:24:18

soroban, Sorry, you made two mistakes:

soroban wrote:




soroban wrote:

And here you forgot the very first case with all objects together. So the final summation should be

#100 Re: Help Me ! » Distinguishable objects in indistinguishable bins » 2010-03-23 01:42:54

bobbym wrote:

Here is how I get 41:


To distribute n distinguishable objects into k indistinguishable bins.

Wow! Now I would need another week to decipher it.
Thank you.

Board footer

Powered by FluxBB