Tag Info

New answers tagged

0

See question #: 25152. Titled "minimizing-a-matrix"


1

I suspect part of the problem may be in specifying integer variables, e.g. if the underlying code does branching (offhand I don't know if this happens though). So you could change it to take a real vector and use Round on that in f[...]. Also it is best to avoid symbolic preprocessing. THis can be done by "black boxing" the objective so that it only exists ...


2

The problem is trivially solved using $$\mathbf{A}=\frac{1}{|\rho|^2}v\otimes\rho,$$ which automatically satisfies $$\|\mathbf{A}\rho-v\|=0$$ and $$\det(\mathbf{A})=0.$$ In Mathematica, this is entered as v\[TensorProduct]r/Norm[r]^2.


5

eq1 = {4 + (3 + Cos[q]) Sin[p], 4 + Cos[p] (3 + Cos[q]), 4 + Sin[q]}; eq2 = {8 + (3 + Cos[v]) Cos[u], 3 + Sin[v], 4 + (3 + Cos[v]) Sin[u]}; nm = NMinimize[EuclideanDistance[eq1, eq2], {u, v, p, q}] (* {2.20785*10^-8, {u -> 2.7672, v -> 3.04956, p -> 1.97302, q -> 2.31892}} *) In fact they intersect: {x0, y0, z0} = eq1 /. nm[[2]]; ...


3

If these tori didn't intersect then we would be able to estimate the minimal distance between them with NMinimize, however this is not the case here although the plot in the question makes some kind of confusion. Nevertheless we can prove that they actually intersect with a kind of topological reasoning based on homotopy equivalence. We define ...


3

One part of the problem is answered here: What are the most common pitfalls awaiting new users?. You have to prevent the objective function from being evaluated before the x[i] are assigned numeric values. The rest of the problem is, I think, that Minimize can't deal with this type of optimization, since the function cannot be analyzed symbolically, not ...


4

You can get a glimpse into the workings of NMinimize by turning on the debug-printing: Block[{Optimization`NMinimizeDump`dbPrint = Print}, NMinimize[{x + y, x >= 0 && Abs[x + 10 y + 100] <= 1}, {x, y}] ] It seems at a cursory glance that it decided to search for points in the rectangle: {{x,0.,2.},{y,-1,1}} In this region it found zero ...


3

Documentation states: "This error can typically be avoided by providing starting values for the variable". Lets try to find these values: FindInstance[{x >= 0, Abs[100 + x + 10 y] <= 2}, {x, y}, Reals] {{x -> 0, y -> -(49/5)}} FindInstance[{x >= 1, Abs[100 + x + 10 y] <= 1}, {x, y}, Reals] {{x -> 1, y -> -10}} Lets try: ...


4

I am not sure whether the intention is vectors with all positive entries. If not then potential pairs (a,-a) will also be division by zero. Here is another implementation of formula, removing zero denominators: cd[u_, v_] := Module[{pos, us, vs}, pos = Position[u + v, _?(# != 0 &)]; us = Extract[u, pos]; vs = Extract[v, pos]; Total[(us - ...


2

So I'll show you the utility of singular value decompositions for one-component systems, and show how to make a 1-component fit. Doing this for multiple-component systems is likely to be harder. First, import the data: data = N@Import[SystemDialogInput["FileOpen"]][[1 ;; 300]]; Plot the data: << Developer` c = ToPackedArray[{0.3, 1.0, 0.1}]; ...


4

Try something like this: Let's make up a "slow to evaluate" function to minimize: f[x_] := (Pause[0.5]; x^4 - x^2) Some setup: values = {}; Dynamic@ListPlot[values, PlotRange -> All, Frame -> True] Now run FindMinimum and watch the function values decrease in real time: FindMinimum[f[x], {x, 1}, StepMonitor :> AppendTo[values, f[x]]]


0

I wrote my thesis "Implementation of an algorithm for verifying the non-negativity of a multilinear function in a hypercube" about this here (password is "sal" and username "sal"). The key algorithm is not specified in the publication, focusing only on the key implementation idea with the hypercubes -- this was a requirement by my instructor. Shortly I ...



Top 50 recent answers are included