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
1
vote
1answer
71 views

Error when calling NMinimize on an InterpolatingFunction which depends on parameters

I'm trying to solve a basic calculus of variations problem numerically, by minimizing an integral over an Interpolating Function. Basically this: ...
2
votes
0answers
27 views

Supply gradient to FindMinimum subject to constraints

FindMinimum supports explicitly supplying the gradient (as well as the Hessian) via the Gradient (resp. Hessian) option. However,...
1
vote
0answers
72 views

Singularity or stiff system in ParametricNDSolve

I have following parameters and equations(it's a complex one, please check it :) ): ...
0
votes
1answer
63 views

Using SemidefiniteOptimization with a partial-ordering constraint

I'm running into an issue enforcing a particular constraint on the variables of a SemidefiniteOptimization problem (I'm using Mathematica 12.3). Specifically, it seems that if a matrix $A$ and a ...
-1
votes
1answer
53 views

Nested NMaximize

I am trying to simulate a Stackelberg Competition model in Mathematica, where the problem is: Player 1 has utility function f[x, y, z] and plays first. He can ...
0
votes
0answers
34 views

Optimization when actively working with the NDSolve command

Lagrangian of three-mass system with Mathematica Based on the Lagrangian of a mechanical system, we can obtain a system of equations of motion. These equations can be explored numerically using the ...
0
votes
0answers
14 views

Why increasing PrecisionGoal and WorkingPrecision is deteriorating my results

I am minimizing a variable subject to many very complicated constraints, like ...
0
votes
1answer
50 views

Maximization under constraints / find maxima

I am trying to code the following maximization program that I am not able to solve algebraically (Of course I manage to get the first derivative, but struggle finding its root): $\begin{equation} Max_{...
2
votes
0answers
71 views

Approximate integer factorization

Suppose we would like to compute an approximate prime factorization of a large integer x in the sense that the difference between ...
7
votes
1answer
111 views

Kronecker Square Roots

I'm interested in computing the 'Kronecker Square Root' $\mathbf{A}_{n\times n}$ of a matrix $\mathbf{M}_{n^2\times n^2}=\mathbf{A}\otimes\mathbf{A}$. In case it doesn't exist, I'd like to find the ...
0
votes
1answer
46 views

Minimizing a function over a bounded domain with binary variables

I want to minimize the following function: $$ f(m,n)= \sum_{i=1}^N\Big\{ \alpha_i(x_i-m)^T(x_i-m) \Big\} + \sum_{i=1}^N\Big\{\beta_i (x_i-n)^T(x_i-n) \Big\} $$ where $m,n$ are all 2-d vectors: $$ m:= ...
1
vote
1answer
65 views

Maximization of piecewise function

I'm trying to maximize piecewise functions with parameters but haven't been able to do so. Here is a minimum example: ...
0
votes
0answers
22 views

General::munfl - Precision lost in LinearModelFit

I am new to mathematica so I am confused regarding the loss of precision in LinearModelFit. In building a linear model with uora (1 or 2) and encodeSeverity (1,2 or 3) ...
0
votes
2answers
70 views

NMinimize over a list of integers

I'd like to minimize some function (of 3-4 variables) over a big list of integers, but not consecutive. Like arr = {5, 10, 7, 101,...} I did not understand this ...
0
votes
1answer
37 views

Trouble using NMinimize [closed]

I am trying to minimize five function at the same time. I am running in some trouble minimizing this function, as since I am not that familiar with Mathematica I really do not know what I am doing ...
0
votes
0answers
40 views

Low Tolerance making wrong behavior of LinearProgramming?

I was working on a code that needs to check feasibility of LP problems. I visited Checking linear program feasibility? and used the code. With this code, since there is 1 at the last position at every ...
0
votes
2answers
103 views

How to solve a nonlinear system of equations with exponential terms

I want to solve this parametric nonlinear system of equations in Mathematica: $$x−1−(e^{a−x}+e^{b−y})/(c+e^{b−y})=0$$ $$y−1−(e^{b−y})/(c+e^{a−x})=0$$ and I used this code: ...
2
votes
1answer
46 views

Stop Minimization after condition

I want to interrupt the optimization of a function when a particular condition is satisfied. Here I provide a test function. ...
1
vote
2answers
131 views

Is there a way to do this more efficiently?

I'm trying to write this Mathematica function to find the optimal price for a model, given some model parameters. This is a stylized example of what I'm trying to do, and I'm wondering what's a better ...
0
votes
1answer
79 views

What has Maximize been thinking about for so long?

The command Maximize[{Sqrt[2 x + 13] + (3 y + 5)^(1/3) + (8 z + 12)^(1/4), x + y + z == 3&&{x,y,z} >= 0}, {x, y, z}] is running without any response on ...
0
votes
1answer
23 views

NMaximize giving error when trying to find global maximum [closed]

I've been trying to use mathematica to find the maximum of 1/(1 + e^(-(x - 9))) + 1/(1 + e^(-(y - 9)) where x>0,y>0 and x+y=100. This is the code I've been using: ...
0
votes
1answer
49 views

How to force NMinimize to find the correct global minimum for equation with many local minima?

I have a function that I am unable to recover a solution for. Here, 0.533... and 0.428... are the exact solutions for Rs[399] and ...
0
votes
0answers
19 views

NArgMin “function value is not a number” error

The "function value is not a number" type error seems fairly common. Forgive me, but I can't seem to fix my issue using some of the other posts on this site. I'm working on a problem where I ...
0
votes
0answers
28 views

Evaluating function of two variables inside NMinimize with respect to second argument

Consider three functions: f[t_, 1] := {Cos[t], 1, 0} f[t_, 2] := {Sin[2 t], 1, 0} f[t_, 3] := {Cos[t - 2], 1, 0} For each $k=1,2,3$, let $g(\cdot,k)$ be the ...
0
votes
1answer
75 views

How to derive all KKT points of a parametric optimization problem

Suppose we have a symbolic optimization problem where all parameters and decision variables are nonnegative like the following problem. I would be thankful to know if there is any method to find all (...
0
votes
0answers
59 views

Calculating my code for higher values of `k`?

How do I calculate the mean of A for higher values of k ...
7
votes
3answers
361 views

Speed up minimization of a high-degree polynomial

For fixed $s$ and $n$, I need to find $\alpha$ which minimizes the following expression $$h (I-2\alpha H + 2\alpha^2 H + \alpha^2 \mathcal{H})^s x0$$ where $$ \begin{array}{lll} h&=&(1,\frac{1}...
0
votes
2answers
175 views

Is it possible to calculate the desired area analytically?

I have the three two-variable curves $f,g,h$ with $0\leq x\leq \frac {\pi}{2} $ and $0 \leq y \leq \pi$ I use ContourPlot as ...
1
vote
0answers
30 views

Why do I get the (NMinimize::nrnum) error and how to fix it?

I have an energy function which depends on the angles of the electrons({x} symbol for theta) and phase of electrons({y} symbol for phi). I am using NMinimize to minimize the energy with respect to {x}...
4
votes
1answer
128 views

MaxCut SDP primal in mathematica

How could one formulate the primal SDP for MaxCut in Mathematica. I am aware of this tutorial using the dual: https://www.wolfram.com/language/12/convex-optimization/max-cut-problem.html?product=...
5
votes
4answers
151 views

Are there any alternatives for NIntegrate to calculate the area for which $f(x,y)<0$?

I have this two-variable function $$f(x,y)= (8 \cos (x+y)+7)\cos \left(\frac{x}{2}\right)+\cos \frac{x-2 y}{2}+2 \cos \left(\frac{3 x}{2}\right) $$ where $0<x,y<\pi$. I want to calculate ...
0
votes
1answer
51 views

Integral with exponential function

Could you please help me in solving the following integration. Thank you in advance. Integrate[((Sqrt[g*(x + h)/y])^V) * Exp[-u * Sqrt[g*(x + h)/y]/n] * Exp[-L*x], {x, 0, Infinity}]
18
votes
3answers
1k views

How can I use Python's SciPy and NumPy functions in Mathematica to find the minimum of a function?

I have written my code in Mathematica, final aim of this code is to find the minimum of a function. I found that FindMinimum and ...
0
votes
0answers
16 views

Using FindArgMax in NSolve with dependant variables

I have a function for a current through a series circuit containing a capacitor(c) and a resistor(r) and a battery(Ebatt) when the capacity increases from c0 to c. ...
0
votes
1answer
70 views

Portfolio optimization

Mathematica provides codes for a portfolio optimization https://www.wolframcloud.com/objects/summerschool/pages/2017/AndresLopezMartinez_TE that do not work anymore. Any reason why? I have been trying ...
0
votes
0answers
64 views

Simplify a heavy calculation

I'm aware that this may be regarded as too non-specific and with too little information, but I hope that someone will be able to help me nonetheless or to request information which would be imperative ...
2
votes
2answers
66 views

Can't find parameter with findFit NMinimize

I have a data list and a function being to be fitted to the data to get parameters of the function as below. I can't find the parameters a, b, c, d with different below methods. Can you help me to ...
0
votes
1answer
41 views

ArgMax : Variable Domain Error [closed]

I'm attempting to utilize the ArgMax function, but am receiving the error "ArgMax::vdom: Variable domain ... should be either Reals or Integers." ...
1
vote
1answer
59 views

LinearOptimization duality

I'm solving a linear program using LinearOptimization. I'm curious why "DualityGap" does not return zero (as described in the docs). Here's the code: ...
1
vote
1answer
76 views

Plot “Findroot” with very complex variables

I ran into an extremely complex "zero problem" and don't know how to solve and plot it. Can anyone help with this, please? [Pi]s and [Pi]r are objective functions, pd, po, qd, qo, and [Phi] (...
0
votes
1answer
58 views
0
votes
0answers
71 views

NMinimize for searching global minimum

I have been trying to find global minimum for this equation for some time now. The equation is quite easy to understand. It is made with sumation of stress equations of points on the border where $σ_{...
2
votes
1answer
49 views

How to use parts of expression as variables in Minimize (NMinimize )?

I want to solve some optimization problem involving matrices. A toy example related to the problem looks as follows ...
0
votes
2answers
108 views

How to get mathematica to give an exact answer rather than a numerical approx

I tried // Rationalize but it just gave the same answer Please help
2
votes
1answer
60 views

Finding the maximum value from the roots of a solution when there is an ambiguity

I have a variable x = l*Cos[t]*Cos[a] - Sin[t]*Sin[a] and I want to find the maximum value of x with respect to a, as well as access the roots. I have tried ...
1
vote
1answer
43 views

Nominal variables in LinearModelFit must be specified before continuous variables

I am applying the LinearModelFit to a 90 x 5 matrix, in which the 4th variable is a nominal variable (i.e., x4 is a categorical ...
2
votes
0answers
53 views

How to find the regions for which the derivative of my function changes sign?

I have an energy function of the angles of the electrons' spins. th1 is vector with (2l+2) elements and each element represents the angle of an individual electron spin. I need to eventually find the ...
1
vote
0answers
69 views

What is the best optimization method for the following function?

I have calculated the energy of the electrons as a function of their angles. and I want to find the angles for which my function (energy) is minimized. I have used NMinimize, but the angles I get from ...
1
vote
0answers
43 views

Overriding AccuracyGoal in NMinimize

How can I override the AccuracyGoal parameter in NMinimize? Instead of the evaluation stopping at the required Accuracy, I want it to stop after a specific number of iterations, even if the ...

1
2 3 4 5
35