Tag Info

Hot answers tagged

16

Maximize[{y, x^2 + y^2 == (2 x^2 + 2 y^2 - x)^2}, {x, y}] {(3 Sqrt[3])/8, {x -> 3/8, y -> (3 Sqrt[3])/8}}


10

You could use Lagrange multipliers to maximize $f(x,y)=y$ subject to the constraint that $$g(x,y) = x^2 + y^2 - (2 x^2 + 2 y^2 - x)^2 = 0.$$ f[x_, y_] = y; g[x_, y_] = x^2 + y^2 - (2 x^2 + 2 y^2 - x)^2; eqs = {D[f[x, y], x] == lambda*D[g[x, y], x], D[f[x, y], y] == lambda*D[g[x, y], y], g[x, y] == 0}; Solve[eqs, {x, y, lambda}] // InputForm (* Out: { ...


7

In version 10, RegionBounds@ImplicitRegion[x^2 + y^2 == (2 x^2 + 2 y^2 - x)^2, {x, y}] (* {{-(1/8), 1}, {-((3 Sqrt[3])/8), (3 Sqrt[3])/8}} *)


6

This implicit equation is simple enough to be converted to explicit equations eqn = x^2 + y^2 == (2 x^2 + 2 y^2 - x)^2; yExpr = (y /. Solve[eqn, y]); yMax = SortBy[Maximize[#, x] & /@ yExpr, N[First[#]] &][[-1, 1]]; yMin = SortBy[Minimize[#, x] & /@ yExpr, N[First[#]] &][[1, 1]]; xExpr = (x /. Solve[{eqn, yMin < y < yMax}, x, ...


4

Also just for fun (in case you don't like to solve equations): cp = ContourPlot[x^2 + y^2 == (2 x^2 + 2 y^2 - x)^2, {x, -1, 2}, {y, -1, 1}, AspectRatio -> Automatic]; x = Cases[cp, {_Real, _Real}, Infinity]; points = Point /@ {Take[SortBy[x, First], 2], First@SortBy[x, Last], Last@SortBy[x, First], Last@SortBy[x, Last]}; Show[cp, ...


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

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


3

I post this just for fun. It does not address the general question of maximizing implicit function but Kuba has shown how to maximize y subject to constraint f(x,y). The problem can (with a small amount of manipulation) converted to explicit polar form: $r=0.5(cos\theta+1)$. Using this: rho[t_] := (Cos[t] + 1)/2; ycrit = Solve[D[Cos[u] Sin[u] + Sin[u], u] ...


2

Here is a way that could give the same answer as FindDistributionParameters, however I further assume that γ>0. Please see the code below: LG[x_] = Log[ G[x]] /. {σ -> Exp[s], γ -> Exp[t]} //. {Log[ Times[x__, y_]] :> Log[x] + Log[y], Log[x_^y_] :> y Log[x]} NMaximize[{Total[LG[data]], μ < Min[data] + Exp[s - ...


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


2

Reduce[x^2+y^2==(2 x^2+2 y^2-x)^2,{y},{x},Reals] -((3 Sqrt[3])/8) <= y <= (3 Sqrt[3])/8


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

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

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


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


1

You function is f = x^2 + y^2 - (2 x^2 + 2 y^2 - x)^2; Then call function Maximize Maximize[f, {x, y}] (*{27/64,{x->3/4,y->0}}*) And here is plot of you function


1

Presumably you are dealing with something like this: x1 = {1, 2, 3, 4, Range[0, 10, 1/3], 5, Sequence @@ Range[6, 99]}; x2 = Shallow[x1] {1,2,3,4,{0,1/3,2/3,1,4/3,5/3,2,7/3,8/3,3,<<21>>},5,6,7,8,9,<<90>>} You may not have an explicit Shallow or Short in your code; rather it may be applied automatically as part of a formatting ...



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