The Stack Overflow podcast is back! Listen to an interview with our new CEO.

Questions tagged [mathematical-optimization]

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

1,283 questions
Filter by
Sorted by
Tagged with
99 views

Find k largest edges with unique nodes (kind of maximum weighted matching)

I have a weighted graph, and I am interested to find k largest edges with unique nodes. Currently, I do it in the following manner ...
22k views

How to find all the local minima/maxima in a range

I want to find : all local maxima in range all local minima in range From those points I can interpolate and combine functions upper and lower boundary. What I am really interested in, is the mean ...
55 views

NMaximize refuses the constraint set [closed]

I want to run the following NMaximize code but I receive warnings that the constraint set is not right. ...
329 views

Solve struggles to solve equation with variable constraint

I am trying to find {x,y} set satisfying first order conditions with the constraint: 0<x<=y<1 Here is my code, which ...
541 views

FindMaximum of Interpolated data set

Probably a fairly easy one; but I'm drawing a blank I would like to find the maximum of an interpolated data set. I've tried using ...
55 views

Minimizing a univariate function that receives a vector?

I'm trying to minimise a function of the form $f(s)=\frac{1}{T}\sum^T_{t=1}(x_t-s_t)^2+\sum^T_{t=2}(s_t-s_{t-1})^2$, where the vector $x$ is fixed, and $T$ is of the order of $10^2$. I've tried <...
175 views

For a polynomial F with dependence on a parameter beta, find the value of beta for which F has 2 positive roots

Good morning, I have the following polynomial with degree 4 and its coefficients are quadratic functions of a parameter beta: ...
124 views

Maximax optimization over a particular matrix

I have the summation of $N$ matrices which are weighted by some weighing factors (parameters): $$M_\alpha=\sum_{i=1}^N \alpha_i M_i$$ $$d_{\alpha}=\arg\max_{rows} M_\alpha$$ The ideal vector $d$ is ...
131 views

Optimization Problem: NMaximize goes out of the constraints

I am having issues with the code: ...
65 views

Optimization issue: I'm not getting the correct maximum

I have the following code: ...
119 views

Find initial surface to minimize between two close curves

I have two close curves in space defined by $g$ and $h$ with: ...
92 views

Minimizing chi-squared to find unknown value of parameters

X= Sum[(events[[i]] - f[x, a, b])^2/ events[[i]], {i, 1, 40}] I want to minimize X to find the value of a and b. How will i do it?
242 views

Discrepancy between Minimize and NSolve

I was trying to minimize a quartic polyonomial equation with a constraint using Mathematica but I got some conflicting results and I wanted to ask to you. Am I making a conceptual mistake or a coding ...
473 views

FindMinimum: How can I know which method Mathematica has used?

I have been using FindMinimum to find a local minimum of a non-linear function within a constrained region. How can I know which method Mathematica has selected to find the local minimum? Thanks in ...
181 views

Golden section search method that terminate after $n$ iterations

I am attempting to code a program that executes the golden section search method and I would like to terminate the computations after $n$ iterations, where the user decides what $n$ is. My code works ...
56 views

NMaximize not finding initial points within simple constraints

I'm trying to do an optimization, but Mathematica seems not to be able to find starting coordinates within a simple rectangular region. When I run this code: ...
58 views

Unable to use Solve to solve simultaneous equations, or use Maximize for exact maximum solution

