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
2 votes
1 answer
87 views

Given square matrices A and B, how to solve T obeys Transpose[T]. A . T = B?

Dear Mathematica experts, Given two square matrices, A and B, how do we use Mathematica to solve a matrix T such that T satisfies this matrix equation? (Here we have A,B,T $\in$ general linear matrix ...
4 votes
3 answers
246 views

How to find the nearest element that is bigger than x?

Consider some list list=RandomReal[{0,1},10^6]; I would like to find the closest element to some value of x that is larger than it, and also extract its position. ...
2 votes
1 answer
120 views

Wolfram Engine 13.3.0 dies, is this a bug?

$ wolframscript Wolfram Language 13.3.0 Engine for Linux x86 (64-bit) Copyright 1988-2023 Wolfram Research, Inc. ...
1 vote
1 answer
62 views

Is a four-variable function less than one?

I have the following function of four variables f=Sqrt[(1 + w - x + 4 y z) - Sqrt[4 (-w + x) + (1 + w - x + 4 y z)^2]]/Sqrt[2] I want to show that $f(w,x,y,z)<1$...
2 votes
0 answers
62 views

Gurobi optimizer license error

How do I set up Mathematica to use the commercial Gurobi optimizer? Mathematica should be able to use it, as the Method -> "Gurobi" option exists for ...
0 votes
0 answers
54 views

Understanding syntax of `FindArgMin`

In this post Can Mathematica solve Plateau's problem (finding a minimal surface with specified boundary)? (8 years ago) I found a call to FindArgMin which is ...
0 votes
0 answers
32 views

Use Fitting Parameter from Solve or Nminimize with LinearModelFit

Im Trying to minimize a function by varying parameter "a" with Solve or Nminimize. The Problem is that "a" is dependent on my parameter "R" which is dependent on "a&...
2 votes
0 answers
35 views

FindMinimum(vectorized): Stepmonitor doesn't work

In the documentation I found this simple example which evaluates as expected: ...
3 votes
1 answer
296 views

In NMinimize, how to incorporate constraints on positive semidefiniteness of a matrix which is not the matrix variable being optimised?

The problem I want to solve the following problem for symmetric matrix $X$: $$ \begin{aligned} \min_{X\succ 0} \; & -\log(\det(X)) & \\ \text{subject to} \; & \begin{pmatrix} X &...
1 vote
2 answers
130 views

Chi-square minimization error

I'm trying to fit some data into a model using the standard procedure of minimizing the chi-square function using this code: ...
4 votes
2 answers
243 views

Optimizing an ODE fitting algorithm with interpolated data

Given data, I want to find parameters $p_1,p_2,k_1,k_2>0$ that fit the following ODE system $$ \begin{align} b'(t)&=p_1 a(t)-k_1b(t)\\ c'(t)&=p_2b(t)-k_2c(t) \end{align} $$ where $a(t)$ is ...
0 votes
0 answers
29 views

Create Constraints Iteratively for NMaximize [closed]

new to Mathematica so sorry for the silly question Trying to crete a list of constraints in Mathematica without typing manually as ...
0 votes
1 answer
42 views

'The objective function is not a scalar' in NMinimize

I am trying to do a GMM(Generalized Method of Moments) by NMinimize, it comes up with the warning 'The objective function is not a scalar', here's what I have tried:...
9 votes
1 answer
976 views

Pareto optimal fronts using internal function?

Reading this question: How do I estimate the Pareto front in my multiobjective optimization problem? I found @Daniel Lichtbau's interesting answer. Yet I don't know how such an "internal function" ...
2 votes
1 answer
244 views

Memory problem for maximizing a multivariable function

I need to maximize the following function. Unfortunately I have to maximize without using numerical methods to prove that the maximal value is 3Sqrt(2Sqrt(3)-3) (about 2.04375). I tried it twice (once ...
0 votes
0 answers
78 views

Output a 24 by 24 Leech lattice

Input a rank-8 $E_8$ lattice, $$ M_{E_8}=\begin{pmatrix} 2 & -1 & 0 & 0 & 0 & 0 & 0 & 0 \\ -1 & 2 & -1& 0 & 0 & 0 & 0 & 0 \\ 0 &...
0 votes
1 answer
85 views

ArgMax returns the input

I am new to Mathematica so I don't know if I am missing something. I am trying to use ArgMax for a specific function I have, which includes ...
2 votes
2 answers
563 views

Why hasn't the minimum value of a+b been determined?

Why hasn't the minimum value of a+b been determined? Minimize[{a + b, 9 == 9^(1/a) 3^(4/b), a b > 0}, {a, b}] Find the minimum value of a+b. The limiting ...
-1 votes
1 answer
121 views

Modifying `FindMinimum` to work for noisy functions?

I have an eigenvalue problem where I'm minimizing a function which is a bit noisy. FindMinimum seems to fail to work in this setting, can anyone see an alternative ...
2 votes
2 answers
124 views

How to speed up optimization?

Finding a quadratic polynomial of the best approximation in $L$-metrics to $\sin(x)$ on $[0,5]$, I execute ...
0 votes
0 answers
50 views

How to find the minimum value of multiple function in the chi-square distribution?

I got a multiple function in the following way: ...
0 votes
0 answers
59 views

How to speed up maximization of the Solve output?

I am trying to maximize the solution of the system of algebraic equations for different values of parameters. The problem is related to the absorbing times in Markov chains. Here is the code ...
1 vote
2 answers
118 views

Could a minimization problem be easily converted into a NonlinearModelFit?

I am trying to fit data that is correlated, such that the $\chi^2 = (f(x_i,pars)-y_i)(Cov^{-1})_{ij}(f(x_j,pars)-y_j)$. However, NonlinearModelFit only accepts ...
1 vote
1 answer
62 views

Find an instance satisfying equation

I have the following equation with two variables xi and nu. ...
0 votes
0 answers
26 views

NMaximize simple function

I am trying to solve a maximisation using Mathematica. The objective function, though involved, can be broken down into many simpler terms. One of these terms is ...
0 votes
1 answer
60 views

Normalizing a plot by introducing a variable

I am trying to plot the graph between P and x. My teacher wants me to normalize this graph by introducing a constant $k$ to get $P/k^2$ on the y-axis and $xk$ on the x-axis. I did that by doing a ...
0 votes
0 answers
36 views

NonlinearModelFit with NMinimize Submethods and Selective or Mixed-Head Constraints

Problem: I believe I've found a two related bugs associated with using NonlinearModelFit while making a Method call to NMinimize's submethods, e.g. "RandomSearch" and "...
0 votes
2 answers
78 views

Finding the maximum of a function [closed]

I can’t find the maximum of the function, although the graph shows that it exists. Maximaze and FindMaximum give different results. However, these results do not coincide with the graph. ...
0 votes
1 answer
168 views

Can I use WolframScript to solve this system of equations?

I have these three equations: ...
19 votes
1 answer
2k views

Efficiently Mowing Grass with Mathematica

Recently, I was mowing my yard and was thinking about how to use the least amount of time/fuel and how to simulate. Mowing a yard that is shaped as a convex polygon is not difficult, you can just make ...
1 vote
3 answers
118 views

Find the point with the largest slope change

I have a list of x-y data: ...
1 vote
1 answer
79 views

Minimization of an implicitly specified function

exp - an experimental data, where expT - temperature, expChi - magnetic susceptibility I ...
2 votes
0 answers
144 views

Numerical Galerkin method with parametrized interpolation function

modified Here I try to realize a numerical fit (Galerkin method) using parametrized Interpolation function to fit examplary Exp[x] in a given grid. So far I tried <...
0 votes
0 answers
43 views

FindMinimum with many Sums and NIntegrates is very slow

I want to calculate the global minimum of an equation which has several hundred Sums (I used 300 in this code), but the calculation is very slow. My code is as ...
1 vote
1 answer
83 views

How to calculate maximum between two or more lists element by element and also the index corresponding to the maximum element?

I am looking for a function say f such that for example f[{a1,b1,c1},{a2,b2,c2}] will give {Max[a1,a2],Max[b1,b2],Max[c1,c2]} and also a function g say such that g[{{a1, a2, a3}, {b1, b2, b3}},{{c1, ...
4 votes
3 answers
164 views

Problem with FindGeometricTransform and NMinimize

I'm interested in Centroidal Voronoi tessellation. Here are two examples of unit disk tessellations: They are the same with respect to rotation. Recently, I've found ...
0 votes
0 answers
97 views

How to optimize the sum of squared values?

How can we optimize the sum of squared values (or the sum of multiple absolute values)? I found that using ArgMin is very slow. Are there any other methods to accelerate the solution? Edit:I am ...
1 vote
1 answer
85 views

Nearest inside Minimize

How to use Nearest inside Minimize? The following returns errors but if # - {a, b} is ...
1 vote
2 answers
253 views

How to interpolate an implicit function?

chi(t) is implicit function. The implicit function can be plotted by ContourPlot. Is it possible to obtain chi(t) explicitly using function interpolation? ...
0 votes
0 answers
91 views

Why doesn't NMinimize work with NSolve?

Why does NMinimize throw the error and how to fix it? ...
2 votes
2 answers
255 views

Packing unequal spheres into minimal cuboid

There are several non-overlapping spheres in 3D. How to find a cuboid Cuboid[{a,b,c}] containing these spheres with minimal ...
2 votes
3 answers
281 views

How to solve this equation over the integers with Mathematica?

I try to solve with Mathematica 13.3.1 on Windows 10 the problem $$x^2+2^{x^2+1990}-y^2=2^{y^2+y}+y-1990\land x+y>1990,\, x\in \mathbb{Z},\,y\in \mathbb{Z}$$ which originates from Bauman Moscow ...
2 votes
4 answers
114 views

Problem with Min and Max [closed]

s=min{max{0,a}, max{0,b}, 1/(1-a) max{0,1-a}} is there any alternative way to make this more concise without condition and in one expression. Condition is -infty<a<infty and -infty<b<1
1 vote
2 answers
135 views

How to calculate the depth of the lake in mathematica?

I want to calculate mean depth of Goose lake (mean depth=4.6 m), I use bellow command for this operation, But this command is not automatic and we have to create the coordinates manually, and on the ...
0 votes
2 answers
101 views

Why can't NSolve find values that FindInstance can?

I am trying to solve for \[Epsilon], given three input paramters n, x and ...
0 votes
2 answers
190 views

Finding a fixed point of function without a closed-form solution

I am trying to find a fixed point of a function that does not have a closed-form solution (it is the solution to a NMaximize problem). The following simplified problem, which would have an easy ...
1 vote
1 answer
57 views

`FindMinimum` can't evaluate `Nearest` numerically

I'm trying to use Nearest as a function to minimize over: a toy example is ...
3 votes
0 answers
121 views

How to estimate Lake area and volume in Mathematica?

I have a satellite image of the lake and I want to estimate its area and volume. Actual volume:1.49*10e8 m^3 Actual Area:36.9 km^2 I did the following command to find the volume, but it is not very ...
0 votes
1 answer
54 views

NMinimze cant find points that satisfy constraints

NMinimize cant find solutions for a function which clearly has one. Setting a working precision resulted in some output, however with error messages about tolerance and precision. Heres my code. The ...
1 vote
1 answer
80 views

Finding element selected in NMaximize[{Min[...], constraints},{vars}]

How can I determine which element of Min[] is being selected in a NMaximize[{Min[...], constraints},{vars}] problem? For example,...

1
2 3 4 5
44