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
3
votes
4answers
143 views

MaxDetect speed

What's the fastest way to find the local maxima of a 2D list? E.g. ...
1
vote
1answer
46 views

How can I find the minimum and maximum output of a function and specify the valid ranges and steping of each variable?

I am a software developer, and it has been far too long since the last time I've needed to do any math this complicated. I've forgotten a lot of the proper terminology, which has made finding answers ...
1
vote
0answers
51 views

FindMinimum where variables are Integers

I wish to find the minimum of a function where the variables are integers. Here is a simple minimum working example (my actual function is much more complicated). ...
1
vote
1answer
50 views

How to get ReplaceAll to happen before function call

I have a problem I am attempting to solve with NMinimize. I have a scoring function, which will give me a final score. The problem has many variables, so instead of having them as parameters, they ...
0
votes
2answers
41 views

Using MinValue with NDSolve

A simplified example looks like this. The basic idea is to maximize fHelper by adjusting \[Alpha] for each ...
0
votes
3answers
42 views

Minimize a function with singular points ( limit exists)

I need to minimize a function that has several problem points (divergences). For example, if I consider: ...
2
votes
1answer
84 views

How to provide an RNN various type of inputs?

I'm trying to build an RNN in Mathematica. My window is only 2 but the variables are of different types: ...
0
votes
1answer
71 views

DSolve returns unevaluated(I need a closed or numerical solution for this system and plot solution)

I am trying to find a solution to this system of differential equations but the program gives the same output without any messages. I would like help. Please find the Mathematica code posted here. a ...
6
votes
3answers
392 views

Numerical minimum of a one-valued function

Bug introduced in 12.0 My problem is that the Kernel cannot finish computation and eats up memory when a simple constraint like 0 <= x <= 2 is specified in <...
12
votes
0answers
130 views

Linear programming with lazy constraints

Does Mathematica offer any means for solving linear programming problems with "lazy constraints", as described e.g. here? While I am not very familiar with linear programming, my understanding of the ...
0
votes
1answer
72 views

How to save the output data of second order differential equation in Mathematica?

I am beginner in Mathematica. I am trying to save the output data as a text file but I could not save ! ...
9
votes
2answers
128 views

FindMaximum returns a solution that violates the constraints

