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

learn more… | top users | synonyms (4)

3
votes
1answer
287 views

Minimize sum of array elements subject to conditions

I have array where each point at different times are shown parameters ...
1
vote
1answer
230 views

Using the Levenberg - Marquardt algorithm to minimize a user-defined function

I wrote a function in Matlab that optimizes another user defined function using lsqnonlin with 'levenberg-marquardt' option. Now, I'd like to use the first to ...
0
votes
0answers
18 views
20
votes
2answers
437 views

Numerical optimal control

I was hoping to tackle optimal control using Mathematica in order to learn how I can use Mathematica's built in numerical integration and optimization functions together in order to solve an optimal ...
0
votes
0answers
42 views

Using ParametricPlot to Display result of Maximize

One would expect that: Plot[f[x],{x,0,1/2}] and ParametricPlot[{x,f[x]},{x,0,1/2}] would always yield identical outputs. ...
0
votes
1answer
99 views

How to Find minimum and maximum using `FindMaximum[]` and `FindMinimum[]`

this is the data that i use to plot. data_damped_osccilation this is my code so far, however it still give me error ...
0
votes
1answer
64 views

Maximize: specify the range of a parameter

I am trying to do symbolic maximization of a function, and would like to specify the range of a parameter of that function. I am able to set constraints of the variable I am maximizing over, but am ...
11
votes
1answer
181 views

Constrained optimization with three variables

A standard optimization problem in economics is choosing a consumption bundle subject to prices and a budget constraint: $$\max_{x,y} \sqrt{x} + \sqrt{y} \hspace{1cm} \text{s.t. } p_x \cdot x + p_y \...
1
vote
1answer
44 views

NMaximize/NArgMax complain about nonnumerical value (::nnum) when working with a region [duplicate]

Finding the mode of a SmoothKernelDistribution I am using a smooth kernel approximation to a mixture distribution to find the distribution's mode (e.g. by using ...
0
votes
1answer
50 views

Symbolic Maximization: does not work with symbolic power?

Simple question from a beginner: I seem to be unable to do maximization if the variable has a power specified symbolically instead of numerically? ...
2
votes
0answers
43 views

EvaluationMonitor vs. StepMonitor in Simulated Annealing

I am trying to track the evolution of NMinimize using the SimulatedAnnealing options. Simulated annealing has 3 parameters to track: 1) the latest trial point, 2) the latest accepted point, 3) the ...
0
votes
0answers
31 views

Optimizing NMinimization and NIntegration with a Nested List-Valued Function

I want to use NMinimize and NIntegrate on each element of a nested list-valued function. Here's a simple example of what I'm ...
1
vote
1answer
87 views

Problem with Finding Minimum of a Function Solved With NDSolve

I am trying to find the minimum of a particular function, which is solved using NDSolve. What is making it a little more complicated is that it is not the only function solved within the NDSolve and ...
0
votes
0answers
19 views

scaling parameters for vector-valued Non-linear optimization

I am trying to minimize a non-linear vector-valued function in Mathematica. As a test case, I try to minimize a function whose solution I know apriori. The problem is that one of the solutions is ...
58
votes
5answers
15k 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 ...
1
vote
0answers
55 views

Can Mathematica solve Kuhn-Tucker Equations with arbitrary functional form (up to 2nd order derivative)

I am in a business of solving a 5-variables optimization with inequality constraints, and I would like to maintain the functional form as arbitrary as possible. So far, I am assuming that the ...
0
votes
0answers
58 views

Strange sharp spikes causing overflow while doing gradient descent

