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

learn more… | top users | synonyms (4)

6
votes
2answers
213 views

Graphically solving a linear programming problem

I try to realize the graphical linear programming method. Here is my code ...
1
vote
1answer
44 views

NMinimize error

I want to use NMinimize in the following way: ...
4
votes
2answers
124 views

FindFit and NMinimize to fit a parametric model (minimize the distance of two curves)

I am trying to find a fit to the cumulative distribution of a set of points using FindFit or NMinimize. In particular, I would like to find the parameters of the cdf of the Beta Distribution that ...
2
votes
1answer
89 views

Maximum of the minimum of two functions

I have two functions, each with 15 variables. How can I find maximum (minimum) of these functions? I know that minimum (maximum) of two functions is a multi-criteria function but I cannot find it. ...
0
votes
1answer
51 views

Problem with inequality constraint

I'm using NMinimize to solve the following objective function. ...
0
votes
0answers
40 views

Minimize function with logical arguments

How can I minimize or maximize a function (even numerically) with logical arguments, taking only 0s and 1s, also with constraints? E.g. ...
3
votes
1answer
73 views

ArgMax, FindArgMax, and NArgMax disagreeing on answer

In working on an estimation problem, I created three Gaussian-like functions. The ML estimate could be seen as the argmax of the product of the three functions. In trying to get the code to run ...
2
votes
0answers
48 views

FindMinimum not accurate [closed]

Consider the function f[B_, d_] := -158.57189 + 982.533102 B^2 - 5.6768579 d + 895.1968 d^2 + B (-18.7772 + 655.02206 d); ...
4
votes
1answer
68 views

`FindMinimum` with compiled function [duplicate]

I don't know how to fix this problem: ...
1
vote
2answers
122 views

Use NMinimize instead of FindFit for constrained search (of coefficients)

(My problem is more complex, but let us formulate it through this example) I am trying to find the best polynomial approximation to the following function ...
3
votes
1answer
84 views

How to make Maximize function successfully maximize in general?

Having looked at Maximize Documentation SO: Mathematica: Commands return no output, but itself. Bug? Problem with Maximize Why won't Mathematica Solve a set of two equations for one variable? ...
1
vote
1answer
53 views

Trying to maximize an expression with integer and real variables

I am trying to solve this equation The link has a screen capture of the equation and the solution. I am looking for the values of a1 and a2 in particular, but they need to be real numbers. s1 and s2 ...
0
votes
0answers
29 views

Trying to minimize a function over the integers

I am trying to evaluate the following expression. ...
4
votes
2answers
88 views

Parallel function evaluation for minimal value