I am looking at the following optimization problem $$ \begin{align*} \max\ & 1000 r_1 + \frac{1}{2}r_2 + \frac{1}{3}r_3\\ \text{s.t. }& 1000^2 r_1 + \frac{1}{4}r_2 + \frac{1}{9}r_3 = \frac{1}{...
5
votes
3answers
67 views

Approximate strictly positive solution to a linear set of equations?

Consider a positive matrix M and a positive vector b, e.g. ...
0
votes
0answers
30 views

How to solve this set of linear equations

I am trying to solve six linear equations, for which a solution exists (since it can be recovered by Matlab). I am trying to reproduce it here. I have the following MWE: ...
1
vote
0answers
24 views

Wish to increase speed of MaximizeOverPermutationMH merit function

I am working with MaximizeOverPermutationMH (see Link to discussion about function and would like to optimize the execution speed of the merit function. This function accepts a 100-digit permutation ...
1
vote
0answers
15 views

How to minimize the eigenvalues of a hermitian matrix?

Suppose I have a complex hermitian matrix, M[x_,y_] whose eigenvalues must be real.I tried to minimize the first eigenvalue by writing following command:f[x_,y_]:=Eigenvalues[M[x,y]][[1]]; Minimize[f[...
1
vote
1answer
17 views

Numerical Maximization with Alternating Sum

I need to maximize a function that involves an alternating sum and a set of constraints. I have tried the following code: NMaximize[{(-1)^{m}*n!, n + m == 7, m > 0, n > 0}, {m, n}] However, the ...
0
votes
3answers
43 views

Optimizing with respect to the parameters of an optimization problem

I’ve got this simple loop that prints out the solutions to 2 simple equations for various values of parameters $a$ and $b$. I need to add a command that would display the parameter values that lead ...
0
votes
0answers
35 views

Analytic maximization that reduce fails to solve

I'm working on an interesting problem but stuck on a step that Mathematica fails on (no matter what angle I try to get at it from). I'm attempting to find the symbolic maximum of this convex function ...
5
votes
1answer
80 views

Matching spectral data to known spectral lines

Preamble: I designed some code to help me take spectral images from a spectrometer and convert pixel number into wavelength. It does reasonably well at matching a calibration spectrum of a neon lamp ...
11
votes
2answers
162 views

Custom SGD optimizer in Mathematica neural network framework?

I have a new approach to SGD optimizer, and thought to try to test it in Mathematica. It uses gradients to simultaneously maintain online parabola model for smarter choice of step size - I only need ...
0
votes
1answer
58 views

Solving a profit maximization with Cobb-Douglas production function

I'm considering a typical profit-maximization problem: \begin{equation} \label{optimization1} \begin{aligned} & \underset{K,L}{\text{max}} & & P Y - r K - w L \\ \end{aligned} \end{...
4
votes
1answer
60 views

Working examples for SemidefiniteOptimization

It appears to me that for some types of invocation, SemidefiniteOptimization is not working for matrices larger that 2x2. An example from help that works ...
5
votes
1answer
132 views

Assign Error bars for y-intercept

I have some data (x,y) with error bars in y direction: ...
2
votes
0answers
35 views
3
votes
2answers
134 views

Plotting maxima within a simplex

I am trying to draw a particular maximum plot within a simplex. I have functions based on two variables: Write p,q for the two variables where p,q \geq 0 and p + q \leq 1. This defines the simplex ...
4
votes
4answers
119 views

Find maximum according to a parameter

I am new to Mathematica. I want to find the maximum of the functions: ...
0
votes
1answer
47 views

Maximize a definite integral with constraints on the limits

I would like to maximize the following definite double integral with respect to $0<r<\frac{1}{2}$: $\int _0^{\frac{d}{1-r}}\int _{\frac{d+r x-x}{r}}^s [(1-r) x+r y -d]dydx$ under the ...
0
votes
1answer
39 views

Solving a specific equation in Mathematica & Finding the range of a value in an inequality

Is there any way to solve (or even approximate the value of x) the following equation in Mathematica? ...
13
votes
4answers
370 views

Optimization of function taking a permutation

I have a function $f$ which takes a permutation $P$ of the integers 1-100 in order to give a numerical value $f(x)$. The function is given by a black box, but is relatively "smooth", so should be ...
0
votes
0answers
70 views

Time spent on a transformation exceeded 300 when solving the optimization problem

I have the code which shows below to solve an optimization problem, but it will show that it's over the time constraint of 300 seconds. Is there anyone who could help me solve it. Thanks. ...
4
votes
3answers
108 views

Problem with minimization of $x^z$

I have plugged in the following problem Minimize[{x^z, z >= 1, z <= 10, x >= 1}, {x, z}] Can anyone explain please why the software does not provide the ...
2
votes
0answers
35 views

How to read and write the same text file in Parallelization using ParallelTable? [closed]

I want to know how to write and read a same text file (for example, external.txt ) without conflicts in parallelization. The following is just a small idea, but the problem is there seems a conflicts ...
1
vote
0answers
60 views

Optimization in Mathematica

I'm trying to solve the optimization problem below, but it seems like I don't get something about how the function works. Anyone see what is wrong? Would be happy to exchange for the newer ...
0
votes
0answers
73 views

Plotting a maximization of a definite integral

I am applying Alex Trounev's approach suggested in this post. It worked for the function in that post. But it is now not working for another, more complicated function. My objective function is $f=\...
0
votes
0answers
70 views

3D-plot of a maximization of a definite integral

I'm applying the answer (If method) suggested by 'ThatGravityGuy' in this post in a more complicated case. Consider my objective function (pardon its formidable ...
0
votes
0answers
69 views

Efficient Mathematica Code for List Problem

Say we are given $f(m,n)=m \pm 2n + (-1)^n$ where $m>0, n>0$, $m$ as well as $n$ are integers. The problem is to generate a list of all the integers that will not be found in the list of values ...
1
vote
1answer
60 views

3D Plot multiple maximization results in one same diagram

My objective function, $f(r,k;s,d)$, takes three different expressions, denoted by $f^1$, $f^2$, and $f^3$, respecitvely, depending on the conditions for the arguments and parameters as follows: $f^1(...
0
votes
1answer
61 views

3D Plot maximization results with varying parameter values

I'm trying to maximize the following objective function with respect to $r$ and $k$ $objF = \frac{d^3+3 d^2 (k (r-1)-s)+3 d \left(k^2 ((r-3) r+1)+2 k r s-2 (r-1) s^2\right)+k^3 (r ((r-1) r+3)-1)-3 k^...
1
vote
1answer
83 views

`Maximize` is running forever

I'm trying to maximize the following function $f$ with respect to $r$ and $k$: $f=\frac{d^3+3 d^2 (k (r-1)-s)+3 d \left(k^2 ((r-3) r+1)+2 k r s-2 (r-1) s^2\right)+k^3 (r ((r-1) r+3)-1)-3 k^2 r^2 s+3 (...
2
votes
1answer
105 views

Findminimum of Integral

I am trying to find the value of $u$ that minimizes the following expression: ...
1
vote
1answer
60 views

Transpose Error

I have this code: ...
0
votes
1answer
63 views

Find roots of a polynomial equation or simplify

I have an equation like below: ...
2
votes
1answer
48 views

PeakDetect Function Behavior and Parameters

I am currently using PeakDetect for a project, but I'm not sure how the sharpness parameter works. I can qualitatively tell what it's doing, but is there a more analytical/mathematical way to define ...
1
vote
1answer
76 views

How to pass lists as arguments in NMinimize or FindMinimum?

The following code runs in Mathematica 12. But, I have two problems that I would like to solve: (1) How to pass a list as an argument to the function g in such a way that it can be used seamlessly ...
0
votes
0answers
61 views

How would you write this set of linear programming problems as latex?

I am not able to make self understood over at Mathematics Stackexchange in this question. Therefore I ask here the Mathematica experts how to write these linear programming problems as latex, the ...
0
votes
1answer
38 views

Modifying/optimizing a double sum with an If condition

I would like to better understand double summations where one of the sums depends on the upper limit of the previous sum. This appears frequently in representation theory (to the extent of my ...
0
votes
1answer
52 views

Calculating the distance between two points and get direction [closed]

I am programming a molecular dynamics program with periodic boundary conditions. Here, I have a problem: I have a list of coordinates like ...
1
vote
1answer
31 views

Linear Programming using Maximize

I am trying to solve a more complicated version of the following LP problem: I have some constraint amounts a,b,c and two variables made of those amounts. I would like to find the best way to ...