Tag Info

New answers tagged

0

I don't think you can get a solution by just throwing the problem at Solve. If you make a minor change in the argument you give to Solve (substituting 95/100 for 0get.95), you will get a message you may find more meaningful. Solve[ CDF[ChiSquareDistribution[n - 1], (n - 1)/k1] - CDF[ChiSquareDistribution[n - 1], (n - 1)/k2] == 95/100 && ...


1

I think GridLineData should be optimized by adding a condition as below: Classify the data that has been sorted by using this condition that the numerical difference is small (i.e., two data is very close to) (classification interval is set to δ), In each class of data, the minimum number of as a representative of the group(the last group must take ...


1

How about this? Grid[Prepend[ Flatten[Table[{a, b, Reverse@NMinimize[{a x + b y, 0.2 x + 0.1 y >= 14, 0.25 x + 0.6 y >= 30, 0.1 x + 0.15 y >= 10, x >= 0, y >= 0}, {x, y}]}, {a, 0, 3, 1}, {b, 0, 3, 1}] /. {ap_, bp_, {{x -> xp_, y -> yp_}, axbyp_}} :> {ap, bp, xp, yp, axbyp}, 1], {"a", "b", "x", ...


3

I'm not sure exactly what you want, but in an effort to demonstrate some possibilities: Join @@ Table[{{a, b}, NMinimize[{a x + b y, 0.2 x + 0.1 y >= 14, 0.25 x + 0.6 y >= 30, 0.1 x + 0.15 y >= 10, x >= 0, y >= 0}, {x, y}][[2]]}, {a, 0, 3, 1}, {b, 0, 3, 1}] // Column Or: Join @@ Table[{{HoldForm[a] -> a, HoldForm[b] -> ...


0

This seems to work: A = Sort@{10, 0, 10, 20, 20, 20, 20, 30, 30}; per = Permutations[A]; tot = Total /@ Abs[Differences /@ per]; pos = First@Flatten@Position[tot, Length@A*10 - 10]; (for other spacings replace 10 by f.e. 5). Partition[per[[pos]], 3] {{0, 10, 20}, {10, 20, 30}, {20, 30, 20}} For odd A: B = Prepend[A, Min@A]; and repeat the ...


3

Mathematica 10 introduces Indexed allowing this without error messages: FindMinimum[(Sum[Indexed[a, i]*Cos[1.3], {i, 1, 2}])^2, {a, {2, 0}}] {3.97214*10^-18, {a -> {1., -1.}}}


2

I think the trick is to use the RandomSeed option as shown below: Do[Print[NMinimize[{fourVertIsoHamilt[x11,x12,x13,x14,x21,x22,x23,x24,x31,x32,x33,x34,x41,x42,x43,x44], ...


2

Using Experimental`NumericalFunction framework directly (FindMinimum uses it under the hood) it is straightforward to get the numerical approximation of the Hessian: f = Experimental`CreateNumericalFunction[{x, y}, Cos[x^2 - 3 y] + Sin[x^2 + y^2], {1}, Hessian -> FiniteDifference]; f["Hessian"[{1.376384972443001`, 1.6786760817546214`}]] ...


1

Several issues: You don't have to OpenWrite a file when you use Export. Export will do everything for you. OpenWrite is for situations where you want to do low-level file operations. You can use Element[{a,b,c},..] to say say that a,b,c should be Integers. When you want to store values of EvaluationMonitor it is maybe easier to use Sow and Reap. {result, ...


2

Task: Minimize Differences[m, {0, 1}] those matrices under the constraint: Total[m,{2}]==Total[moptimized,{2}] First of all, that optimization objective doesn't make much sense: It's a matrix, not a scalar. So which value of the difference matrix should be optimized? The (possibly weighted) mean? The lowest or highest value? The median? ...


2

I apologize if I misunderstand your aim. Here is a first attempt. m = {{8, 23, 1, 3, 19}, {25, 4, 21, 7, 15}, {5, 9, 17, 21, 12}, {10, 3, 5, 15, 15}, {17, 15, 10, 16, 11}}; fun[lst_] := Module[{st, lg, md, mx}, st = Sort[lst]; lg = Length[lst]; md = Floor[lg/2]; If[Mod[lg, 2] == 1, Take[st, md]~Join~{Last@st}~Join~Reverse[Take[Most@st, ...


0

Normally I would use a comment, but I don't have this privilege now Part[#, -{2, 1, 3, 4, 5}] &@Sort@# & /@ m // MatrixForm Is this ok for you?


0

The problem lies in the incorrect use of the E notation for large and small numbers, such as 6.47368e-07. You should indicate powers of 10 explicitly: 6.47368*10^-7 If you want to clean up your notation, you should note that (i) spaces between numbers are always interpreted as products, (ii) you can get nice-looking multiplication signs by typing ...


4

Is this what you are after? Manipulate[ Graphics[{Point[#]}, ImageSize -> 1000, AspectRatio -> Automatic, Frame -> True, GridLinesStyle -> Thin, GridLines -> Composition[ Map[ If[#[[2]] - #[[1]] < 10^δ, ## &[], Mean[#]] &, #, {2}] &, Partition[#, 2, 1] & /@ # &, ...



Top 50 recent answers are included