Tag Info

New answers tagged

0

See if this is what you're after. I took the liberty of simplifying your MaximizeFunction, and in the process it became about twice as fast. I also got rid of the initial capitals. Best to avoid them, and avoid conflicting inadvertently with built-in functions. In a comment you indicate that it might be sufficient to find the maximum over orthogonal ...


1

The Weights option operates on a point-by-point basis to say how important that individual point is to the complete fit. Let's take some simple data that obviously don't fit on a line and try to fit them with a line. With equal weighting, you get a compromise: data = {{1, 1}, {2, 2.5}, {3, 3}}; nlm = NonlinearModelFit[data, a x + b, {a, b}, x, Weights -> ...


2

(Edit, I've edited the following almost entirely from the original, but the idea remains the same) From the comments it seems that a single solution will be enough. You want the input of the original function to be a numerical matrix. You can set up a test for this as follows: matrixnumQ[exp_] := MatrixQ[exp, NumericQ] Then defining your original ...


3

You will need to make pnorm into a black-box function so that it never tries to evaluate symbolically. Also it is probably worthwhile to use NMinimize/NMaximize in both. Finally the minimax process seems to behave better if you take pth powers in the inner optimization. pnorm[aa_, p_] /; MatrixQ[aa, Element[N[#], Reals] &] := Module[ {m, n, x, y, f, ...


5

I am currently developing an open source Genetic Algorithms library for Mathematica. It can be downloaded from this source. It is documented and, although I have not used it for multi-objective applications, it should provide some help with such applications.


3

One thing you can do is to import in the ConstraintMatrix form. Import["ExampleData/afiro.mps", "ConstraintMatrix"] This gives a SparseArray object, which can be turned back into a regular matrix format using Normal. Some other possible manipulations of the MPS data are discussed here.


5

As noted in the docs, when given any input that contains inexact numbers, Minimize[] automagically switches to the use of NMinimize[], which, as you might surmise from its name, uses approximate methods instead of exact ones. With this, the failure you see is due to the Nelder-Mead method, which is the default method used by NMinimize[]. If you're angling ...


2

Is this routine guaranteed to return a value between x0 and x1 if there is in fact a unique local maximum there (i.e., guaranteed to not jump outside the interval)? Nope. Consider for instance a simple example: FindArgMax[Sin[x], {x, π/2 - π/6, π/2 - π/12}] {1.570796326793869} where we see that the known maximum at $x=\pi/2$ was found, which is of ...


1

Your code works here (Mathematica v 9): x = Table[Symbol[StringJoin["x", ToString[i]]], {i, 7}]; A = {3, 2, 5, 1, 7, 9, 6}; Minimize[{A.x, (Apply[And, Thread[0 <= x <= 1]]) && (Apply[Plus, x] ==3) && (x \[Element] Integers) && (x != {1, 1, 0, 1, 0, 0, 0})}, x] (* {8, {x1 -> 0, x2 -> 1, x3 -> 1, x4 -> 1, x5 ...


3

Not having good starting values at hand, nor sufficient time to spare with your problem, here was the best I could do: {mv, am} = Quiet @ NMinimize[Norm[Norm[ Map[Function[x, With[{kx = First[#]}, CharacteristicPolynomial[H[kx], x]] // Evaluate], Rest[#]]] & /@ dat], {T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, ...


5

You could use a similar approach as @halirutan together with spherical coordinates to take care of one constraint and remove the need for multipliers. f[x_, y_, z_] = 1/2 x^2 y^2 + y^2 z^2 + z^2 x^2 + 96/(x + y + z + 1); r = Sqrt[5]; subs = {x -> r Sin[t] Cos[f], y -> r Sin[t] Sin[f], z -> r Cos[t]}; constr = {x >= 0, y >= 0, z >= 0, 0 ...


9

What about using a Lagrange multiplier to reduce the optimization problem to one target function and then use Reduce or Solve, to find the local maxima and minima. This gives you analytic expressions and you just have to select the one which is the smallest: expr1 = 1/2 x^2 y^2 + y^2 z^2 + z^2 x^2 + 96/(x + y + z + 1); expr2 = x^2 + y^2 + z^2 - 5; ...


7

Use a numerical approach: NMinimize[{1/2 x^2 y^2 + y^2 z^2 + z^2 x^2 + 96/(x + y + z + 1), x >= 0 && y >= 0 && z >= 0 && x^2 + y^2 + z^2 == 5}, {x, y, z}] {24.6693, {x -> 2.00209, y -> 0.879965, z -> 0.466144}} By symmetry considerations exchanging x and y will give the same minimum.


3

For an n that "ensures x1 > x2 at all times", I think it may not be possible. Look at the plot below, it seems for t negative enough, x1 will eventually below x2 for all $1 \leq n \leq 8$: Plot3D[ Evaluate[x1 - x2], {t, -4, 1}, {n, 1, 8}, PlotPoints -> 100, MeshFunctions -> {#1 &, #2 &}, Mesh -> {{0}, 20}, MeshStyle -> ...


3

The problem you face is very common in signal- and imageprocessing. I'm trying to find local minima / maxima in noisy data Since all the noise introduces small local extrema, the very question is which extrema are still noise and which are signal. What you want to do is to smooth out the noise without loosing signal information. This task is one of ...


4

An alternative way of doing things is using wavelets. Wavelets are quite good at denoising. (*Define data and noise*) temptimelist = Range[200]/10; data = Sinc[temptimelist]; noise = RandomReal[{-0.02, 0.02}, 200]; (* Define Wavelet for denoising *) dwd = DiscreteWaveletTransform[data + noise, SymletWavelet[7], 6]; (* Use universal threshold *) dwd = ...


1

Maybe you can undersample your data according to a mean as suggested in the comments, and then try and use one of the methods from the links you provide. The following is semi-manual but it would work reasonably well and quick for a dataset like the one you provide. Starting with the data: temptimelist = Range[200]/10; tempvaluelist = Sinc[temptimelist] + ...



Top 50 recent answers are included