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
2answers
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, ...
5
votes
0answers
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)...
6
votes
2answers
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 ...
1
vote
1answer
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 ...
3
votes
3answers
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$ ...
0
votes
1answer
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$: ...
0
votes
1answer
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 ...
1
vote
2answers
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 ...
2
votes
1answer
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, ...
0
votes
0answers
50 views

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

I have this function ...
0
votes
2answers
71 views

How to find the maximum of this using Nmaximise?

I have a function ...
0
votes
1answer
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 ...
0
votes
0answers
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 ...
3
votes
1answer
84 views

LeastSquares vs ArgMin

From the documentation, we learn that: LeastSquares[m,b], when b is a vector, is equivalent to ...
0
votes
5answers
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, ...
0
votes
0answers
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: ...
1
vote
1answer
29 views

Constrained maximization problem

I would like to solve constrained maximization problem by the Lagrangian. $ max_{q(\omega)}\ U=\left(\int_{0}^{n} q(\omega)^{\rho} d \omega\right)^{\frac{1}{\rho}} \quad 0<\rho<1 $ $s.t.\ \int_{...
2
votes
1answer
65 views

FindFit low speed when fitting polynomial coefficients: is it possible to significantly increase the speed?

I work in Mathematica with a Butterworth filter, the transfer function of which depends on the selected order and cutoff frequency. I want to evaluate the change in the location of the roots on the ...
0
votes
1answer
34 views

Optimisation Problem over binomial coefficients

I have 4 variables. $A= l{nq\choose l} {n(1-q)\choose n(1-q)-np+l}$ $B=(np-l){nq\choose l} {n(1-q)\choose n(1-q)-np+l}$ $C=(nq-l){nq\choose l} {n(1-q)\choose n(1-q)-np+l}$ $D=(n(1-q)-np+l){nq\choose l}...
2
votes
1answer
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 ...
2
votes
1answer
69 views

Why does NMinimize start spouting error messages?

I have the following Mathematica Code: ...
1
vote
0answers
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 ...
0
votes
0answers
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 ...
1
vote
0answers
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 ...
2
votes
1answer
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 ...
1
vote
0answers
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 ...
2
votes
2answers
56 views

Find more solutions by using Minimize function

I'd like to find minmum value in x^2*y under equation constraint x^2 + y^2 == 1 Hence, I use following code: Minimize[{x^2*y, x^2 + y^2 == 1}, {x, y}] I got $...
4
votes
1answer
74 views

how to make my own `PrimeQ` function?

How can I create my own function that verifies if the number is a Prime without using PrimeQ ...
3
votes
1answer
114 views

Could anyone help me find the EXACT value?

Could anyone please help me find the EXACT value (not numerical value) of this by Mathematica or by mathematical reasoning? Thanks a lot. ...
2
votes
1answer
22 views

Maximize with manipulate

Iam trying to include a manipulate to NMaximize function to see how the output values are changing for p and t. By varying the variable w, x, y and z. Kindly please help me to resolve this, the file ...
1
vote
1answer
50 views

NArgMax plotting partially wrong solution

In the following MWE, NArgMax finds the correct argmax (br1) as a function of the parameter ...
1
vote
1answer
29 views

Maximize returns indeterminate when I give it constraints

The documentation for Maximize says that it returns Indeterminate and minus infinity if the constraints cannot be satisfied. I'm puzzled when I try to solve the following (power equation for a pair ...
2
votes
1answer
57 views

Finding the extremum of a function calculated from the result of NDSolve

I am trying to find the transmission coefficient of a potential using a direct integration technique. So I start the integration left of the barrier and end to the right of it. One can then calculate ...
0
votes
1answer
35 views

ParametricPlot or Plot give “is not a real number at” next to maximize plotting

I'm doing a problem of maximizing a function (BR1) that is based on another function (BF1) and its graphical representation but I get the error "NMaxime: The function value 1.7823 + 0.535011i is not a ...
0
votes
0answers
37 views

Help with NMinimize and setting limits

Im trying to minimize the error of a function Penality that i have defined and am using the following code. ...
0
votes
0answers
31 views

Setting a minimum value for NMaximize

I'm using NMaximize to find the maximum of a multivariable equation. I know that the maximum should be greater than some minimal value, say 0.00001. How can I force NMaximize to keep searching for a ...
1
vote
1answer
119 views

Determinant of 11x11 Matrix consumes immense amount of memory

I'm trying to take the determinant of an 11x11 matrix, constructed out of some functions I've defined ...
1
vote
0answers
39 views

Finding analytic expression with replacement rules

I have a function defined as f[k_]:= Maximize[{(x^2/(1+x^2))((1-x^(2k))/(1+x^(2k+1)))^2, 0 <= x <= 1}, x] I would like to find an analytic form of $f$ as a ...
10
votes
5answers
579 views

Why does NMaximize miss this global maximum?

I am having trouble maximizing a function which appears as a curvature of a planar curve. ...
1
vote
0answers
63 views

Faster Way of Plotting a Multivariate Integral with No Closed Form and Maximized

I have a double integral that looks like this. $$J=\int_0^2\int_{-2}^2 \sin(y\cdot B_z+z\cdot B_y+\phi_y+\phi_0)\,dy\,dz$$ $\phi_y$ I am defining as different functions of y, e.g. $\phi_y=0$, $\...
17
votes
2answers
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 ...
2
votes
2answers
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 <...
1
vote
0answers
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.} & & ...
6
votes
2answers
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) ...
0
votes
0answers
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 ...
0
votes
1answer
71 views

Maximize does not work

I try to maximise a following function: ...
0
votes
0answers
38 views

how to solve a nonlinear problem with `NMinimize[…]`

I have the following code developed to balance an unbalanced square matrix using a reference matrix at t=0. ...
3
votes
0answers
22 views

1
2 3 4 5
30