Tag Info

Hot answers tagged

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] & /@ # &, ...


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


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


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


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


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



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