Tag Info

Hot answers tagged

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


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


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


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


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


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


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.


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


1

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



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