Hot answers tagged

4

ClearAll["Global`*"] T = Table[0, {i, 1, 3}, {j, 1, 3}, {k, 1, 3}]; Part[Part[Part[T, 1], 1], 1] = E^(3 (KK + h)); Part[Part[Part[T, 1], 3], 3] = 3 E^(-KK + h); Part[Part[Part[T, 2], 2], 2] = E^(3 (KK - h)); Part[Part[Part[T, 2], 3], 3] = 3 E^-(KK + h); T = Normal[Symmetrize[T]]; h = 0; KK = 10; im = Partition[Flatten[TensorContract[TensorProduct[T, T], ...


3

I'm not aware any coding options for such constraints but you can roll your own. Here's an example with using two "treatments" with different Poisson means. (* Generate data from two Poisson distributions with very different sample sizes *) n1 = 1000; n2 = 10; λ1 = 5; λ2 = 15; SeedRandom[1234]; v1 = RandomVariate[PoissonDistribution[λ1], n1]; v2 = ...


2

One possibility is to plot the trajectories using StreamPlot: b = 0.8; StreamPlot[{-y + 2 x^2, b x}, {x, -3, 3}, {y, -1, 3}] And here you can scan through plots for different values of b: Manipulate[StreamPlot[{-y + 2 x^2, b x}, {x, -10, 10}, {y, -10, 30}], {b, 0, 1}]


2

One approach is to place inequality and domain restrictions in Solve. I show this below, using the example in the post. mat = {{1, 1, 1, 0, 0, 0, 0}, {0, 1, 1, 1, 1, 1, 0}, {0, 0, 0, 0, 1, 1, 1}}; vars = Array[x, Length[mat[[1]]]]; rhs = {2, 2, 2}; Solve[Join[Thread[mat.vars == rhs], Thread[0 <= vars <= 1]], vars, Integers] (* Out[261]= ...



Only top voted, non community-wiki answers of a minimum length are eligible