Divide 9×3 rect into 8 equal size square [closed] - math

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 10 years ago.
Improve this question
You whip up your favorite brownie recipe and pour into your new 9×3 inch baking dish. The brownies bake. The toothpick comes out clean. Now for the cutting.
A square is the most delicious shape for a brownie. You have eight people to serve. How can you cut your newly baked creation into exactly eight square pieces?

So this is essentially a variation on a bin packing problem (which is well known to be NP-hard!).
One solution is to use 2 3x3 squares, 1 2x2 square and 5 1x1 squares, as follows:
The solution is obviously non-unique, since the positions of the various squares can be permuted around.
Due to the NP-hardness I imagine it would be difficult to come up with an efficient algorithm to divide a general NxM rectangle into k square pieces exactly. In fact there must be whole families of parameter values for which no solution is possible (for instance if you started with an 6x1 rectangle it would be impossible to divide into anything less than 6 squares...).

Related

How do I analyze movement between points in R? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about programming within the scope defined in the help center.
Closed 8 years ago.
Improve this question
So I have a lot of points, kind of like this:
animalid1;A;time
animalid1;B;time
animalid1;C;time
animalid2;A;time
animalid2;B;time
animalid2;A;time
animalid2;B;time
animalid2;C;time
animalid3;A;time
animalid3;B;time
animalid3;C;time
animalid3;B;time
animalid3;A;time
What I want to do is to first of all make R understand that the points A,B,C are connected. Then I want to get comparisons of movement from A to C and how long time it takes, how many steps were used, etc. So maybe I have a movement sequence like ABC on 20 animals and then ABABC on 10 animals and then ABCBA on 5 animals. I want to get some sort of statistical test done to see if the total time is different between these groups, and so on.
I bet this has been done before. But my Google skills are not good enough to find it.
Look at the msm package (msm stands for Multi State Model). Given observations of states at different times it will estimate probabilities of transitions and average time in the different states.

Would this be considered a fractal? [closed]

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 9 years ago.
Improve this question
I was wondering if this would be considered a fractal or just a recursive shape. It seems like it is to me, but our lab says "However, it is not just enough that the shape was generated by some recursive process, because there are shapes you could generate recursively which are not fractals," but it also explains more. To me, it seems like it is, but I just wanted to make sure.
Thank you very much!
No, it is not a fractal, because it doesn't demonstrate self-similarity. See: http://mathworld.wolfram.com/Fractal.html
A fractal has recursive properties, but not all recursive figures are fractals.
Here's what my rule of thumb is to decide whether a shape is a fractal or not:
Zoom into the object by a factor of X (say).
Count how many copies of the original object are in the zoomed-in version, let's call it N.
The dimension of the object is the logarithm of N, to the base X.
Eg: Zoom into a square by a factor of 2, you'll have 4 copies of the square that "fit inside" the larger square. Since log 4 (base 2) is 2, hence this is a 2D object.
Look at the Koch curve:
Zooming in 3x will give you 4 copies of the original curve, hence its "dimension" is log 4 (base 3), which is a number between 1 and 2... a fractional dimension, (hence the name fractal).
Applying this rule to your recursive figure, if you zoom in 2x, you will still see the original figure (N = 1). Its dimension works out to be log 1 (base 2), which is zero.
Since zero is not a fraction, therefore your figure is not a fractal.

Finding private Key x Big integers [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
Well is it possible to find private key x for this equation y=g^x mod p of course big integers if you have p ,g, y, q?.
What method can be used if there is method to find it out? ..........Note:These are big Integers
This is called the discrete logarithm problem. You seem to be interested in the prime field special case of this problem.
For properly chosen fields with sufficiently large p this is infeasible. I expect this to be reasonably cheap (100$ or so) for 512 bit p and extremely expensive at 1024 bit p. Going beyond that it quicky becomes infeasible even for state level adversaries.
For some fields it's much cheaper. For example solving DL in binary fields (not prime fields as in your example) produced quite a few recent papers. For example Discrete logarithm in GF(2^809) with FFS and On the Function Field Sieve and the Impact of Higher Splitting Probabilities: Application to Discrete Logarithms in F_2^1971.

Uniform Random Selection with Replacement [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about programming within the scope defined in the help center.
Closed 6 years ago.
Improve this question
Suppose you have a deck of 100 cards, with the numbers 1-100 on one side. You select a card, note the number, replace the card, shuffle, and repeat.
Question #1: How many cards (on average) must you select to have drawn the same card twice? Why?
Question #2: How many cards (on average) must you select to have drawn all of the cards at least once? Why?
(thanks, it has to do with random music playlists and making the option to not repeat the shuffle, as it were)
Q1: Relates to Birthday paradox problem
As you see in the collision problem section(in wikipedia link above), your question maps exactly.
Cast as a collision problem
The birthday problem can be generalized as follows: given n random integers drawn from a discrete uniform distribution with range [1,d], what is the probability p(n;d) that at least two numbers are the same? (d=365 gives the usual birthday problem.)
You have a range [1,100] from which you select random cards. The probability of collision(two selected cards are the same) is given as p(n;d) = ...
Further down, we have formula for average/expected number of selections as
Q(100) gives your answer.

Generating an entertaining blinking pattern for a 1D LED arrangement [closed]

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 11 years ago.
Improve this question
I want to actuate a hardware featuring a set of 16 LEDs, arranged in a square:
X X X X X
X X
X X
X X
X X X X X
While I can solve the technical details (timer, bit masking, etc.), I am stuck with an artistic question.
What would be a good algorithm for generating an activation pattern (over time) which is entertaining for a human observer?
I don't want to go for a totally random pattern, but also not for something too predictive. Any suggestions, especially with compact generator algorithms are welcome.
LEDs are binary (on/off) and single color, but I could install different LEDs of single color (red,green,yellow).
Some proposals:
Wandering dots which react with each other
More generally, cellular automata
Simple hypnotic patterns (regular, symmetric or rotating, filling up)
Morse code
Random bit patterns (LFSR)
To keep it interesting you can implements several animations and switch between them.
Full disclosure: This advice was given after a weekend at Das Labor in Bochum.

Resources