Questions tagged [mathematical-optimization]

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

Filter by
Sorted by
Tagged with
8
votes
3answers
2k views

How to find the maximum value of an integer that satisfies some inequality

Consider the following Mathematica expression: Reduce[2^j/(j + 1) <= 10, j, Integers] which outputs: ...
8
votes
1answer
479 views

What is going on in this plot?

Plot[{ArgMax[Cos[t] Sinc[2*Pi kl (Sin[t] - 1/Sqrt[2])], t]*180/Pi, 45}, {kl, 0, 10}, PlotRange -> Full] I want to know what causes this, and how to fix it ...
8
votes
1answer
417 views

ParametricNDSolve[ ] and NMinimize[ ] in Combination

I have the following code that is used to simulate a spacecraft orbiting Mars, and uses ParametricNDSolve to vary the spacecraft's initial conditions using a parameter value ...
8
votes
1answer
228 views

Is there any way to speed up this code that's Maximizing a function got from numerical integration?

I have this code below, which is calculating the Binding energy of an electron in a Quantum Well Wire with a hydrogenic impurity in it. Well you don't have to care much about what kind of calculation ...
8
votes
1answer
156 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 ...
8
votes
1answer
132 views

A puzzling maximization issue using Abs[ ] in the constraints

Consider the following pair of commands. Maximize[{x^2 + y^2, Abs[x] <= 1, Abs[y] <= 1}, {x, y}] $\{2, \{x \rightarrow -1, y \rightarrow -1\}\}$ ...
8
votes
1answer
376 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 ...
8
votes
1answer
509 views

NMinimize with NIntegrate (crash in symbolic evaluation, memory leak)

This is a "common" problem from what I've seen, but with a different spin. I have a function I use often that finds a fit of an expression to another expression with some free parameters (e.g. for ...
8
votes
1answer
1k views

Using Mathematica to help to determine the consistency of and numerically solve systems of non-linear equations

The formal problem The question I am about to ask is applicable to many scientific and engineering problems. In short, I am bout to ask for pointers and practical advice for Mathematica beginners who ...
8
votes
0answers
121 views

StableMarriage vs. FindIndependendEdgeSet: How to use the procedure FindIndependendEdgeSet as a Gale-Shapley algorithm?

From Help, the procedure StableMarriage was an element of the Combinatorica, but it is available in the built-in ...
8
votes
0answers
166 views

FindShortestTour causes kernel crash

I have contacted support, CASE:4075709 UPDATE I have received reply from wolfram support. They have confirmed that this is indeed a bug. There are lots of sets of data that can cause the Kernel to ...
8
votes
0answers
371 views

How to determine reason for kernel crash? -> Nelder Mead optimisation

I am making use of the Nelder Mead algorithm inside Mathematica's NMaximize to find a parameter set by solving the Schrodinger equation for a given system. (see ...
7
votes
4answers
594 views

FindMaximum of Interpolated data set

Probably a fairly easy one; but I'm drawing a blank I would like to find the maximum of an interpolated data set. I've tried using ...
7
votes
6answers
402 views

Finding a center and radius that minimizes total distance

I have a list of $d$-dimensional data points $x_i$, and I want to find a $d$-ball which minimizes the sum of the squares of distances between the surface of the ball and the points. In other words, I’...
7
votes
3answers
339 views

What is the best way to track the gradient to a local minimum?

Given a function of multiple variables, and some initial conditions, I would like an efficient way to track the gradient to the local minimum of that function. Two options spring to mind — to either ...
7
votes
1answer
580 views

Is there any strategy to have a compiled version of FindFit or NonlinearModelFit?

Disclaimer: This is not a precise question with a definite answer. I know that neither FindFit nor NonlinearModelFit is in the ...
7
votes
2answers
217 views

How to Maximize[Log[n]^(1/Log[n]), n]

I am new to Mathematica and am trying to work out how to use Maximize. Maximize[Log[n]^(1/Log[n]),n] Should give a solution at $e^e$. However in Mathematica you ...
7
votes
3answers
769 views

Not able to get a solution to a Lagrange Multiplier Equation

I assigned several constrained optimization problems to my calc IV students to solve with Mathematica, but this one is being stubborn. The function to optimize is: f(x,y,z) = y Exp[x-z] with the ...
7
votes
2answers
566 views

FindMinimum: How can I know which method Mathematica has used?

I have been using FindMinimum to find a local minimum of a non-linear function within a constrained region. How can I know which method Mathematica has selected to find the local minimum? Thanks in ...
7
votes
2answers
1k views

Packages for Semidefinite programming

This question has already been asked here. I am not sure, whether I should have asked this question as a comment of an old question or in the general programming forum of stackexchange. Moderators ...
7
votes
1answer
335 views

