We’re rewarding the question askers & reputations are being recalculated! Read more.

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

Relationship between two minimization problems

In a previous post of mine (here), I raised the question of how to identify points on a specified frontier. My approach to it was the following: Let $\mathbf{A}$ be a ${n\times J}$ matrix with $A_{ij}...
0
votes
1answer
13 views

Find maximum of x given a bunch of constraints

Trying to find maximum of x given that '''0<=x<=3''' and some other stuff. This works fine: Clear[x, y] FindMaximum[{x, 0<=x<=3}, x] But this does ...
1
vote
1answer
28 views

Function of Maximum and Minimum Functions of Two Functions

I try to answer this question The Maximum and Minimum Functions of Two Functions I wrote the following code ...
0
votes
0answers
38 views

Numerical maximization

I am facing a numerical maximization problem with constraints. Using Method -> {"RandomSearch", "SearchPoints" -> 3}, AccuracyGoal -> 2 often does not find ...
0
votes
0answers
31 views

Is there a feasible computation?

I have to find the values of $p_1$ and $p_2$ which minimizes the expression $G$. However, when I took the partial differentiation of $G$ with respect to $p_1$ and $p_2$, the equations I obtained were ...
0
votes
1answer
35 views

Nested optimization problem 3

thanks to Ulrich Neumann I am getting close to the solution of my problem... However, Mathematica tells me that no points satisfy the constraints of the following problem: ...
0
votes
1answer
30 views

Nested optimization problem 2

I would like to solve a maximization problem which itself depends on a maximization. I came up with this code, ...
0
votes
1answer
39 views

Nested optimization problem

I would like to solve a maximization problem which itself depends on a maximization. I came up with this code, ...
2
votes
1answer
59 views

Linear map of unit cube (generalized)

This question is a slight generalization of this question. Let M be a fixed rational m $\times$ ...
0
votes
1answer
91 views

Minimize fails to find a minimum [on hold]

I am trying to find, analytically, the $\theta,\phi$ that minimize the function U($\theta,\phi$) ...
0
votes
0answers
32 views

Get default values used in an Option of a NMinimize Method

I fear the answer is trivial, but I have extensively searched without any success. Say I perform a Nminimize minimisation using the Method "Simulated Annealing", e.g. the following from the ...
0
votes
1answer
78 views

The Maximum and Minimum Functions of Two Functions

Suppose I have two functions f(x,y)=1 + 2*x +3*y^3 and g(x,y)=y + x^2. I want to have maximum function of ...
0
votes
0answers
25 views

Constrain values to numeric during Minimize

I understand, that similar questions have been asked before, but I am absolutely new to Mathematica and can not solve it myself: In nuce it is the following: I want to calculate ...
3
votes
3answers
102 views

Constraint of NDSolve with an integral of the solution

I'd like to use NDSolve and to make a constraint with an integral. For example, take the very simple : $$f'(x)=-f(x)/x_0 $$ the solution is $$f(x)=f_0 e^{-x/x_0} $$ And $f_0$ is given by : $$\int_0^...
0
votes
1answer
22 views

error for NMinimize with Parameters in the form f[a_]:=NMinimize

I'm trying to write a function of a variable as the argument of a minimization where that variable comes to play. Here is the code : ...
0
votes
1answer
29 views

Parallelizing FindMinimum

I have complicated 6-dimensional function to optimise. Using FindMinimum works all right, but takes a few minutes. Considering that I want to check multiple starting points, I'm looking at run times ...
0
votes
0answers
34 views

How to fit a spline (not interpolate) through points in 3D?

I have coordinates of points in 3D and want to fit a spline through these points. I found a least square approach for 2D case: https://demonstrations.wolfram.com/...
1
vote
1answer
68 views

How to include measurement error in FindDistributionParameters (using maximum likelihood)?

I am trying to fit a non-standard PDF to data using FindDistributionParameters. My custom distribution is defined like this: ...
0
votes
2answers
94 views

Optimize with constraints

I want to find the smallest $k$ such that $kx^2 \ge (\sin(x)-x)^2$ for all scalar $x\in[a,\ b]$? Obviously, I can do it analytically, but how can I do it (symbolically) in Mathematica? I am new to ...
2
votes
2answers
83 views

Find optimal BezierFunction

For a given set of points (examplary quadrant) n = 5; (* number of inner points*) p = Table[{Cos[φ], Sin[φ]}, {φ, Join[{0}, RandomReal[{0, Pi/2}, n], {Pi/2}]}]; ...
0
votes
0answers
18 views

The problem in finding a connected path through square lattice

I have a LxL square lattice. I randomly chose some points on this lattice and take them as my points. I want to find a connected path from left(0) to right(L). Below is my code: ...
2
votes
0answers
34 views

NMinimize with real solutions, problem in the resolution and criteria for other ways to solve equations

I have multiple parts in my question. You are welcome to answer to any of them :) Part 1 : I have 3 equations $p(x_1,y_1)=p(x_2,y_2),\mu_x(x_1,y_1)=\mu_x(x_2,y_2),\mu_y(x_1,y_1)=\mu_y(x_2,y_2)$. I'm ...
0
votes
0answers
42 views

NMinimize and large number of unknowns: avoid explicitly writing the list down

I have set up a rather large minimisation problem and it works well, if not for one nuisance. I need to often change the number of variables to be given to NMinimize: clearly it is rather impractical ...
0
votes
0answers
21 views