Mathematica has found that the maximum of the following function is negative using NMaximize, but I am trying to prove that the maximum is negative (i.e. that the ...
76 views

Find minimum precision setting

I am using FindMinimum command to find a local minimum of an object function. My code is below ...
71 views

Parametric minimization running forever

I am trying to solve for the minimum distance between a line and a cone, for all possible lines in 3D space. I've formulated this as a call to Minimize, but it ...
5k views

Finding all maxima and minima of a function

To find all (global and local) extrema of a function in $\mathbb R^3$, I have written the following. Example function: ...
71 views

Global minimum of a function in a specified interval [closed]

I've got the following definition of fun1. epsilon = 10^(-8) fun1[h_] := (2 epsilon*Abs[Cos]/h ) + (h*Abs[Cos]/2) Let'...
427 views

Symbolic Optimisation

I'm trying to solve symbolically the following optimisation: $$\min_{q_uu}\ \Biggl[ q_u q_{uu}\psi B_{uu} + q_u q_{ud}\psi B_{ud} + q_d q_{du}\psi B_{ud} + q_d q_{dd}\psi B_{dd}$$  + \...
160 views

Is my Maximize expression too complicated for Mathematica to handle?

I am new to Mathematica and am using it to determine when a function reaches a maximum. ...
53 views

Optimize the distribition of a dataset over 4 quadrants

I want to optimise the distribition of a number of records over four quadrants. As a example I use this dataset ...
2k views

Given a list of integers, find the largest sum of a contiguous subsequence

Given a list of integers, find the largest sum of a contiguous sub-sequence. {1, 2, 3, 4, 5, -1, 7, -4, -2} (* 21 *) And print the sub-array which is ...
177 views

How can I get the exact answer of the maximum of this function?

I am trying to find the maximum of a fuction: $f(x)=\sqrt{x^2+9}-\sqrt{x^2-\sqrt{3} x+1}$. I tried Maximize[Sqrt[x^2 + 9] - Sqrt[x^2 - Sqrt*x + 1], x] and ...
123 views

Using MaxValue and MinValue with two constraints

This is my code below. I'm trying to find the min and max values of z0value1 in the range of cmin<c<cmaxthat satisfies the equation and the inequality inside ...
34 views

How do I maximise the first real root of a multi-variable polynomial in x?

I have a polynomial in x, that also depends on {y1,y2,y3,y4,y5}. It always has 10 (not necessarily distinct) real roots. It's top coefficient is (1*x^10) I aim to find the y's that maximize the ...
769 views

Linear Programming Using Dual Simplex method

I want to solve an optimization problem using the Dual Simplex Method. Although Mathematica gives the result directly when I use the command Minimize but I want to ...
82 views

...
117 views

Find the optimum graph for the max flow problem using network's edge capacity matrix

I want to calculate the maximum flow of the network and am attempting to do that with FindMaximumFlow[edge capacity matrix, s, t, "OptimumFlowData"], which in my ...
79 views

Constrained Optimization doesn't converge?

Given a $n\times J$ matrix $T$ with strictly positive elements, I'm trying to obtain the values ($\lambda_i$) that minimize $\sum T_{ij}\lambda_i^{\alpha_i}$ with the constraints $\lambda_i \geq 0$ ...
111 views

...
35 views

Constrained optimisation problem with Maximize

I am trying to solve a constrained maximisation problem in Mathematica but I am getting the same output as my problem. My input is ...
83 views

Is it possible to solve following question about integer programming using mathematica?

Consider a $5$-uple $(r,a,b,c,s)$ with $a,b,c\in\mathbb{Z},s\in\mathbb{Q}_+,r\in\mathbb{Z}_+$, denote $\frac{1}{2}(a^2-b^2-c^2)-\frac{s}{r}$ by $\Delta(\mathbf{v})$. Let $A$ be a positive real number....
75 views

Solving a non-linear system of equations given $1000$ data points

I have a vector of $1000$ data points saved in a vector $y$ and I need to solve a set of non-linear equations. Since I cannot write down all $1000$ values, I will assume that I have the following data ...
58 views

Minimization and Manipulate[Plot] not working as expected

Quite new to Mathematica, and I have been trying to fix the code using online resources for the past few days now. I am trying to plot and minimise this equation to learn more about its properties: (...
45 views

Optimization with constraint or with the constraint embedded into the problem?

I need to find the minimum of a function. However, the condition is that the final state should be normalized i.e. sum of the squares must be one. One way to deal with it is just add the constraint ...
473 views

Which algorithm does Mathematica use for “RandomSearch”?

Recently I have used Mathematica for minimization of certain functions and I have realized that even though it lasts much longer, the method "RandomSearch" functions much better than the other methods ...
476 views

How to use Levenberg-Marquardt for parameter identification

Imagine I have a function called fun1 that returns a vector of numbers fun1[a,b,c,d,...]:=. ...
57 views

Finding algebraic expression for local minimum of a function with one unassigned variable

I want to find the local minimum in the region 0.5<x<=1 of a function which has an unassigned variable r (note: ...
82 views

FindMaximum wont give the correct solution

So i have this function for witch i made a 3D plot and tried to do a FindMaximum[func,{x,0},{y,0.45}]]search for coordinates x=0 ...
232 views

How I can use FindFit to simultaneously fit two data sets to two equations having shared parameters? [duplicate]

I think that FindFit package with the method Nminimize yields global minimum if initial values of adjustable parameters are ...
130 views

“Forcing output of a function to be Real in Mathematica” Non-linear optimization

I am trying to solve a Nonlinear optimization problem with Mathematica. Since the maximization problem includes exponentiation with fractional power, the result generates the complex numbers that stop ...
109 views

Mixed integer programming with FindMinimum

As this works fine ...
152 views

How to sort Matrix

I am on permutation project, and I have trouble with my result, the sequence of my result is not same with Permutations in Mathematica here the code ...
107 views

Non-linear optimization giving error NMaximize::nrnum [closed]

I am trying to solve the following non-linear optimization problem: Here is my code: ...
42 views

FindMinium produces a worse point that the initially provided one [closed]

I am using FindMinimum to get a local minimum to a non-liner function of 50 variables on [0,1]^50 with some additional constraints. I provide FindMinumum with a feasible point which reaches a function ...