New answers tagged

9

First answer (extended comment actually) You have to define better your objective function. For example, the following works: ClearAll[mat, minev] SeedRandom[1] rm = RandomInteger[10, {40, 40, 3}]; mat[t_] := N[rm.{1, t, t^2}]; minev[t_?NumericQ] := First@Eigenvalues[mat[t], -1]; Take[Table[minev[t], {t, 0, 1, .01}], 3] (* {-0.864071 - 1.30548 I, ...


7

With[{x = Array[x, Dimensions[mA]]}, Solve[mA .x - x. mB + mC == 0, Flatten@x]] Or With[{x = Array[x, Dimensions[mA]]}, x /. Solve[mA .x - x. mB + mC == 0, Flatten@x]] {{{3, 1}, {0, 3}}}


0

If this is for convenience, then you could write a wrapped for JordanDecomposition, e.g. something like this: Clear[jd] jd[m_] := Module[{s, j}, {s, j} = JordanDecomposition[m]; {s, Inverse[s], j} ] Then for example: a = {{27, 48, 81}, {-6, 0, 0}, {1, 0, 3}}; jd[a] (* Out: { (* the similarity matrix s *) {{3, 18, 2}, {-3, -9, -(1/4)}, {1, 2, 0}}, ...


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], ...


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}]


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 = ...



Top 50 recent answers are included