Skip to main content
deleted 36 characters in body
Source Link
Kagaratsch
  • 12.1k
  • 4
  • 26
  • 79

Here is how I do it

myTup = Tuples[{1, 2}, 5]; Subscript[ff[1, 1][y_]y_] := 2 y; Subscript[ff[2, 2][y_]y_] := 2 y - 1; Do[ h = x0; Do[h = Subscript[ff[myTup[[j, myTup[[ji]], i]]][h];h];, {i, 1, 5}]; x5[j] = h; , {j, 1, myTup // Length}] myRes = Table[ x0 /. Solve[x0 == x5[j], x0][[1]], {j, 1, myTup // Length}] 

{0, 1/31, 2/31, 3/31, 4/31, 5/31, 6/31, 7/31, 8/31, 9/31, 10/31, \ 11/31, 12/31, 13/31, 14/31, 15/31, 16/31, 17/31, 18/31, 19/31, 20/31, \ 21/31, 22/31, 23/31, 24/31, 25/31, 26/31, 27/31, 28/31, 29/31, 30/31, 1}

Which are 32 results. But $x_0<1$ so the last entry is to be removed. Properly 31, as predicted. Conceptually, since we are testing all possible paths the evolution may take and are then solving a linear equation in each case, we are guaranteed to get only one solution from each path and therefore find all possible solutions.

We can also explicitly test that the result is indeed correct (even though it is clear that it must be)

fun[x_] := Block[{h}, h = x; Do[h = If[2 h < 1, 2 h, 2 h - 1];, {i, 1, 5}]; h ]; Table[fun[myRes[[j]]], {j, 1, Length@myRes - 1}] 

{0, 1/31, 2/31, 3/31, 4/31, 5/31, 6/31, 7/31, 8/31, 9/31, 10/31, \ 11/31, 12/31, 13/31, 14/31, 15/31, 16/31, 17/31, 18/31, 19/31, 20/31, \ 21/31, 22/31, 23/31, 24/31, 25/31, 26/31, 27/31, 28/31, 29/31, 30/31}

Here is how I do it

myTup = Tuples[{1, 2}, 5]; Subscript[f, 1][y_] := 2 y; Subscript[f, 2][y_] := 2 y - 1; Do[ h = x0; Do[h = Subscript[f, myTup[[j, i]]][h];, {i, 1, 5}]; x5[j] = h; , {j, 1, myTup // Length}] myRes = Table[ x0 /. Solve[x0 == x5[j], x0][[1]], {j, 1, myTup // Length}] 

{0, 1/31, 2/31, 3/31, 4/31, 5/31, 6/31, 7/31, 8/31, 9/31, 10/31, \ 11/31, 12/31, 13/31, 14/31, 15/31, 16/31, 17/31, 18/31, 19/31, 20/31, \ 21/31, 22/31, 23/31, 24/31, 25/31, 26/31, 27/31, 28/31, 29/31, 30/31, 1}

Which are 32 results. But $x_0<1$ so the last entry is to be removed. Properly 31, as predicted. Conceptually, since we are testing all possible paths the evolution may take and are then solving a linear equation in each case, we are guaranteed to get only one solution from each path and therefore find all possible solutions.

We can also explicitly test that the result is indeed correct (even though it is clear that it must be)

fun[x_] := Block[{h}, h = x; Do[h = If[2 h < 1, 2 h, 2 h - 1];, {i, 1, 5}]; h ]; Table[fun[myRes[[j]]], {j, 1, Length@myRes - 1}] 

{0, 1/31, 2/31, 3/31, 4/31, 5/31, 6/31, 7/31, 8/31, 9/31, 10/31, \ 11/31, 12/31, 13/31, 14/31, 15/31, 16/31, 17/31, 18/31, 19/31, 20/31, \ 21/31, 22/31, 23/31, 24/31, 25/31, 26/31, 27/31, 28/31, 29/31, 30/31}

Here is how I do it

myTup = Tuples[{1, 2}, 5]; f[1,y_] := 2 y; f[2,y_] := 2 y - 1; Do[ h = x0; Do[h = f[myTup[[j, i]],h];, {i, 1, 5}]; x5[j] = h; , {j, 1, myTup // Length}] myRes = Table[ x0 /. Solve[x0 == x5[j], x0][[1]], {j, 1, myTup // Length}] 

{0, 1/31, 2/31, 3/31, 4/31, 5/31, 6/31, 7/31, 8/31, 9/31, 10/31, \ 11/31, 12/31, 13/31, 14/31, 15/31, 16/31, 17/31, 18/31, 19/31, 20/31, \ 21/31, 22/31, 23/31, 24/31, 25/31, 26/31, 27/31, 28/31, 29/31, 30/31, 1}

Which are 32 results. But $x_0<1$ so the last entry is to be removed. Properly 31, as predicted. Conceptually, since we are testing all possible paths the evolution may take and are then solving a linear equation in each case, we are guaranteed to get only one solution from each path and therefore find all possible solutions.

We can also explicitly test that the result is indeed correct (even though it is clear that it must be)

fun[x_] := Block[{h}, h = x; Do[h = If[2 h < 1, 2 h, 2 h - 1];, {i, 1, 5}]; h ]; Table[fun[myRes[[j]]], {j, 1, Length@myRes - 1}] 

{0, 1/31, 2/31, 3/31, 4/31, 5/31, 6/31, 7/31, 8/31, 9/31, 10/31, \ 11/31, 12/31, 13/31, 14/31, 15/31, 16/31, 17/31, 18/31, 19/31, 20/31, \ 21/31, 22/31, 23/31, 24/31, 25/31, 26/31, 27/31, 28/31, 29/31, 30/31}

added 226 characters in body
Source Link
Kagaratsch
  • 12.1k
  • 4
  • 26
  • 79

Here is how I do it

myTup = Tuples[{1, 2}, 5]; Subscript[f, 1][y_] := 2 y; Subscript[f, 2][y_] := 2 y - 1; Do[ h = x0; Do[h = Subscript[f, myTup[[j, i]]][h];, {i, 1, 5}]; x5[j] = h; , {j, 1, myTup // Length}] myRes = Table[ x0 /. Solve[x0 == x5[j], x0][[1]], {j, 1, myTup // Length}] 

{0, 1/31, 2/31, 3/31, 4/31, 5/31, 6/31, 7/31, 8/31, 9/31, 10/31, \ 11/31, 12/31, 13/31, 14/31, 15/31, 16/31, 17/31, 18/31, 19/31, 20/31, \ 21/31, 22/31, 23/31, 24/31, 25/31, 26/31, 27/31, 28/31, 29/31, 30/31, 1}

Which are 32 results. But $x_0<1$ so the last entry is to be removed. Properly 31, as predicted.

EDIT Conceptually, since we are testing all possible paths the evolution may take and are then solving a linear equation in each case, we are guaranteed to get only one solution from each path and therefore find all possible solutions.

We can also explicitly test that the result is indeed correct (even though it is clear that it must be)

fun[x_] := Block[{h}, h = x; Do[h = If[2 h < 1, 2 h, 2 h - 1];, {i, 1, 5}]; h ]; Table[fun[myRes[[j]]], {j, 1, Length@myRes - 1}] 

{0, 1/31, 2/31, 3/31, 4/31, 5/31, 6/31, 7/31, 8/31, 9/31, 10/31, \ 11/31, 12/31, 13/31, 14/31, 15/31, 16/31, 17/31, 18/31, 19/31, 20/31, \ 21/31, 22/31, 23/31, 24/31, 25/31, 26/31, 27/31, 28/31, 29/31, 30/31}

Here is how I do it

myTup = Tuples[{1, 2}, 5]; Subscript[f, 1][y_] := 2 y; Subscript[f, 2][y_] := 2 y - 1; Do[ h = x0; Do[h = Subscript[f, myTup[[j, i]]][h];, {i, 1, 5}]; x5[j] = h; , {j, 1, myTup // Length}] myRes = Table[ x0 /. Solve[x0 == x5[j], x0][[1]], {j, 1, myTup // Length}] 

{0, 1/31, 2/31, 3/31, 4/31, 5/31, 6/31, 7/31, 8/31, 9/31, 10/31, \ 11/31, 12/31, 13/31, 14/31, 15/31, 16/31, 17/31, 18/31, 19/31, 20/31, \ 21/31, 22/31, 23/31, 24/31, 25/31, 26/31, 27/31, 28/31, 29/31, 30/31, 1}

Which are 32 results. But $x_0<1$ so the last entry is to be removed. Properly 31, as predicted.

EDIT

We can also explicitly test that the result is indeed correct (even though it is clear that it must be)

fun[x_] := Block[{h}, h = x; Do[h = If[2 h < 1, 2 h, 2 h - 1];, {i, 1, 5}]; h ]; Table[fun[myRes[[j]]], {j, 1, Length@myRes - 1}] 

{0, 1/31, 2/31, 3/31, 4/31, 5/31, 6/31, 7/31, 8/31, 9/31, 10/31, \ 11/31, 12/31, 13/31, 14/31, 15/31, 16/31, 17/31, 18/31, 19/31, 20/31, \ 21/31, 22/31, 23/31, 24/31, 25/31, 26/31, 27/31, 28/31, 29/31, 30/31}

Here is how I do it

myTup = Tuples[{1, 2}, 5]; Subscript[f, 1][y_] := 2 y; Subscript[f, 2][y_] := 2 y - 1; Do[ h = x0; Do[h = Subscript[f, myTup[[j, i]]][h];, {i, 1, 5}]; x5[j] = h; , {j, 1, myTup // Length}] myRes = Table[ x0 /. Solve[x0 == x5[j], x0][[1]], {j, 1, myTup // Length}] 

{0, 1/31, 2/31, 3/31, 4/31, 5/31, 6/31, 7/31, 8/31, 9/31, 10/31, \ 11/31, 12/31, 13/31, 14/31, 15/31, 16/31, 17/31, 18/31, 19/31, 20/31, \ 21/31, 22/31, 23/31, 24/31, 25/31, 26/31, 27/31, 28/31, 29/31, 30/31, 1}

Which are 32 results. But $x_0<1$ so the last entry is to be removed. Properly 31, as predicted. Conceptually, since we are testing all possible paths the evolution may take and are then solving a linear equation in each case, we are guaranteed to get only one solution from each path and therefore find all possible solutions.

We can also explicitly test that the result is indeed correct (even though it is clear that it must be)

fun[x_] := Block[{h}, h = x; Do[h = If[2 h < 1, 2 h, 2 h - 1];, {i, 1, 5}]; h ]; Table[fun[myRes[[j]]], {j, 1, Length@myRes - 1}] 

{0, 1/31, 2/31, 3/31, 4/31, 5/31, 6/31, 7/31, 8/31, 9/31, 10/31, \ 11/31, 12/31, 13/31, 14/31, 15/31, 16/31, 17/31, 18/31, 19/31, 20/31, \ 21/31, 22/31, 23/31, 24/31, 25/31, 26/31, 27/31, 28/31, 29/31, 30/31}

added 503 characters in body
Source Link
Kagaratsch
  • 12.1k
  • 4
  • 26
  • 79

Here is how I do it

myTup = Tuples[{1, 2}, 5]; Subscript[f, 1][y_] := 2 y; Subscript[f, 2][y_] := 2 y - 1; Do[ h = x0; Do[h = Subscript[f, myTup[[j, i]]][h];, {i, 1, 5}]; x5[j] = h; , {j, 1, myTup // Length}] myRes = Table[ x0 /. Solve[x0 == x5[j], x0][[1]], {j, 1, myTup // Length}] 

{0, 1/31, 2/31, 3/31, 4/31, 5/31, 6/31, 7/31, 8/31, 9/31, 10/31, \ 11/31, 12/31, 13/31, 14/31, 15/31, 16/31, 17/31, 18/31, 19/31, 20/31, \ 21/31, 22/31, 23/31, 24/31, 25/31, 26/31, 27/31, 28/31, 29/31, 30/31, 1}

Which are 32 results. But $x_0<1$ so the last entry is to be removed. Properly 31, as predicted.

EDIT

We can also explicitly test that the result is indeed correct (even though it is clear that it must be)

fun[x_] := Block[{h}, h = x; Do[h = If[2 h < 1, 2 h, 2 h - 1];, {i, 1, 5}]; h ]; Table[fun[myRes[[j]]], {j, 1, Length@myRes - 1}] 

{0, 1/31, 2/31, 3/31, 4/31, 5/31, 6/31, 7/31, 8/31, 9/31, 10/31, \ 11/31, 12/31, 13/31, 14/31, 15/31, 16/31, 17/31, 18/31, 19/31, 20/31, \ 21/31, 22/31, 23/31, 24/31, 25/31, 26/31, 27/31, 28/31, 29/31, 30/31}

Here is how I do it

myTup = Tuples[{1, 2}, 5]; Subscript[f, 1][y_] := 2 y; Subscript[f, 2][y_] := 2 y - 1; Do[ h = x0; Do[h = Subscript[f, myTup[[j, i]]][h];, {i, 1, 5}]; x5[j] = h; , {j, 1, myTup // Length}] myRes = Table[ x0 /. Solve[x0 == x5[j], x0][[1]], {j, 1, myTup // Length}] 

{0, 1/31, 2/31, 3/31, 4/31, 5/31, 6/31, 7/31, 8/31, 9/31, 10/31, \ 11/31, 12/31, 13/31, 14/31, 15/31, 16/31, 17/31, 18/31, 19/31, 20/31, \ 21/31, 22/31, 23/31, 24/31, 25/31, 26/31, 27/31, 28/31, 29/31, 30/31, 1}

Which are 32 results. But $x_0<1$ so the last entry is to be removed. Properly 31, as predicted.

Here is how I do it

myTup = Tuples[{1, 2}, 5]; Subscript[f, 1][y_] := 2 y; Subscript[f, 2][y_] := 2 y - 1; Do[ h = x0; Do[h = Subscript[f, myTup[[j, i]]][h];, {i, 1, 5}]; x5[j] = h; , {j, 1, myTup // Length}] myRes = Table[ x0 /. Solve[x0 == x5[j], x0][[1]], {j, 1, myTup // Length}] 

{0, 1/31, 2/31, 3/31, 4/31, 5/31, 6/31, 7/31, 8/31, 9/31, 10/31, \ 11/31, 12/31, 13/31, 14/31, 15/31, 16/31, 17/31, 18/31, 19/31, 20/31, \ 21/31, 22/31, 23/31, 24/31, 25/31, 26/31, 27/31, 28/31, 29/31, 30/31, 1}

Which are 32 results. But $x_0<1$ so the last entry is to be removed. Properly 31, as predicted.

EDIT

We can also explicitly test that the result is indeed correct (even though it is clear that it must be)

fun[x_] := Block[{h}, h = x; Do[h = If[2 h < 1, 2 h, 2 h - 1];, {i, 1, 5}]; h ]; Table[fun[myRes[[j]]], {j, 1, Length@myRes - 1}] 

{0, 1/31, 2/31, 3/31, 4/31, 5/31, 6/31, 7/31, 8/31, 9/31, 10/31, \ 11/31, 12/31, 13/31, 14/31, 15/31, 16/31, 17/31, 18/31, 19/31, 20/31, \ 21/31, 22/31, 23/31, 24/31, 25/31, 26/31, 27/31, 28/31, 29/31, 30/31}

Source Link
Kagaratsch
  • 12.1k
  • 4
  • 26
  • 79
Loading