Questions tagged [mathematical-optimization]
Questions on the optimization functions of Mathematica such as FindMinimum/FindMaximum, Minimize/Maximize, NMinimize/NMaximize, etc.
2,160
questions
0
votes
1
answer
30
views
Trouble with Finding a Supremum Constrained by a Condition
I have a function
$$
f(x,y) = \sqrt{\left(x^4 y+\frac{2 x^2 y^2}{x^2 y^2+1}+\frac{2}{x^2 y^2+1}-41 x^2 y-7 x^2\right)^2+\left(-7 x^3 y-x^3-\frac{2 x y}{x^2 y^2+1}-\frac{2 x^3 y^3}{x^2 y^2+1}+41 x\...
6
votes
1
answer
181
views
Given square matrices A and B, how to solve T obeys Transpose[T]. A . T = B? [duplicate]
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 ...
5
votes
3
answers
380
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
122
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
63
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
33
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:
...
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:
...
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:...
4
votes
2
answers
244
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
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 &...
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.
...
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
<...
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
1
answer
79
views
Minimization of an implicitly specified function
exp - an experimental data, where expT - temperature, expChi - magnetic susceptibility
I ...
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, ...
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 ...
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 ...
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
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
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 ...
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 ...
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
57
views
`FindMinimum` can't evaluate `Nearest` numerically
I'm trying to use Nearest as a function to minimize over: a toy example is
...
0
votes
2
answers
192
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 ...
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
0
answers
59
views
How to extract shape from image in the Mathematica?
I have some satellite images for the lakes. How to extract the shape of the lake with maximum accuracy from the image?
0
votes
1
answer
37
views
I am trying to plot the function below, however, it does not seem to be working [closed]
Do you know what I am doing wrong? The image I put below shows the function I would like to plot.
3
votes
1
answer
94
views
Using GraphicsGrid for density plots with color scales
I would like to arrange the density plots in a certain order using GraphicsGrid. But when using GraphicsGrid, there is problem with the color scale, it doesn't display completely. How should ...
1
vote
1
answer
77
views
What are some ways to speed up calculations
Below is the code for calculating the eigenfunctions and eigenvalues of the following system:
$HC[u(\rho,z)]=-\frac{1}{2}\Delta u(\rho,z)-\frac{1}{\sqrt{\rho^2+z^2}}u(\rho,z)+\frac{B^2}{8}\rho^2 u(\...
1
vote
2
answers
253
views
How to find a densest configuration of several non-overlapping unit disks? [closed]
Let us consider three non-overlapping unit disks in the plane. I'd like to find
a configuration of these disks s.t. the area of the convex hull of these disks is smallest.
This is related to the ...
2
votes
1
answer
58
views
Plot several graphs of a function density distribution using Table
I would like to plot the density distribution graphs of the eigenfunction en[B][[2, 1]] when a parameter B is changed.
But the ...
0
votes
0
answers
54
views
ODE of HJB function
I want to solve the following ODE where W is a function of x. Any suggestion? Thank you!
...