Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [mathematical-optimization]

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

0
votes
0answers
11 views

Here is a math game problem, not able to understand why the solution works? [migrated]

Players A and B Rules of the game: The game is played with two piles of matches. Initially, the first pile contains N matches and the second one contains M matches. The players alternate turns; A ...
0
votes
0answers
29 views

How to pass lists as arguments in NMinimize or FindMinimum?

The following code runs in Mathematica 12. But, I have two problems that I would like to solve: (1) How to pass a list as an argument to the function g in such a way that it can be used seamlessly ...
0
votes
0answers
33 views

Why do I get the following error? [on hold]

I am using LinearSolve function to obtain a set of solutions. When I run it outside of the For loop, it gives answers without any errors.
1
vote
1answer
70 views

An optimization problem over two variables

I have the function fun[x_,y_, t_] = Cos[x] + Exp[I y] Sin[x] Sin[t]; such that $0\le {\rm x}\le \pi$, $0\le {\rm y}\le 2\pi$, and $0\le {\rm t} \le 10$. I compute ...
-2
votes
1answer
26 views
0
votes
0answers
28 views

RegionPlot with FindMaximum

I don't understand why each time I'm launching this computation Mathematica buggs and I get a message from Windows that the Kernel stopped working... I'm trying to get a map of where the value of ...
2
votes
2answers
79 views

Finding extremes in discrete data by the fastest code

everybody! I'm new and that's my first post. I have such a problem: need to extract from a matrix (with dimensions n x 2) such points which have second coordinate smaller than -500 or higher than 500....
-1
votes
1answer
60 views

Mathematica code to solve these problems: [on hold]

1.Find the smallest integer number such that: 1+1/2+1/3+...+1/n>14 2.Find the smallest integer number n>1 such that: "SquareRoot" (1^2+2^2+...+n^2) is an integer number 3. Let {an} be a sequence ...
1
vote
0answers
59 views

How many distant points can be located in four-dimensional cube? [migrated]

