# Tagged Questions

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

52 views

### Finding function by constraints

I have the following coefficient finding problem: f[x] := a * Log[b*x + c] + d Constraints: f[0] = 1 f[80] = 0.5 I want to find the coefficients of f that ...
281 views

### How to draw a tropical surface?

By definition, a tropical surface in $\mathbb R^3$ is the set of points $(x,y,z)$ where the maximum $f=\max(f_1,f_2,\dots,f_n)$ is attained at least twice, here $f_i$ stand for some linear functions ...
107 views

### Method used by NMaximize with a binary linear problem

I'm using Mathematica 7's NMaximize to solve a linear programming problem with thousands of 0/1 integer variables, thousands of linear constraints and a linear target. I suppose I could use ...
117 views

### Maximise a function over one parameter that is continuous, and one that is discrete

I have a function that I would like to maximise with respect to two parameters: one continuous, another which is discrete. A simple example of this might be the following: ...
77 views

### Optimization over 6 vectors

Suppose I have an expression which depends on 6 unit vectors (3 dimensional). Hence, I need to optimize over 12 parameters (every vector contains 3 parameters, but one we can reduce by considering ...
152 views

### i need a swap mutation code (genetic algorithm) in Mathematica?

I'm working on GA coding to optimize the locators position in fixturing system to minimize the error in precision manufacturing.I need a code for mutation (genetic algorithm) in Mathematica. Here, I ...
1k views

### Minimizing using indices, error: Part::pkspec1: The expression cannot be used as a part specification

I want to use Minimize where the variables to minimize are indices pointing into an array. Here a MWE that hopefully shows what my problem is. ...
278 views

### Solve set of non-linear equations with least-squares-fitting - constrain results?

I'm trying to solve a set of functions to determine the material properties from a set of measurement values. (To set up this method I just want to fit my model with some already calculated data). My ...
77 views

### Transforming an Optimization Problem into a multi-vector Optimization Problem

I am sitting on an MultiAgent optimization problem trying to solve for a quadruple of variables {e,l,b,c} In a single agent (...
79 views

### L1-Norm Minimization

I need the function for the L1-Norm Minimization problem formulated here https://reference.wolfram.com/language/tutorial/ConstrainedOptimizationLinearProgramming.html#261990371 ...
122 views

I must advise you that I am an almost total novice in mathematica.. However here is my very simple question.. I know the command FindMaximum[{f},{x}] to find the maximum point and maximum value of a ...
242 views

### Finding the least positive integer satisfying a quantified statement

I'm studying the convergence of the sequence of functions $f_n:[0,1]\subset\mathbb{R}\to\mathbb{R}$ defined by $$f_n(x)=n^2x(1-x^2)^n$$ for $n\in\mathbb{N}$. These functions converge pointwise to the ...
49 views

### reset the value of a variable [closed]

Folks, I have a problem in populating a matrix without overriding the values. After performing computations for various values for j, I want to store these values in following matrix. Here is the code:...
215 views

### Minimizing a function with a constant $l > 0$

I'm VERY new to Mathematica and would like some help with minimizing a function. $$f(x) = \frac{1}{2} \sqrt{\frac{\left(l^4+x^4\right)^2}{l^4 x^2}}$$ I want to find which $x-value$ (probably ...
111 views

### Finding the global extrema of a surface? [closed]

I am trying to figure out how to find the global extrema of the function surface shown below and can't seem to get answers that make any sense. I am using the FindMinimum and FindMaximum functions ...
234 views

### Fibonacci Line Search Method

I am attempting to write a code to find to bracket the minimum of a function using the Fibonacci Line Search Method, I believe my code is well written but I am not ...
137 views

### How to optimize a cost function which involve the solution of a ODE system using the NMinmize?

I have created a cost function, the value of which depends on the solution of a ODE (ordinary differential equation). The parameters of the ODE are not determined, and my goal is to determine them ...
101 views

### Fun/Frustration With Coding Coding Theory

I have code following from this post: http://math.stackexchange.com/questions/1317722/fun-frustration-with-coding-coding-theory I think I am done with the code, but now I face a single problem. The ...
84 views

### Find a minimum value which satisfies an equation

I have to find a minimum value of "a" which makes x=-a+b+c, y=-a+b+c^2 positive where a>1, 0 ...
87 views

### Problem in minimizing expression

I am trying to implement bootstrapping (https://en.wikipedia.org/wiki/Bootstrapping_(finance)) of CDS curve. To implement it I am trying to minimize a series of expression. The minimum value of ...
118 views

### Finding Minimium Periapse Distance Between Spacecraft and Planet

I have the following simple model that simulates a spacecraft orbiting Mars. What I'm hoping to do is be able to find the periapse radius of the spacecraft as I did below, except instead of using ...
177 views

### FindMinimum and WhenEvent

Is there any way to incorporate WhenEvent[] into the FindMinimumfunction ? I'm currently trying to minimize an interpolating function with FindMinimum (since the origional function is to cumbersome ...
226 views

### NMaximize with Nelder-Mead method fails to convergence when tolerance set too high

Recently I have been working on a optimization problem for which I use NMaximize with Nelder-Mead method. In general, I have to check a lot of systems which are built automatically. I want to skip ...
54 views

### Sharp Ratio Maximization, Closed Forms

I am trying to get a closed form for the following first order conditions (n=4): Here's the nb-File. The code is as follows: ...
176 views

### Custom Methods for NMinimize/NonLinearModelFit

Is there a way to write custom methods for NonLinearModelFit or NMinimize? To give background, I currently have a batch of code ...
301 views

### Relaxation of Mass-Spring System with Pinned Masses

Problem Assume that four masses are connected to each other by springs while two of them are pinned down at their initial positions. Find the position of masses when system is at its minimum (...
160 views

### Find fit does not find the best fit

Here is my data ...
81 views

### Performance of a bootstrap - time of computation not linear with number of iterations

I'm doing a bootstrap based on this thread with the following code (file.txt here): ...
125 views

### Both FindMinimum and NMinimize have trouble

I'm trying to minimize a function I wrote, in a not entirely elegant (but functional) way. As a side note, if you have advice on how to write this in a smarter way, that's also welcome. In any case, ...
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 ...
88 views

### Symbolically Minimizing a Max function

I'm having a tough time with seemingly simple symbolic Minimization/Maximization in Mathematica. I would like to use the Maximize function to work on some unknown random variables and so use min/max ...
126 views

### Equation solution using minimization

I have an equation F[x,y]=0. I need to plot y as a function of x. Due to the properties of ...
94 views

### How to perform Bayesian optimization with Mathematica? [duplicate]

Does Mathematica have any Bayesian optimization methods for learning hyper-parameters? Practical Bayesian Optimization of Machine Learning Algorithms Jasper Snoek, Hugo Larochelle and Ryan P. ...
258 views

### Optimization method L-BFGS-B

I am comparing a result of optimization using R and Mathematica. Mathematica (NMaximize) has found a significantly better (global optimum) result then R (using L-...
115 views

### How can I calculate Lagrange multiplier and the critical points with Mathematica? [closed]

I have constraints and a function I want to know the critic points but is there a way that I can compute this method so that I can see results faster
977 views

### Finding peaks of data

I want to find peaks in my data. My code in a reduced form so far: ...
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 ...
666 views

### Is there any fast way to solve a quadratic matrix equation in Mathematica approximately?

Let the square nonsingular matrix $M$ is a given convergent matrix. What are the best scalar values for $\alpha$ and $\beta$ (in the real numbers domain), at which the following quadratic matrix ...
258 views

### Minimize method is not giving minimum. Why?

I was doing an optimization but facing a problem getting what exactly Minimize function do. I run the following code: ...
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, <...
127 views

### Minimizing Multiple Functions

I'm trying to write a script that will minimize a given set of functions. The homework problem I've been given lists a set of dietary information, and I'm supposed to build the optimal salad based on ...
69 views

### Which method to use for finding maximum without actually computing optimization function explicitly?

I am new to Mathematica and I am currently working on an optimization problem. The optimization function that I have easy to calculate for some assignment of variable but it is very difficult to ...
345 views

### How to build a list of constraints for NMinimize

Let's say I have aset = {-1, 0, 2}. I would like to create a variable Var that takes values from that set, i.e. ...
143 views

### What is the status of the FindMinimum method “QuadraticProgramming”?

As a method option to FindMinimum "QuadraticProgramming" is still a valid option. It has the advantage of being significantly ...
108 views

### Constrained optimization and problem with complex numbers

I am trying to solve a constrained optimization problem with an implicitly defined function $\pi$. The problem is non linear and of high order, so I use numerical methods instead. The code I use is: <...
130 views

### Using NMinimize to solve the Multi Commodity Flow problem

I have the following optimization problem and I was hoping to solve it with NMinimize. Unfortunately, I don't get the desired result. I would like to get an optimal vector for $d_{e}$. This is how ...
131 views

### Maximizing the number of zero entries in a matrix

I have a matrix with a bunch of parameters in its entries, they all come in different combinations in different places of the matrix. I can post the matrix itself if requested, but I think what I mean ...
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. ...