Different results for different LP Methods

I am trying to utilize the Farkas dual as a certificate of primal infeasibility. The goal is to solve the problem $$\min_{\textbf{y}} \textbf x\cdot \textbf b \text{ subject to } \\ \textbf 1 \geq ...
4
votes
1answer
36 views

How to use StepMonitor in NMinimize when using vector variable

Bug persists through 12.0 For example, when I call this code ...
2
votes
1answer
95 views

Implement gradient method in functional programming style

I implemented the gm for quadratic function in Mathematica, but it looks like more in an OOP style, as the pic shows. How to rewrite it in Mathematica style? I tried with following code: ...
0
votes
0answers
26 views

Making a density plot for an expression

I have defined a function the energy $E$ of a given system by ...
0
votes
0answers
49 views

LinearProgramming with constraint on result

I need to solve a bunch of Diophantine Equations that takes so looong with FindInstance/Reduce, so I tried LinearProgramming and it's very fast. Here is a simple one: ...
1
vote
1answer
48 views

Computing RMSE (Root Mean Square Error) [closed]

I have the following data: ...
0
votes
2answers
32 views

Check whether a given quantity is negative

Given four numbers $n0, n1, n2, n4$ such that $n1+n2+n3+n4 = 1$. How can we check the sign of $A - 2 B$ (where $A$ and $B$ are defined below), i.e., whether this quantity is positive or negative? <...
0
votes
0answers
14 views

Apply Conditions on the Derivative of a Model with More Equations than Data in FindFit

Looking to combine the two approaches from these two posts here: How to Add a Constraint on the Derivative of the Model in FindFit How to fit 3 data sets to a model of 4 differential equations? ...
0
votes
1answer
30 views

How to have NonlinearModelFit not evaluate a function too early?

This is a follow up of my previous question How can I define the following function for arbitray values of the arguments? that received no attention so here I will try to be more concise with the ...
6
votes
0answers
54 views

Status of DualLinearProgramming

DualLinearProgramming is referenced in this tutorial tutorial/ConstrainedOptimizationLinearProgramming It exists in ...
2
votes
1answer
43 views

How to Add a Constraint on the Derivative of the Model in FindFit

I would like to add constraints on a model and its derivatives and then use FindFit to fit some parameters. An example is below: ...
1
vote
1answer
29 views

FindFit or NMinimize? Fitting a System of ODEs to Long Time Behaviour

I am looking to fit a model composed of a system of ODEs to a long term behaviour given by a single data point of the final steady state of the system (e.g., x[1000] == pi/2). I have tried using both ...
0
votes
1answer
65 views

FindMinimum giving wrong answer [closed]

I have a very simple problem that Mathematica is giving a wrong answer to. I want to minimize the following function: $\frac{3+t^2+6\theta +3 \theta^2}{6 t^3}$ in $\theta$ and $t$. Now, plotting the ...
3
votes
1answer
265 views

Finding local minima of an energy defined by integration

This question is also asked here and here. I would like to reproduce the two solid curves in Fig. 1a of this paper. The total energy is given in Appendix A, and the curve is obtained by minimizing ...
1
vote
1answer
77 views

Solve the vector-matrix equation. Minimize the length of the desired n-dimensional vector

There is the following vector-matrix equation. where C - nonzero constant. [x1 x2 ... xn] - vector of real numbers. M - matrix of real numbers of dimension n x n It is required to find a vector $x$...
0
votes
0answers
31 views

Univariate Gaussian Splitting

I would like to experiment a bit with univariate Gaussian Split libraries. This is essentially a constrained non-linear optimization (minimization) problem. There are multiple formulations of this ...
0
votes
1answer
42 views

Using NMinimize with Table to plot an energy

I would like to reproduce the solid blue line of Figure 2a in this article. For this, I have used the code found here. Notice, however, that I am not succeeding. Could you help me? Here is my code: <...
1
vote
1answer
108 views

$\min \int_{0}^{\infty} (a f'(x)^2+b f(x)^2+c |f(x)|) dx$

Can Mathematica solve $\min_{f(x) s.t. f(0)=f_0} \int_{0}^{\infty} (a f'(x)^2+b f(x)^2+c |f(x)|$)dx ? I tried ...
0
votes
1answer
24 views

Plot with substitution of domain values before evaluation of function

I have a function of two variables $f(x,y)$. I find the maximum value of $f(x_0,y)$ by first substituting the value of $x=x_0$ and then maximizing in the range $0<y<1$. My question is: How to <...
1
vote
5answers
164 views

If someone would want to think about the question: mathematical-optimization “Banknote”

I solved the puzzle of IBM Ponder This September 2019 by my code written with mathematica. I would like to share this code after the solution that will come as soon, and discuss it. In the meantime, ...
3
votes
2answers
71 views

NMinimize is wrong : why?

Consider the following code: ...
1
vote
0answers
32 views

Time optimization of motion using mathematica

Let us say I have a double pendulum, with the torque equations and the initial and final poisition of the end point of the pendulum. I have constraints on the maximum and minimum values of torques. I ...
6
votes
4answers
644 views

MaxDetect speed

What's the fastest way to find the local maxima of a 2D list? E.g. ...
1
vote
0answers
56 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
52 views

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

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
1answer
61 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
45 views

Using MinValue with NDSolve

A simplified example looks like this. The basic idea is to maximize fHelper by adjusting \[Alpha] for each ...