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

learn more… | top users | synonyms (4)

1
vote
1answer
40 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
47 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
35 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
26 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
83 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 ...
20
votes
2answers
391 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 ...
1
vote
0answers
50 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
55 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
70 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 ...
11
votes
1answer
176 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 ...
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
34 views

Bounding parameters in optimization problems

The following outputs answers for a variety of cases for the parameters, a and b: ...
4
votes
1answer
89 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
28 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
69 views

Minimization of a function with non-numeric parameters?

I have the following problem (in Mathematica) I want to calculate the following expressions: ...
2
votes
1answer
70 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
0answers
34 views
0
votes
0answers
50 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
52 views

Principal Axis Maximization

I know that, in order to use PrincipalAxis, for example in FindMaximum function: ...
2
votes
1answer
50 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
76 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} ...
1
vote
0answers
58 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 ...
0
votes
1answer
127 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 ...
2
votes
1answer
51 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?
9
votes
0answers
95 views

LinearProgramming returns an invalid null solution that apparently doesn't satisfy constraints without any warning

Bug introduced in 10.3.1 or earlier and persisting through 10.4.1 While searching to answer the question Solving the magic backyard puzzle with MMA at some time I composed a set of arguments ...
3
votes
2answers
145 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 ...
1
vote
2answers
126 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 ...
9
votes
1answer
762 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, ...
0
votes
0answers
66 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
1answer
63 views

Efficient maximisation of log-likelihood

I would like to efficiently find the maximum $(\sigma,\lambda)$ for the log-likelihood of the derived distribution below. I only need $\sigma$ and $\lambda$ to one decimal place - so not very precise. ...
0
votes
0answers
23 views

Casting an optimization problem into least-squares form for Levenberg-Marquardt [duplicate]

I would like to use the function FindMinimum[] with the Method LevenbergMarquardt to this function: ...
2
votes
1answer
214 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 ...
1
vote
1answer
220 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 ...
1
vote
1answer
115 views

Invalid computation of maxima

I am finding the following minimum FindMinimum[{ Abs[ ArgMax[f[q, n, b, b0, b1, t, s], b] - b1 ] }, {b1, -0.5}] given ...
7
votes
1answer
213 views

Risk-return trade-off — solving a convex optimzation

I try to convert a convex optimisation (cvxopt) example to the Wolfram Language from python. Source of the python code: Risk-return trade-off Please advise me on how to convert the following python ...
2
votes
1answer
46 views

How to couple NIntegrate with FindMinValue

I have a problem with a correct transfer of values of parameters when NIntegrate (and some subsequent functions) are coupled with minimizing procedures in ...
1
vote
1answer
114 views

How to Minimize an NIntegral

My problem is to minimize in Mathematica a numerical integral. The command FindMinimum[With[{R=2.5},NIntegrate[(R*r1*a)*Sin[r1*a],{r1,1,R}]],a] does calculate ...
1
vote
0answers
79 views

Possible memory leak in FindMinimum? (MMA v10.0)

So I was running some code when I noticed Mathematica was gulping memory, and after some debugging I think the culprit is found. It turned out the function ...
1
vote
1answer
70 views

How do I write a function inside a ArgMin

I want to solve this ArgMin[NIntegrate[(Tanh[x] - Erf[x/a])^2, {x, -5, 5}], a] and it does not work, what is the correct way to do this? ...
1
vote
1answer
66 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 ...
6
votes
0answers
94 views

Customized StepSize control in unconstrained gradient-descent optimization

I have a type of minimization problem I frequently solve that involves warping a large 2D triangle-mesh (~25,000 vertices) to fit a model. In the mesh, vertices carry the empirical measurements (each ...
3
votes
0answers
94 views

Classification problem using SVM methods

I am running SVM on mathematica and I a used this code with classes: ...
4
votes
1answer
171 views

Goal optimization: finding the best combination of capacitors and resistors resulting in given properties

I want to edit @MarcoB answers (because the code he gave doesn't answer the question appropriately)->(the function that need to be optimised is not implemented as asked) But it seems like I am having ...
1
vote
1answer
94 views

Optimizing best fit circle to given data set [duplicate]

Given a set of data, I have plotted a slowness curve for a p-wave resulting from the given data. A slowness curve is just the reciprocal of the velocity of the p-wave. What I need to do is find a ...
0
votes
1answer
57 views

Basic question about loops in mathematica

I am very new to Mathematica programming and am trying to find the optimum of a numerical integral for various values of a parameter. Here is the basic code for one parameter value that runs fine - I ...
24
votes
3answers
835 views

Exponential fitting - isn't actually a BUG there?

There are many questions on this site about wrong exponential fitting in Mathematica but no one considers this well-known problem as a potential bug. Usually people suggest well-known workarounds ...
2
votes
1answer
127 views

How to transform the output of Minimize/Maximize into a function

I want to create a function directly from the output of Maximize. Specifically, I have the following function $f(l,h,d,a)$ that I want to maximize with respect to ...