I am trying to find a function h(r) that minimises a functional H(h) by gradient descent. The result of H(h) is a single number. (Basically, I have a field configuration in space and I am trying to ...
2
votes
0answers
71 views

To show optimization movement when using FindMinimum [closed]

The code is suppose to show the movement of optimization points from the first until the minimum point is found on the Contour Plot. However, the plot that I have is not showing the correct movement ...
2
votes
4answers
300 views

Problem in finding the numerical maximum

I need to find the numerical maxima of the function $$i(s)=\bigg[ \frac{\sin{50\pi (\cos s+1)}}{\sin{10\pi (\cos s+1)}} \bigg] ^2$$ Or in the mathematica input form: ...
0
votes
0answers
43 views

Finding minima of a function: Ways to speed up the code [duplicate]

I am quite new to Mathematica. I tried to calculate all minima of the function of interest as follows: ...
2
votes
1answer
35 views

Bounding parameters in optimization problems

The following outputs answers for a variety of cases for the parameters, a and b: ...
1
vote
2answers
164 views

Find the maximum Z in {(X + Y)==Z} using all the digits 0-9 only once

II want to add two integers with different digits to get a third integer with different digits. At the end, all 10 digits have to be different. So there should be 10 digits in total. How you ...
4
votes
1answer
91 views

Writing a function that finds the difference between two maxima

Suppose i have two functions: $\qquad -2x^2 +5x+3$ and $\qquad -5x^2 +2x+3$ To solve the point where the functions are at maximum i use the command NMaximize ...
0
votes
0answers
29 views

A bootstrap on the p-value of a simple linear model

My model: $y_t=\beta_1+\beta_2x_{2t}+\beta_3x_{3t}+u_t$, with $u_t\sim N(0,\sigma^2)$. My sample is of size 50. I'm trying to do a parametric bootstrap for the t-statistic of $\beta_3$, and I'm ...
1
vote
2answers
73 views

Minimization of a function with non-numeric parameters?

I have the following problem (in Mathematica) I want to calculate the following expressions: ...
16
votes
2answers
3k views

Find maximum value of interpolation function - obviously wrong result

Minimizing and maximizing interpolation function has already been asked and answered, see here for example. Yet, I observe a strange behaviour. Well, I can understand that the wrong guess of ...
2
votes
1answer
75 views

Plot a function after taking the supremum with respect to one variable

Assume given a continuous function $f$ with 2 variables, say $x$ and $y$. $x$ takes values on the interval $I$ and $y$ takes values on the interval $J$. I would like to know how to plot the function $...
0
votes
2answers
263 views

Maximizing a trigonometric function

This is probably a naive question, but here it goes: I know that $$r\cos a+s\cos b+t\cos c \leq \frac{rs}{2t}+\frac{rt}{2s}+\frac{ts}{2r},$$ subject to the conditions $a+b+c=\pi$ and $r,s,t$ are ...
2
votes
2answers
223 views

Maximize simple Polynom: Wrong answer

I want to maximize $poly$ under the constraints $g1,g2,g3=0$ ...
2
votes
1answer
75 views

ArgMax and result readability

Trying to maximize a two-variable expression and to get variables' values at maximum points: ...
0
votes
0answers
194 views

Maximum of NDSolve output. Problem with interpolating function

I solve a NonLinear PDE and get a solution (which for other reasons I put into a vector): SolVec1[1][[2]][x,t], where x and t are the indipendent variables. Now, I would like to get a distribution ...
4
votes
3answers
333 views

FindRoot constrained to maximum

I am using FindRoot to find the local maximum op some function, by examining where its derivative is zero. However, keeping the starting value the same, sometimes <...
2
votes
1answer
98 views

Results of ArgMax as a function of a parameter with InterpolatingFunctions

I would like to obtain a function and its derivatives, where the function is defined as the solution to a maximization problem. The obvious approach ...
10
votes
3answers
472 views

Maximize violating constraints

I have Maximize[{(h*10)/(300*(100 - (l^.5 + d^.4 + H^.6))), (l + d + H + h) == 669, l > 0, d > 0, H > 0, h > 0}, {h, l, d, H}] I believe ...
0
votes
3answers
308 views

Why does Maximize return a wrong answer?

I want to find the maximum of the following function, but get a wrong result. What am I doing wrong? ...
0
votes
0answers
54 views

Minimization with constraint define over a region

I would like to perform a 2D electrostatic minimization between two charged ellipsoids, provided that they should not penetrate each other; they can touch but they are hard ellipsoids. Here is what I ...
2
votes
1answer
60 views

Principal Axis Maximization

I know that, in order to use PrincipalAxis, for example in FindMaximum function: ...
2
votes
1answer
52 views

Trouble with some optimization

I am attempting to use Mathematica to solve an optimization problem related to mechanism design (4-bar). The optimization problem is basically the following: 1) Solve these two simultaneous loop ...
1
vote
1answer
77 views

Maximisation problem not working

I am trying to solve the following optimisation problem, but Mathematica is not providing me with a solution: $$\max_{x_{1},x_{2},e_{1},e_{2}}\theta_{1}\ln(x_{1})-e_{1} + \theta_{2}\ln(x_{2})-e_{2} \\...
0
votes
1answer
147 views

Solving linear system with constraints

I need to come up with a solution for a rather, odd situation. Let's say I have an $M \times N$ matrix called ${\bf A}$, and I would like to solve it for ${\bf x}$ where $b_1 \le {\bf A} {\bf x} \le ...
1
vote
0answers
62 views

NMinimize / adding constraints

I have a quick question: in question:Solving an ODE with boundary conditions at infinity and 0//different problems, I asked for help concerning a differential equation- however, the whole solving ...
2
votes
1answer
54 views

Does 'True' stand for 'Else' in Maximise function output?

Maximize[a x^2 + b x + c, x] gives this solution: Does the word 'True' stand for 'Else' here?
3
votes
2answers
154 views

Can't find maximum of a function on a region

for h=0.2 I'm trying to find the maximum value of (-h^2/3)*(-1/x^2) subject to ...
24
votes
1answer
745 views

How to work with Experimental`NumericalFunction?

This question is intimately connected with previous one: "How to create internally optimized expression for computing with high WorkingPrecision?" Oleksandr R. correctly states in the comment: A ...
2
votes
1answer
216 views

Error with FindMinimum. The Message is FindMinimum::cnpcons

I want to run a rather demanding check of feasibility. I have 3565 non-negativity constraints for my variables, and one that makes them sum to a certain budget they shall not surpass. I also have ...
0
votes
0answers
68 views

Kernel crashes during `LinearProgramming`. Can you reproduce it?

Using the code from this answer for a sufficiently large problem setting crashes my kernel. I'll copy/paste the code here: ...
1
vote
2answers
127 views

How to visualise (graphically) this optimization problem in Mathematica?

I have an optimization problem in the form max $(a-\bar{a})(b-\bar{b})$ subject to $a+b=1$ Here $\bar{a}$ and $\bar{b}$ are known values and both of them are >0. The solution is given by $a=(1+\...
9
votes
1answer
788 views

Max & min distance between two moving points

I am trying to find the minimal and maximum distance between two moving points with Mathematica in an interval. For example, ...
1
vote
1answer
68 views

Finding a vector many times

I have a vector matrix of profits say prof= {{1, 1, 1, 1, 1}, {2, 2, 2, 2, 2}, {3, 3, 3, 3, 3}, {4, 4, 4, 4, 4}, {5, 5, 5, 5, 5}}; I have a "terminal value ...