Tag Info

New answers tagged

1

Manipulate[ SeedRandom[seed]; (...), {n, 50, 1000}, {seed, 0, 100, 1}]


1

Simple and elegant Manipulate[ ListPlot[list, PlotRange -> {{0, n}, {0, 1}}], {{n, 10}, 1, 20, 1}, {{list, RandomReal[1, 10]}, ControlType -> None}, Button["Generate", {ngen = n; list = RandomReal[1, ngen]}] ]


1

This is NOT an answer but more like an observation. Fresh start, win7 x64, MMA V10.0.1 X64: The first input should assign value to ans, and I check ans EQUALS the last output (%1)?? So no problem when you type the first TWO lines together?? Only is a problem is you type them separately? so executed twice??


2

An alternative method based on kguler's finding: ParametricPlot[r {Cos[t], Sin[t]}, {r, 0, 12}, {t, 0, 2 Pi}, Mesh -> 23, Axes -> False, MeshShading -> {{c, c}, {c, c}}, PlotRange -> {{-9, 9}, {-4, 4}}] /. c :> Hue@RandomReal[] Note that as well as the kluger's answer this is based on undocumented details of the implementation of ...


6

Updated 14-10-2014 see solution at the end. This answer is basically for documentation of the problem. The credit goes mainly to the people participating in the comments. Diagnostics I can reproduce you observation on two different computers both, Windows 7 Pro 64, SP 1 running Mathematica 10.0.1. The "feature" appears for list of 11 or more random ...


0

Because two different seeds could conceivably return the same result (when using RandomInteger or the like), you are not dealing with an invertible function. Thus, it should be impossible to retrieve, with certainty, the seed you actually used. You may, however, be able to retrieve a seed that would produce the same results you obtained. But I have no ...


8

Making the MeshShading setting Dynamic also works without the need for post-processing: ParametricPlot[r {Cos[t], Sin[t]}, {r, 0, 12}, {t, 0, 2 Pi}, Mesh -> 23, Axes -> False, MeshShading -> Dynamic@{{Hue@RandomReal[], Hue@RandomReal[]}, {Hue@RandomReal[], Hue@RandomReal[]}}, PlotRange -> {{-9, 9}, {-4, 4}}] The ...


5

With V10 came RandomColor and ColorSpace Using Michael E2's wonderful solution plot = ParametricPlot[r {Cos[t], Sin[t]}, {r, 0, 12}, {t, 0, 2 Pi}, ImageSize -> 500, Mesh -> 13, MeshShading -> {{Red, Red}, {Red, Red}}, PlotRange -> {{-9, 9}, {-4, 4}}]; Grid @ Partition[Table[plot /. poly_Polygon :> {RandomColor[ColorSpace ...


2

With V10 we can use RandomColor Graphics3D[Table[{RandomColor[], Sphere[RandomReal[{.1, .9}, 3], RandomReal[{0.03, 0.08}]]}, {50}], Lighting -> "Neutral"] Graphics3D[Table[{RandomColor[1, ColorSpace -> "LUV"], Sphere[RandomReal[{.1, .9}, 3], RandomReal[{0.03, 0.08}]]}, {50}], Lighting -> "Neutral"]


4

RandomVariate[NormalDistribution[], {r, r}] does not give you normalized eigenvectors. To obtain an orthonormal basis, you can first generate a random matrix, and then apply Orthogonalize to it. Following is the correct code. r=4;(*matrix dimension*) dom={1,10};(*domain of random numbers*) eig=DiagonalMatrix[-RandomInteger[dom,r]] (*eigenvalues in diagonal ...


8

There are already good answers, but I'm going to improve the performance, generalize to any region in any dimensions and make the function more convenient. The main idea is to use DirichletDistribution (the uniform distribution on a simplex, e.g. triangle or tetrahedron). This idea was implemented by PlatoManiac and me in the related question obtaining ...


2

Use an explicit time step in RandomFunction to get 10 points in resulting TemporalData: P = CompoundPoissonProcess[1, NormalDistribution[0, 1]]; dataP = RandomFunction[P, {1, 10, 1}]


7

You already receive great answers concerning the colors, but your random generator confuses me. It is not uniform in the annulus and it's not efficient. I propose the following short and fast generator randomInAnnulus[R1_, R2_, n_] := Transpose@{# Cos@#2, # Sin@#2} &[Sqrt@RandomReal[{R1, R2}^2, n], RandomReal[2 π, n]]; pts = randomInAnnulus[1, 2, ...


4

R1 = 2; R2 = 3; t = Table[f[], {10000}]; vc = If[Times @@ # <= 0, Blue, Red] & /@ t; Use Graphics with VertexColors: Graphics[Point[t, VertexColors -> vc], Axes -> True, AspectRatio -> Automatic] Split the data based on Sign [x y] and use PlotStyle: t2 = Pick[t, Sign[Times @@@ t], #] & /@ {1, -1}; ListPlot[t2, AspectRatio -> ...


2

Try this: Graphics[{If[Times @@ # > 0, Red, Blue], Point[#]} & /@ A] which produces this: I used R1 = 1.0; R2 = 0.5; as the constants. A is the list of random points. This plotting method is pretty slow; unfortunately ListPlot requires Joined -> True for ColorFunction to be applied, and for random points it just looks like a mess.


2

I just noticed you have a comment, but I think this might be useful. You've found the built-in function, but that's not exactly what I thought you wanted. It seemed like you wanted them in order -- just split or not split. You can split the set with probability 1/2 at every possible place. So you have: set = Range[10]; part = {}; p0 = {}; For[i = 1, i ...


7

Update: This is much better then my previous one: randomSetPartition2[list_List]:=SplitBy[list,RandomInteger[1]&] randomSetPartition2[Range@10] {{1, 2, 3}, {4, 5, 6, 7, 8, 9}, {10}} Original Here is one option using recursive approach to create partitions: partitions[n_Integer]/;n<=0:={}; ...


10

Here's an approach without If or For. First a helper function: (* Thanks to Belisarius for the mrow& suggestion *) g[x_] := NestWhile[mrow&, x, MemberQ[x - #, 0] &] Then: NestList[g, mrow, 9] // MatrixPlot Where mrow is as you've defined it in the question.


1

row := Take[ NestWhile[Join[#, ConstantArray[RandomInteger[{0, 2}], RandomChoice[{2, 4, 6, 8}]]] &, {} , Length@# < 10 &], 10] Nest[Module[{b}, (While[Times @@ (#[[-1]] - (b = row)) == 0]; Append[#, b])] & , {row} , 9] // MatrixPlot


3

Nice question. I'd try to do something with recursion instead, like Clear[f]; f[n_] := f[n] = newRow[f[n - 1]] f[0] = ConstantArray[10, 10]; newRow[previousRow_] := With[{row = mrow}, If[MemberQ[previousRow - row, 0], newRow[previousRow], row] ] Array[f, 10] // MatrixPlot


5

Could look for a counterexample using FindInstance. tmat = {{t11^2, t11*t12}, {t11*t12, t12^2 + t22^2}} - IdentityMatrix[2]; evals = Eigenvalues[tmat]; FindInstance[(evals[[1]] <= 0 || evals[[2]] <= 0) && t11^2 >= 1 && t22^2 >= 1, Variables[tmat], Reals] (* Out[237]= {{t11 -> Sqrt[2], t12 -> 1, t22 -> ...



Top 50 recent answers are included