# Tagged Questions

Questions on the optimization functions of Mathematica such as FindMinimum/FindMaximum, Minimize/Maximize, NMinimize/NMaximize, etc.

15k views

### How to find all the local minima/maxima in a range

I want to find : all local maxima in range all local minima in range From those points I can interpolate and combine functions upper and lower boundary. What I am really interested in, is the ...
5k views

### Shaving the last 50 ms off NMinimize

The epilogue: A paper where the below answer is used was published. The answer below is cited among the references:) The background: I have to fit an objective function for ~10 000 datasets in near ...
3k views

### Character edge finding

The following line of code finds the edge of a character: ...
745 views

### How to work with Experimental`NumericalFunction?

This question is intimately connected with previous one: "How to create internally optimized expression for computing with high WorkingPrecision?" Oleksandr R. correctly states in the comment: A ...
4k views

### How can I implement the method of Lagrange multipliers to find constrained extrema?

I want to form the function $h=f-\lambda_{1}g_{1}-\lambda_{2}g_{2}$ where $f$ is the function to optimize subject to the constraints $g_{1}=0$ and $g_{2}=0$ so that I can solve the first partial ...
1k views

### Inequalities with assumptions and constraints

I'm using Mathematica 8 I've been searching the net without luck for this specific solutions: Suppose I have an inequality f(x;M,m)>0 where I KNOW that M>4m and m>0. How can I let Mathematica know ...
2k views

### Combined numerical minimization and maximization

I want to numerically calculate the maximum of a function defined by the minimization of another function, like the following: ...
3k views

### Identifying critical points/lines of 2/3D image/cubes

Upshot I am interested in identifying critical points of a 3D field/cubes (maxima, minima, tube-like and wall-like saddle points) and 2D field/image (maxima, minima, saddle points). I.e. the ...
8k views

### Finding Local Minima / Maxima in Noisy Data

I'm trying to find local minima / maxima in noisy data, consisting of data values taken at certain time intervals. Ideally, the function should take a pair of lists (one containing time values and one ...
1k views

### Is it possible to use the LevenbergMarquardt algorithm for fitting a black-box residual function?

I have a black-box multiargument multiparametric function of the type SRD[dataPoint_List,params_List] which accepts experimental data along with the parameters of ...
1k views

### How to speed up Minimum Spanning Tree algorithm?

How to speed up MST algorithm? I work with graphs and I have adopted Prim's algorithm for my needs, from here. The graphs which I use are very dense (number of vertexes: $V=500$ and every vertex is ...
204 views

### Reordering numerically calculated eigenvalues assuming smooth dependence on a parameter

As was discussed in a different question here on SE (link) if you compute eigenvalues numerically of a matrix which depends on a parameter y, the resulting plot of ...
617 views

### FindMinimum, NMinimize, etc. with external process

I was hoping to be able to use MMA's minimization power to work with an external process. I want to minimize the function 'TryThisNumber[x_]' which sends the value of x to something external and gets ...
4k views

### How do I determine the maximum value for a polynomial, given a range of x values?

I need to determine the maximum value for y = a x^2 + b x + c, where I know the coefficients and the upper and lower x values. ...
588 views

### Determining the default Method used in optimization and root-finding algorithms

Is it possible to extract the Method which is used in functions like NMinimize, FindRoot, <...
5k views

### Minimizing a function of many coordinates

I'm trying to obtain a series of points on the unit sphere with a somewhat homogeneous distribution, by minimizing a function depending on distances (I took $\exp(-d)$). My points are represented by ...
3k views

### Methods for NonlinearModelFit

I am using NonlinearModelFit for a thesis project. I get quite different results if I change the Method to LevenbergMarquardt or QuasiNewton or ConjugateGradient ...
1k views

### Finding all maxima and minima of a function

To find all (global and local) extrema of a function in $\mathbb R^3$, I have written the following. Example function: ...
368 views

### $L_\infty$ norm minimization

I write supplemental explanation to render my aim of optimization. First Consider discrete time linear system below: $$G(z)=\frac{1-e^{-0.3T}}{z^{100}(z-e^{-0.3T})}$$ ...
472 views

### Maximize violating constraints

I have Maximize[{(h*10)/(300*(100 - (l^.5 + d^.4 + H^.6))), (l + d + H + h) == 669, l > 0, d > 0, H > 0, h > 0}, {h, l, d, H}] I believe ...
3k views

### Optimization of a portfolio of stocks

I would like to use Mathematica to perform an optimization of a portfolio composed by 10 stocks. I did the first part to compute yields and expected yields, but I don't know how to finish the ...
796 views

### Obtain approximate Hessian using FindMinimum

According to the documentation, when FindMinimum is told to use the method "QuasiNewton" on a unconstrained problem, it uses the ...
1k views

### Can I use GoogleMap or other GPS data in creation of the Graphs?

I have following graph. ...
506 views

