Math Is Fun Forum

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

You are not logged in.

#126 Re: Exercises » Probability-1 » 2014-04-05 16:54:00

gAr

Hi bobbym,

And a J simulation:

   
pos=.40$1+i.7
cards=.4#1+i.10
sim=: 3 : '0=+/((40?40){cards)=pos'
(+/%#)(sim"0)100000#0

#128 Re: Exercises » Probability-1 » 2014-04-05 15:17:32

gAr

Hi ShivamS,

Hi bobbym,

#130 Re: Exercises » Probability-1 » 2014-04-05 01:16:29

gAr

Ah, okay then. I wasn't sure which definition to hold true. Thanks for the clarification.

You're welcome.

#132 Re: Exercises » Probability-1 » 2014-04-05 00:59:18

gAr

Mmm, yes. I wanted to tell 1+ (pos# mod 7), I overlooked it.

#133 Re: Coder's Corner » any other way to unlock password protected rar files.... » 2014-04-04 18:53:48

gAr

I suppose you got it from a torrent.
Even if you manage to crack the password, it may not actually have the data you expect.
Never download huge compressed files, unless you're sure it's not password protected.

#135 Re: Coder's Corner » Facebook releases 'Hack' » 2014-04-04 18:40:26

gAr

I thought those evils only use people.

Production means the servers used to interact with the users.

#139 Exercises » Probability-1 » 2014-04-03 23:03:10

gAr
Replies: 91


A pack of forty cards numbered 1-10 and four suits are well shuffled and placed face up on the floor.
After placing the cards sequentially, the positions are numbered like this
[1, 2, 3, 4, 5, 6, 7, 1, 2, 3, 4, 5, 6, 7, 1, 2, 3, 4, 5, 6, 7, 1, 2, 3, 4, 5, 6, 7, 1, 2, 3, 4, 5, 6, 7, 1, 2, 3, 4, 5]
A card numbered 1 must not occupy a position numbered 1, and same restriction for cards 2-7. Cards 8-10 are free to be placed anywhere.
What's the probability of such an arrangement?

#141 Re: Computer Math » Sage » 2014-04-03 20:06:14

gAr

Why does the simplest idea not work but the complicated ones do?

Why, wan't #7 simple?

#142 Re: Computer Math » Sage » 2014-04-03 19:34:38

gAr

Wait, an easier workaround!

solve([y==sqrt(x-1),y==sqrt(x+1)-1],x,y)

[[x == (5/4), y == (1/2)]]
which is just perfect!

#143 Re: Computer Math » Sage » 2014-04-03 19:30:50

gAr

Ah, I was using the code from here
Did not eliminate sqrt completely, so needs to be modified.

#144 Re: Computer Math » Sage » 2014-04-03 19:12:55

gAr

Hi,

Its syntax is

solve([sqrt(x-1)-sqrt(x+1)==-1],x)

But it doesn't solve it though, Sage and maxima seems to have a problem when square roots are involved like that.
That has frustrated me a few times.
So we need to either manually eliminate the roots or write a program to eliminate roots, and then give that equation to solve.
Introduces some extra solutions, so we need to weed out the extras later.

For now, use this input instead:

solve([(8*sqrt(x + 1)*sqrt(x - 1)*x)^2==(8*x^2 - 5)^2],x)

[x == (-5/4), x == (5/4)]
So, for the original equation, x=5/4

#145 Re: Computer Math » Finite State Machines / Directed Graphs for counting problems » 2014-04-03 19:03:06

gAr

Hi bobbym,

You're welcome!

Hi ElainaVW,

Hope that you both enjoyed as much as I did!


It gets rid of the dreadful casework to come up with a recurrence, in some problems it's even hardly possible.
I think it's also possible to solve tiling problems like this.

#149 Re: Computer Math » Finite State Machines / Directed Graphs for counting problems » 2014-04-02 17:24:28

gAr

Looks like you subtracted from a ones-matrix!

Even maxima gets it right:

am:matrix(
[0 , 0 , 1 , 6 , 1 , 1],
[0 , 1 , 1 , 6 , 1 , 1],
[0 , 1 , 1 , 6 , 1 , 1],
[0 , 1 , 1 , 6 , 1 , 1],
[0 , 1 , 1 , 6 , 1 , 0],
[0 , 1 , 1 , 6 , 0 , 1]
)$
id:matrix(
 [1,0,0,0,0,0], 
 [0,1,0,0,0,0], 
 [0,0,1,0,0,0], 
 [0,0,0,1,0,0], 
 [0,0,0,0,1,0], 
 [0,0,0,0,0,1]
)$
iam:invert(id-x*am)$
ratsimp(sum(iam[1,i],i,1,6));

#150 Re: Computer Math » Finite State Machines / Directed Graphs for counting problems » 2014-04-02 04:47:48

gAr

Update:

Even better, we can directly get the generating function for every entry in the matrix.


There, totally eliminated the need for setting of initial conditions!

In our example 2, we add up the g.f's in the first row.
In Sage:

am=matrix([
[0 , 0 , 1 , 6 , 1 , 1],
[0 , 1 , 1 , 6 , 1 , 1],
[0 , 1 , 1 , 6 , 1 , 1],
[0 , 1 , 1 , 6 , 1 , 1],
[0 , 1 , 1 , 6 , 1 , 0],
[0 , 1 , 1 , 6 , 0 , 1]
])
sum((identity_matrix(6)-x*am).inverse()[0]).full_simplify()

Board footer

Powered by FluxBB