I am asking myself, if the evaluation of a function f looking for a minimal value over a discrete set of values can be parallelize (brute scan for a potential ...
3
votes
1answer
82 views

Speeding up constrained optimization problem solving

I have a problem on my homework with Lagrangian multipliers that Mathematica has now been bashing at fruitlessly for 10 minutes. I'm not sure whether I did something horribly wrong codewise, but it's ...
3
votes
2answers
95 views

Optimization not evaluating, further specifications?

I am trying to find the global minimum of this simple function for real x and y f = x^2*(1 + Sin[y]); Of course, I know it is 0. But Mathematica seems not be able to handle this expression since ...
1
vote
0answers
56 views

Find multiple optimization parameters of Max-Min problem in numerically

I have an optimization problem $$\max \min [x_1,~\cdots,~x_m,~\cdots,~x_M]:~M\geq 2$$ where $$x_m=P_m(1-a_m)\prod_{j=1}^{m-1}\left(\frac{a_j}{1-a_j}+b_j\right)$$ and $$0\leq a_i<1;~~0\leq ...
3
votes
0answers
67 views

Improving the speed of an optimization algorithm via compilation and parallellization

I have written an implementation of eight variants of the PSO-algorithm and I want to test them over a set of test functions. I am using parallelization as it improves the speed a lot and I have also, ...
1
vote
0answers
43 views

Problem with `NMinimize` [closed]

I wrote a code inspired by Rod's answer to this question. It is supposed to find the minimum variance portfolio of stocks and allows for arbitrary constraints on the weights of each stock: ...
0
votes
1answer
35 views

Setting value of number on certain decimal points [duplicate]

How do I fix number on certain decimal point? For example number 10304,390456 should be 10304,39. I tried NumberPoints, Nest, ...
1
vote
1answer
111 views

What methods does Maximize use like $\mathtt{Maximize}\left[\left\{3 x^2+2 \sqrt{2} x y,x^4+y^4=1\right\},\{x,y\}\right]$

I used Maximize for the maximum value of $3 x^2+2 \sqrt{2} x y$ when $x^4+y^4=1$ , $x>0,y>0$. What methods does Maximize ...
0
votes
1answer
53 views

Why the returned value is complex while my input is all real in Nminimize

This is the mathematica code I used. My goal is trying to solve eq2==0 && eq3==0 simultaneously in the region "-200 The FindRoot doesn't gives me quick answers. So I tried to use Nminimize ...
0
votes
0answers
45 views

Find the maximum hyperrectangle contained in a set of points

I have a question similar to this one ( Find the largest rectangular block satisfying some condition without iterating explicitly). but in my case I have a multidimensional (up to 6 dimensions) binary ...
3
votes
1answer
75 views

Numerically solve recurrence equation

I have the following recurrence equation ...
0
votes
0answers
35 views

How to determine whether NMinimize returns a solution or not?

I'm using NMinimize to find the minimum solution for a non-linear objective function. As I change the set of constraints, most of times ...
3
votes
1answer
125 views

Programming a MaxMin Linear Optimization

I want to program a function for a two-player game. Basically it's like this: . Each player has an array of options, and the result of the game is based on both players choices. So heres my most ...
2
votes
1answer
185 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 ...
0
votes
0answers
42 views

NIntegrate within NMinimize - how to optimize the code?

How I can optimize these numerical calculations? Most annoying is encountering instabilities (numerical errors). I have a predefined function: ...
-3
votes
1answer
89 views

Untangling delayed definitions and substitutions [closed]

I am attempting to find the values of B1 and B0 that will minimize a metric. In the code below I define the metric and then attempt to calculate is by substituting in the current values of B1 and B0. ...
2
votes
0answers
72 views

Findminimum fails in loops

Introduction to the problem: the function F[x][u,v,w] I'm currently dealing with a very strange minimalization problem. I have a function F[x][u,v,w] which is ...
3
votes
1answer
91 views

Repeated interpolation for 3D unstructured grid -> Optimization

Trying to perform mesh-to-mesh 3D interpolation on unstructured grid. Mesh size is about 200k nodes. Painful thing that interpolation shoud be repeated ~1000 times (different thermal map) on the same ...
0
votes
2answers
86 views

Lagrange multipliers code runs forever

I am writing a code for a Lagrange multipliers problem with three variables. My code looks like this: ...
0
votes
1answer
54 views

Lagrange multipliers implementation (beginner question) [closed]

I am trying to write a code to find the minimum of $f(x,y) = (Mx + Ny) \,/\sqrt{M^2 x + N^2 y}$?, subject to the constraint $g(x,y)=x+y-1$. Also, $x,y>0$, and $M$ and $N$ are positive constants. ...
2
votes
1answer
90 views

Long Processing time [closed]

I have access to a cluster and I was wondering if NMinimize[] with the "Differential Evolution" method could be used to parallel ...
1
vote
0answers
44 views

Evaluation of likelihood very slow

I am trying to implement a simple statistical model for the first time in Mathematica. My model is made my one random variable which is the sum of background and signal. Background is an exponential ...
1
vote
1answer
55 views

FindMinimum with LevenbergMarquardt Method: syntax to set lower/higher bounds for parameters

I use the LevenbergMarquardt method of the FindMinimum function to minimize a residual function (mathematical-optimization). The 2013 post Is it possible to use the LevenbergMarquardt (LM) algorithm ...
1
vote
2answers
113 views
1
vote
1answer
132 views

Find the maximum Z in {(X + Y)==Z} using all the digits 0-9 only once

II want to add two integers with different digits to get a third integer with different digits. At the end, all 10 digits have to be different. So there should be 10 digits in total. How you ...
3
votes
0answers
70 views

Using NMaximize to get integer results for a fractional programming problem

I have an optimization problem that I am trying to model in mathematica (wolfram cloud, to be precise). Link to notebook for code described here: ...
1
vote
0answers
62 views

Findminimum evaluates input for NIntegrate at non numerical value (NIntegrate::inumr:) [duplicate]

The goal is to minimise a functional in this case I want to find the input function, defined by its (many) values on a grid for which the functional attains its minimum. Below is a piece of code where ...
7
votes
1answer
94 views

Minimizing NExpectation for a custom distribution

As discussed and advised in Meta: Migrate a question..., I've copied a 2012 posted question from StackOverflow (posted before this site began running), which has gotten a lot of attention (but after 3 ...
2
votes
1answer
64 views

Using ouput of ParametericNDSolve as argument in NMinimize: NMinimize::nnum: function value not a number

I am trying to fit some experimental data and I am trying to use NMinimize function to calculate the parameters that fit the experimental dataset. I am also using ...
5
votes
4answers
434 views

Minimal overlap area of circles

I have 20 points in the 2D plane with $(x_i,y_i)$ coordinates. I want to use Mathematica to optimally distribute 10 circles with equal radius of a given positive value $R$, i.e. to determine with the ...
5
votes
2answers
134 views

Techniques to find all local minima of black box function with n continuous derivatives?

I have a blackbox function f on [a,b] that is known to be continuous, and has n continuous derivatives. The function uses polynomial interpolations (but isn't a polynomial interpolation itself), so no ...
3
votes
2answers
120 views

Maximizing a function defined using NIntegrate [duplicate]

I have two functions fn[x,y,z] which is in integral form and I have another function gn[x,y] which is also in integral form ...
0
votes
1answer
57 views

Calculate Max-Min value and corresponding parameters

I have two functions funA and funB which are also functions a,b,x,and ...
8
votes
1answer
120 views

FindMaximum failing on a trivial problem [closed]

I am trying to solve a trivial optimization problem with FindMaximum but for some reason it is not going. I reduced the problem down to the following non-working ...
2
votes
1answer
51 views

Numerical functions as constraints for NMaximize

I want to use NMaximize to solve a problem like this: $\quad \quad \max_y f(y) \text{ subject to } \max_x g(x, y) \leq c.$ Rather than reproduce my (messier) ...
4
votes
2answers
258 views

Maximization in Mathematica using matrix and vector notation

I am trying to solve a simple maximization problem in Mathematica, using matrix and vector notation. ...
3
votes
1answer
58 views

In NMinimize, how can I efficiently handle NIntegrate errors for non-integrable functions?

I am using NMinimize to find parameters that minimise the integral of a function in the least squares sense: ...