Let $n$ distinct points in the four-dimensional cube $$\{ (x,y,z,t):0\le x, x\le 1,0\le y, y\le 1,0\le z, z\le 1,0\le t, t \le 1 \} $$ be such that all the distances between these points are (...
1
vote
1answer
31 views

Constraints When Using NMinimize

I want to put in constraints like z.x1 >=1, z.x2 >= 1 where z, x1, x2 are vectors, but I do not want to list them out. ...
0
votes
0answers
33 views

Plotting results of NMinimize with respect to a parameter

I have some predefined function F[x], where x can be a 2D vector. I am doing the following: ...
3
votes
1answer
83 views

Minimum path on a rectangular prism

First of all, this is a fun question that I have seen from here. We have a rectangular prism with dimension $30\times12\times12$ cubic inches. Assume that there is an ant at the blue point 1 inch ...
0
votes
2answers
52 views

Parametric Find Maximum

I'd like to plot the maximum of a curve in function of a parameter. Meaning I looking for maxima that depend on a parameter. Here is what I tried to do but FindMaximum is not parametric, so it did ...
1
vote
1answer
43 views

How to disable symbolic preprocessing in NMinimize without performance loss?

I want to find a global minimum of a function which is defined only numerically and cannot be evaluated with symbolic arguments. For example, this could be a minimum of a compiled function. ...
1
vote
1answer
63 views

3D-Plot optimization results for varying parameter values

Before starting, FYI: This is a question related to 3D Plot the result of local Minimize with varying parameter values Consider my objective function, $objF$: ...
0
votes
0answers
75 views

Kuhn-Tucker Conditions Take Forever

I am trying to solve a Kuhn-Tucker constrained maximization problem. The variables of interest are d1,d2,dr and i. The other symbols are parameters which I have several restrictions for. It's an ...
0
votes
1answer
46 views

Nminimize seems not work

I have to adjust a set of experimental data to a relatively complex nonlinear model. For this example I do a simulation of the data with a simplified function: ...
0
votes
0answers
24 views

`Minimize` not working for general case

I'm trying to perform a minimization for an arbitrary natural number. If I enter a specific number, Mathematica performs the correct minimization. Am I specifying k ...
0
votes
1answer
79 views

NMinimize or NMaximize for a dynamic problem

I am trying to solve a relatively simple quadratic discrete time dynamic problem using NMinimize. My code works for short time horizons (T<15) but for T longer, it ends up taking minutes and for T>=...
1
vote
3answers
61 views

Plot maximum value of a function of three variables

Given a function f[\[Theta]_, \[Phi]_, t_] given by ...
0
votes
0answers
48 views

What's wrong with my NMinimize code with the definite constraints?

I have a problem with my NMinimize code, the answer based on the paper is Mu1 = 8 and Mu2 = 19,34 that's the optimal Mu1 and Mu2. But my answer is Mu1 = 5,17 and Mu2 = 17,17. The paper said "adopt the ...
0
votes
0answers
36 views

Maximizing an integral/Solving the associated Euler-Lagrange equation

Case 1 I have the following integral which I need to numerically maximize. Here $v = v(u)$. $$V = \int_{u_l}^{u_r} du\sqrt{\frac{4}{(1+uv)^2} \frac{(1-uv)^2}{(1+uv)^2}\frac{dv}{du}} $$ The ...
0
votes
2answers
33 views
0
votes
0answers
34 views

NMaximize with a variable ranging over permutations

I have an optimization problem where there are $n$ activities and I want to find an optimal schedule of those activities. The schedule is specified as $S=(\mathbf{t},p)$ where: $\mathbf{t}=\left(t_{...
2
votes
1answer
32 views

Using Maximize with LABColor

I'm writing a function that, given a color, returns a contrasting color. It does this by maximizing the ColorDistance between the input and output colors. However,...
5
votes
0answers
71 views

Caveats of LinearProgramming on Integers domain

When using LinearProgramming with the Integers domain, Mathematica issues the following warning: ...
0
votes
1answer
27 views

The parameters returned by NMinimize don't correspond to the minimum returned

I'm trying to use NMinimize to solve a puzzle. Some of the code is below... ...
0
votes
1answer
81 views

Problems Minimizing a Function

I need to minimize a function, but it takes a long time. So I don't know if it's normal or if there's something wrong with my model. ...
0
votes
1answer
38 views

`Maximize` does not return any result, but simply reproduce the code

I'm working with Maximize and it does not generate any result but simply reproduces the same code. My object function is rather complex which is: $0.18 k-0.36 + \...
0
votes
0answers
23 views

Find a reduce math function with increase param value [migrated]

I have a d value which is a range from 0->5. I want to build a math function with d param so that return a value from 0 to 1. if d increase, function decrease faster. Example f (d = 0) = 1, f (d = 1) =...
1
vote
1answer
26 views

Mapping the FindMinimum function over a matrix

I'm quite new to Mathematica and so still trying to work out how to use some of its syntax and functions. I have a function for the free energy of a generic system with two order parameters. I am then ...
-1
votes
1answer
39 views

GlobalSearch function

its seems I cannot run global optimization functions (GlobalSearch,GlobalPenaltyFn); The output is just a reproduction of input In[] = GlobalSearch[(x - 1.3)^2 + (y - 1.5)^2, {-x + 1, -y + 1}, {x -...
1
vote
0answers
26 views

Finding the positions of minima for a function with algebraic constants

I have a function of several variables: inverse[Qx_, Qy_]:= T - 2 J + 4 J1 Cos[(Qx + Qy)/2 a] Cos[(Qx - Qy)/2 a] - 2 J2 Cos[(Qx - Qy) a] + 2 J3 Cos[(Qx + Qy) a] ...
0
votes
1answer
45 views

Method for constrained NonlinearModelFit with NDSolve

I'm trying to fit some data with a system of differential equations : ...
0
votes
0answers
60 views

Clebsch Gordan coefficients

I'm trying to compute various sums which contain some CG coefficients, where the sum runs over the indexes m1,m2,m corresponding to each of the three angular momenta j1,j2,j. The thing is that when I ...
0
votes
1answer
79 views

Problem with solve

I need to solve this function, but I cannot copy mathematical function, so I display in picture, sorry ...
1
vote
0answers
65 views

Memory leak in simple program

I am trying to solve a simple optimization problem on the sphere, and for some reason, I got some memory leak that I am not able to solve. To decompose the problem in step, what I wan to do is Take ...
2
votes
0answers
46 views

How do I use NMinimize to solve equations obtained using NIntegrate? [duplicate]

I wish to minimize following equation with respect to variables $h,p,q,t$: $\qquad f(h,p,q,t)=\int_0^1 \int_0^1 \frac{dx\,dy}{\sqrt{h^2+x^2+y^2-2\,x\,y\space cos(p)+2\,h\,y\,cos(q)-2\,h\,x\,cos(t)}}$....
0
votes
1answer
91 views

What is wrong with my NMinimize code? [closed]

I don't know how to write the code to find Mu1 and Mu2. Can you help me Please?. This is what I tried.
0
votes
2answers
37 views

Unable to find maximum value of my custom function

myfunn[x_, y_] := Module[{}, If[x < 5, Return[0]]; If[x < 10, Return[2]]; x*y]; I'm unable to find the maximum value of this function over the ...
0
votes
4answers
128 views

How can I solve this transcendental equation in Mathematica?

I want to solve the following equation $\frac{Sin[a[x]]}{a[x]}$ - x = 0, for x in range {0,1}. I tried the FindRoot method but it gives only one root. I want to find the roots for this equation for ...
0
votes
2answers
67 views

How to find maximum from list or table

I have some result in list form and after I build the graph I have: As you can see on the graph there is a spurious peak at the beginning. So when I tried to find maximum peak, I receive value of ...
1
vote
1answer
65 views

How do I separate all local maxima and local minima of my function?

This question (and the first answer in particular), teaches us how to find all the local maxima and minima of a function. My question is: how can I separate the maxima from the minima? My goal is to ...
1
vote
0answers
39 views

Finding symbolic solution to constrained optimization question

The code below is my attempt to solve a constrained optimization problem: ...
0
votes
2answers
140 views

How to find this global minimum?

This is a problem from a Russian school math olympiad: Minimize[(5 x^2 + 8 x*y + 5 y^2 - 14 x - 10 y + 30)/(4 - x^2 - 10 x*y - 25 y^2)^(7/2), {x, y}] The above ...
12
votes
1answer
263 views

Packing arbitrary shapes

I'm looking for a general method of packing any set of 2D glyphs. For example, say I had 30 randomly transformed english characters: ...
3
votes
1answer
43 views
-2
votes
1answer
75 views

Optimization problem [closed]

I have the following function ...
-1
votes
2answers
136 views

Solving inequality using matrix form condition

*answer is $x=(10,5)^T$ (a,b) is inner product. x and y is 2d vector. Find $\bar{x}$ within the area by the systems of inequality,$K(x)$ s.t. About inner product of vector F(x) and (y-x),$F(\...
1
vote
2answers
60 views

Numerical Minimization of Large Expression

I want to minimize a function which contains ArcTan functions. The function is also very complicated. I have the following code. ...