### How to find local minima of data using PeakDetect

One of the great new function in v10 is PeakDetect. It can detect peaks (local maxima) according to desired sharpness as shown in this example: ...
3k views

### Find maximum value of interpolation function - obviously wrong result

Minimizing and maximizing interpolation function has already been asked and answered, see here for example. Yet, I observe a strange behaviour. Well, I can understand that the wrong guess of ...
894 views

### Simulated Annealing Convergence

I am using Simulated Annealing method for a simulation based optimization of a process that has 3 variables, using NMinimize. I print the input/output during every ...
540 views

### What alternative notation of subscripts/superscripts that are also treated as SYMBOLS in Mathematica?

I tried to avoid using the subscript $A_0$ in the Module, and get an error with $A[0]$. ...
1k views

### optimization problem with NDSolve

I want to minimize the function fcc. When fcc is calculated for a specified point the answer is correct: ...
876 views

### How can I speed up the classic GA for graph coloring?

I'm trying to compute the chromatic number of this graph (which is 28): g = Import@"http://www.info.univ-angers.fr/pub/porumbel/graphs/dsjc250.5.col"; My genetic ...
2k views

Finding a global minimum for this problem (non-linear optimization by the Nelder-Mead downhill simplex method) may not be possible, but by finding local minimum, I am expecting the value of the ...
364 views

### Efficiently filling area with disks located at certain points

Starting from a set of points, I want to fill an area using disks. Each disk's center should be one of the points and the disks should not overlap. I've managed to write a function that, given a list ...
2k views

### Travelling salesman with start and end points for 30 points

I am doing a route optimisation for delivery vehicles and failing dismally. Please see problem statement below. My current solution uses FindShortestTour, but this does not have defined start and end ...
1k views

### Strategies to avoid LessEqual::nord in NMinimize?

When using NMinimize on functions with complex intermediate expressions (but a real end result), quite often one gets the error ...
545 views

### Lagrange Multiplier

We are asked to maximize and minimize $f(x,y)=4xy$, given the constraint $4x^2+y^2=8$, using the Lagrange Multiplier method. First, I enter the functions f and g. ...
2k views

### Finding maximum or minimum of implicit functions

is there any built in function that can be used to find maximum or minimum of implicit functions? For example, if we have the equation $$x^2 + y^2 = (2 x^2 + 2 y^2 - x)^2,$$ then we can visualize the ...
760 views

### ParallelEvaluate for function minimization

Is there a parallelized version of a minimization routine available in Mathematica? The objective function is non-linear and the gradients have to be numerically computed. Every function evaluation ...
651 views

### Finding minimal distance between two surfaces

This code will display two parametric surfaces: ...
549 views

### Using compiled function inside NMinimize

Consider this code: ...
488 views

### Finding a point from a set of contours such that it is nearest to a given point

I have several contour lines and one point. How can I find a point in one of those contour lines which is nearest to the given point? ...
281 views

### NMinimize go out of bounds on some linear constraints

I'm trying to minimize a non-linear function of four variables with some linear constraints. NMinimize on Mathematica 8 seems to go out of bounds on some constraints giving complex values of the ...
166 views

### NMinimize in one-dimensional Interval

An Interval should be a one-dimensional region, so a region. I tried to minimize a function over an interval, e.g.: ...
697 views

### Semidefinite Programming

I want to solve a numerical optimization problem using semi-definite programming. Is there a package or add-on that equips mathematica with this functionality?
220 views

### Using FindFit to fit nonlinear ODE parameters, subject to a constraint (an inverse problem) [duplicate]

Similar to this post I am finding that constraints tend to make FindFit poor at finding a good fit. However, unlike the previous post, the constraints are required ...
387 views

### Fitting a variable using multiple equations

I would like to find the best fit of two variables for a number of approximate equations, such as: 1x+2y+2=7.04 2x+y+4=7.98 1.5x+1.5y-2=2.53 1.8x+3y-1=6.77 That ...
345 views

### Using ParametricNDSolve and NMinimize to find accurate interplanetary trajectory arrival periapse radius

I have an interplanetary trajectory simulation that calculates the required velocity (using a Lambert solver) and escape angle for a spacecraft to travel from Earth to Mars. This model does not use a ...
240 views

### Non-linear curve fit problem

I am having a problem with making a fit to data in Mathematica, which may involve my understanding of the methods available. I am trying to fit the derivative of a Frota function (which is a Single ...
118 views

### Simplifying Expressions for FindMinimum

I am currently trying to apply the FindMinimum function to find the lowest energy of an expression. My current expression as of now is relatively complicated. It is the summation of 48 similar terms, ...
64 views

### Efficient maximisation of log-likelihood

I would like to efficiently find the maximum $(\sigma,\lambda)$ for the log-likelihood of the derived distribution below. I only need $\sigma$ and $\lambda$ to one decimal place - so not very precise. ...