Risk-return trade-off — solving a convex optimzation

I try to convert a convex optimisation (cvxopt) example to the Wolfram Language from python. Source of the python code: Risk-return trade-off Please advise me on how to convert the following python ...
7
votes
2answers
956 views

Graphically solving a linear programming problem

I try to realize the graphical linear programming method. Here is my code ...
7
votes
2answers
1k views

Using compiled function inside NMinimize

Consider this code: ...
7
votes
1answer
526 views

Visualization of iteration procedure in NMinimize

I have this optimization code: ...
7
votes
1answer
167 views

How to generate optimal solution and order the rest

This is a decimal maze, you start with 100 points and you must choose the path that gives you the highest score. Rule: You should not go twice for the same point and the same segment. My question: Is ...
7
votes
2answers
191 views

Test existence of a path from one side of a graph to another

I'm trying to determine how I can test if a path exists from one side of a graph to another as efficiently as possible. If I have the Lines given by: ...
7
votes
1answer
440 views

How to stop optimization (e.g. NMinimize) after reaching target value

Suppose we have some function f[x,y] that we want to optimize in way that we are only interested in values (x,y) that guarantee ...
7
votes
1answer
318 views

Large scale linear programming (Data imported from .mat file)

I tried to run a large scale linear programming with mathematica. I entered the code below: ...
7
votes
1answer
3k views

Solve Lagrange multipliers optimization problem

I have two nested solid figure, where $V(a,h,\tau)$ defines the volume and $A(a,h,t)$ defines the surface. The outer solid figure is parametrized in $a_s$,$h_s$ and $t_s$ (they share a common center). ...
7
votes
1answer
1k 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?
7
votes
1answer
222 views

NMinimize Example from Wolfram Documentation Center

Here is the third example of NMinimize function from Wolfram Documentation Center at Possible Issues section. ...
7
votes
0answers
826 views

Visualizing the Lagrange Multiplier Solution

This question is based on work in Susan Colley's Vector Calculus, 4th ed. The question is to find and classify critical points of $f(x,y,z)=3xy-4yz+5xz$ subject to the constraint $g(x,y,z)=3x+y+2z=13$...
7
votes
0answers
2k views

When using NMinimize[…,Method->“DifferentialEvolution”] is an “iteration” different than a “step”?

Hopefully this question has a simple answer. I have the following bit of code: ...
6
votes
4answers
655 views

MaxDetect speed

What's the fastest way to find the local maxima of a 2D list? E.g. ...
6
votes
4answers
302 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 ...
6
votes
3answers
460 views

How to make the computation of a minimum efficient?

I have a $80\times 80$ matrix $A$ and a vector $P$ and I want to compute efficiently the following minimum $$ \min\{n\in \Bbb N :\|A^nP\|_\infty < 1\} $$ Then I defined my matrix and vector in ...
6
votes
2answers
644 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 ...
6
votes
2answers
252 views

Counterpart of Maple's LSSolve in Mathematica

I am a great fan of Mathematica. Unfortunately, due to some specific tasks I had to move to Maple. I think it's my lack of info that is not letting me do those tasks. That is why I am asking some ...
6
votes
1answer
2k views

Packing squares into a circle

I am currently trying to solve and understand a problem about packing the maximum of squares into a circle. What I am trying to do, is to calculate the maximum number of variable sized squares (with ...
6
votes
1answer
154 views

Assign Error bars for y-intercept

I have some data (x,y) with error bars in y direction: ...
6
votes
3answers
925 views

How to use a compiled function in numerical optimization

I'm trying to wrap my head around function Compile. So, this is a spin-off question from: a previous question on using compile[] correctly. I have a function that ...
6
votes
1answer
3k 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 ...
6
votes
2answers
491 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 ...
6
votes
1answer
486 views

Which algorithm does Mathematica use for “RandomSearch”?

Recently I have used Mathematica for minimization of certain functions and I have realized that even though it lasts much longer, the method "RandomSearch" functions much better than the other methods ...
6
votes
1answer
517 views

Defining a non-linear optimization-problem

Consider the following non-linear optimisation problem: ...
6
votes
2answers
94 views

Strange results when finding a maximum subject to constraints?

I'm using 11.1.1, and I tried running the following: ...
6
votes
1answer
386 views

Different results for MaximumLikelihood depending on method?

When I used this command: ...
6
votes
1answer
172 views

Print out parameters at every 100 iterations

I am fitting some data to my model. I would like to print out parameters values say every 100 iterations (or 500) to check values getting steady state. Actually, I have a larger data and more ...
6
votes
1answer
130 views

Understanding KnapsackSolve

I was playing around with the new KnapsackSolve function in Mathematica 11 and came across something odd that I don't understand. Perhaps someone could shed some ...