Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- (*start*)
- a = 1;
- b = 0;
- nn = 200;
- Monitor[TableForm[
- L2 = Table[
- LinearProgramming[
- Table[1/n, {n, 1, k}], {Table[
- If[n == 1, k, 1], {n, 1, k}]}, {{1, 0}},
- Table[If[n == 1, {-1, 1}, {-a*(n - 1), a + b*(n - 1)}], {n, 1,
- k}]], {k, 1, nn}]];, k]
- t1 = Table[Sum[If[L2[[n, k]] <= -1, 1, 0], {k, 2, n}], {n, 2, nn}]
- t2 = Table[Round[-1 + Sqrt[2]*Sqrt[((1 + a)*(-1 + n))/a]], {n, 2, nn}]
- Show[ListLinePlot[t1, PlotStyle -> Red], ListLinePlot[t2]]
- t1 - t2
- Count[%, 0] + 1
- (*end*)
- (*version 2, 3.5.2020*)
- (*start*)a = 1;
- b = 0;
- nn = 200;
- Monitor[TableForm[
- L2 = Table[
- LinearProgramming[
- Table[1/n, {n, 1, k}], {Table[
- If[n == 1, k, 1], {n, 1, k}]}, {{1, 0}},
- Table[If[n == 1, {-1, 1}, {-a*(n - 1), a + b*(n - 1)}], {n, 1,
- k}]], {k, 1, nn}]];, k]
- t1 = Table[Sum[If[L2[[n, k]] <= -1, 1, 0], {k, 2, n}], {n, 2, nn}]
- t2 = Table[Round[-1 + 2 Sqrt[-1 + n]], {n, 2, nn}]
- Show[ListLinePlot[t1, PlotStyle -> Red], ListLinePlot[t2]]
- t1 - t2
- Count[%, 0] + 1
- (*end*)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement