# Questions tagged [mathematical-optimization]

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

1,479 questions
Filter by
Sorted by
Tagged with
184 views

### Maxima turn out to be false maxima when extremising function locally

In short: I have a 2-D function that gives this plot, where the orange dots are maxima: There are 4 maxima in this plot. Now, I plot the function again in a smaller region, close to these maxima, ...
81 views
+50

### Is the stochastic gradient descent minimization implemented in Mathematica?

I want to use Stochastic Gradient Descent method on its own (not for neural networks) to minimize an objective function in Mathematica. I couldn't find any SGD routine implemented in Mathematica (12.0)...
316 views

### How can I minimize expression involving logarithms?

I am trying to find minimum of this expression: $$\log _a\left(\frac{4}{9} (3b-1)\right)+8 \log_{\frac{b}{a}}^2(a)-1,$$ where $0 < b < a < 1$. I tried ...
156 views

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

My goal is trying to solve eq2 == 0 && eq3 == 0 simultaneously in the region -200 < H < 400 and ...
103 views

### How can I solve a Set Cover problem in Mathematica

I have $n$ non-empty possibly non-disjoint sets $S_i$, each having a cost $c_i$, and the union $\Omega=\bigcup_{i=1}^{n}S_i$. How can I find a selection of $S_i$ such that the union is also $\Omega$ ...
34 views

### Problems in optimizing a function over two variables

The following function needs to be maximized over the variable $a1$ and $a2$ in the range $0 \le a1 <1$ and $0\le a2 <1$: ...
46 views

### Define a Region where a disequation is satisfied for all values of a variable

I'm having a problem with Mathematica. I have a large and complicate system of 3 inequalities in 3 variables, let's call them x,y,z. Now, I can't use reduce to solve it exactly. There is a way to ...
90 views

### Systematically Optimizing Code for Better Runtime

Can someone please tell me how can I learn to systematically optimize my Mathematica code to be faster? I have seen a blog about the same but have no idea where to ...
53 views

### Error Training FeedForward Neural Network With Various Type of Variables

I built the following FeedForward NN ...
240 views

### Optimization of the solution to an ODE

Apologies if this is obvious -- I'm very new to Mathematica. I'm trying to minimize the solution to an ODE with respect to a variable. The following code generates the solution to the ODE, ...
50 views

### How to find the maxima of this function where we have variables as powers

I have this function ...
71 views

### How to find the maximum of this using Nmaximise?

I have a function ...
77 views

### Global optimisation - Error bound on NMaximize?

Is it possible to obtain an error bound on NMaximize? e.g. convert the number returned by NMaximize into a rigorous upper bound ...
56 views

### FindRoot & Non-negativity constraints

I employ FindRoot to solve a large optimization problem. I formulate the optimization problem in terms of first-order conditions (in that specific problem, methods based on the objective function do ...
84 views

### LeastSquares vs ArgMin

From the documentation, we learn that: LeastSquares[m,b], when b is a vector, is equivalent to ...
298 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, ...
35 views

### How to make Minimize[] work better?

I am trying to solve a relatively simple minimization problem where I can add numerical values to a bunch of my inputs to guess the minimum values: ...
29 views

43 views

### How to grab two points from linear equations and from a matrix m.x == b for the purpose of creating lines or planes from each row.?

Don't get me wrong I can easily do it on paper and I could probably write convoluted code that will get the job done but I feel like there has to be an easy Mathematica way to do this. A few users on ...
69 views

### Why does NMinimize start spouting error messages?

I have the following Mathematica Code: ...
62 views

### FindMaximum / Objective function contains an exogenous variable [closed]

I'd appreciate advice on the following simple maximization problem: max_x f(x,y), where y=g(x) but y is taken as exogenous in objective function f(x,y). Eventually, I am interested in x*(g(x*)). Is ...
33 views

### ArgMin Returning Indeterminate Values (Steepest Descent w/ Exact Line Search)

To learn Mathematica, I'm attempting to implement a basic steepest descent algorithm (i.e., Cauchy's gradient descent). In an effort to improve upon previous code, I'm trying to implement an exact ...
69 views

### NSolve cannot solve. 3 equations in 3 variables

I'm trying to numerically find the critical points of the following function in 3 variables ...
91 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 ...
77 views

### FindMaximum does not use requested WorkingPrecision

I think that there is a bug in the way FindMaximum handles WorkingPrecision for constrained problems. Has anyone encountered a similar problem before? Is there a work around? Here is an example in ...
56 views

911 views

### Expressing a polynomial as a sum of squares

I encountered a degree 4 polynomial in 8 variables f(a1,a2,a3,a4,b1,b2,b3,b4) that I suspect can be written as a sum of squares. While sostools in MATLAB would find ...
87 views

### How can I find maximum of this function?

I am trying to find $m$ so that maximum of the function $f(x) = |x^3 - 3 x + m |$, $x \in [0,3]$ equal to 16. I work aroud by using the note $$\max\{a,b\} = \dfrac{a + b + |a-b|}{2}.$$ I tried <...
145 views

### Add Compile function in a code to speed up the execution

I have a code ...
29 views

### setting up constrained maximization [closed]

I am trying to enter the maximization problem with constraints below:  \begin{aligned} & \underset{x_0, x_1}{\text{max}} & & \Big[a(C-x)+(1-a)(z-y)\Big] \\ & \text{s.t.} & & ...
112 views

### Best 5 segment piecewise linear fit

I'm trying to get a piecewise linear best-fit for the closing price of one of the stocks I'm interested in. The logic seems ok, and the workflow works for a straight-line (ie 2 pts, ie 1 segment) ...
64 views

### Minimizing computation time

I'm having issues with reducing the computation time of a NMinimize function. I've tried setting the WorkingPrecision and N and ...
71 views

### Maximize does not work

I try to maximise a following function: ...