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
0 votes
0 answers
28 views

Evaluation stops without output or error when using Nested Maximize

I am trying to evaluate a max max min problem. The code is as follows: ...
2 votes
1 answer
50 views

LinearOptimization thinks 0-1 ILP is an MLP

I try to solve this 0-1 integer linear program (maximize, thus the minus) with LinearOptimization: ...
  • 23
1 vote
2 answers
69 views

Finding minimum of a symbolic function [closed]

Why does Mathematica fails to find the minima of the two variable function with real coefficients. The function and my attempt is given below. Input: ...
  • 157
1 vote
2 answers
90 views

NMinimize keeps returning Indeterminate for well defined function

I am attempting to numerically optimize a function of only 2 parameters k, \[Theta]. The function is well-defined and the constraints are simple. However, the ...
  • 925
0 votes
1 answer
42 views

Fitting parameter to match a dataset to another dataset

I am using a Module which calculates 3D-data based on 5 parameters and another input dataset. I'd like to fit the result of this modul to another set of data. Since my code became very long I will ...
-1 votes
2 answers
202 views

Why is the plot of low quality produced?

Stydying the modulus of continuity of $\sqrt x \log(x)$ in version 13.1 on Windows 10, I execute ...
  • 19.6k
0 votes
1 answer
48 views

Maximize and NMaximize in comparison

If on one hand: N@Maximize[{Sqrt[y^2 - x^2], x + y^2 == 0 && 0 < y < 2 && -y < x < y}, {x, y}] {0.5, {x -> -0.5, y -> 0.707107}} ...
  • 4,385
2 votes
2 answers
262 views

How to solve this optimization problem?

Is there an effective method to solve the following optimization problem in Mathematica? \begin{align*} \min & \quad -t \\ \mathrm{s.t.} &\quad A \succeq 0,\,a=1 \end{align*} I mean A is ...
  • 171
0 votes
1 answer
55 views

Maximizing a stochastic function with Convolution distribution

I have a stochastic profit function where I want to maximize with respect to a variable "a". I have written the code like this ...
1 vote
2 answers
28 views

Saving results of Do Loop in .csv

I am very inexperienced with Mathematica and I am short of time so I need to move the results on py/r to plot and analyze I have done an optimization with NMaximize of this type: ...
1 vote
1 answer
54 views

Can Minimize get multiple minima producing the same objective value?

Minimize[(x-1)^2(x-2)^2,x] gives only the solution 1, and not 2 (the help does not seem to mention this issue) In general, if I do not know how many minimizers I ...
  • 1,250
2 votes
1 answer
134 views

Incorrect result of Maximize

Maximize is a well done command of Mathematica. However, there are spots on the Sun too. Trying in version 13.1 on Windows 10 ...
  • 19.6k
0 votes
0 answers
26 views

TimeConstrained[] Not working

Is there a way to force the kernel to quit if some code runs for x seconds? Currently, I have: ...
0 votes
2 answers
66 views

how i put condition to sure that values of outputs in FindRoot?

i want to put condition in this like x>0,0<y<1 FindRoot[{Exp[x - 2] == y, y^2 == x,x > 0 && 0 < y < 1}, {{x, 1}, {y, 1}}] but it dosen't ...
  • 359
1 vote
1 answer
51 views

Construction of many logical sentences

Consider the set: c1 = {h1, h2, h3, h4, h5, h6, s1, s2, s3, s4, s5, s6}; How to build a list of all possible logical sentences based on the set 'c1' and logical ...
  • 1,009
7 votes
4 answers
162 views

Finding least upper bound line above a set of points using NMinimize

I have this set of points: ...
  • 1,545
0 votes
1 answer
66 views

Problem with NMinimize and NonlinearModelFit

I have data points of some experiment and system of ODE, that approximate this data. ...
0 votes
0 answers
48 views

NonLinearModelFit Usage Help

I am using FindFit to fit a piecewise linear interpolant (vs. x) to data (vs. t) using a convolution. The FindFit portion of my notebook is attached below. The fit appears to be reasonable despite ...
3 votes
0 answers
127 views

Can Mathematica's Minimize() function be called inside Python code using Python data?

Summary: I would like to use the Wolfram Client Library for Python to invoke Mathematica's Minimize function directly from within Python, passing to it Python data structures. Details: I have a Python ...
2 votes
1 answer
68 views

How to calculate the distance in a specified direction of a point from a (complex) BooleanRegion?

As an example (but the size of the rectangles and the position of the point are within predetermined random ranges): ...
0 votes
1 answer
53 views

Plot an integral with different parameters

I got an issue of plotting an integral with different parameters 'j',such as 'j' is from 0.1 to 0.9 , I want the final graph to include all the j constants and to be labeled too. ...
  • 31
0 votes
0 answers
27 views

Mathematica 11.2 freezes when initializing kernel connections

I am having this problem (Mathematica freezes when initializing kernel connection) since about one week: I found the link Mathematica 10.0.x freezes in Initializing kernels followed the instructions ...
3 votes
1 answer
95 views

Minimising an expression in the form of an integral

Consider a quadratic $f(x)=ax^2+bx+c$ with unknown .What values of $a,b,c$ will minimise the integral $$ \int_0^1(f(x)-\frac{1}{1+x})^2?$$ How do I write in Mathematatica?Can Mathematica solve it ...
1 vote
1 answer
103 views

Minimize output interpretation [closed]

...
6 votes
4 answers
294 views

How to simplify expression through variable substitution [closed]

I am trying to simplify a complicated expression through variable substitution and part of the expression looks like: $2A_1^2+A_1B_2+2B_1^2-B_1A_2+2C_1^2+C_1D_2+2D_1^2-D_1C_2$ I want to substitute $...
  • 63
0 votes
0 answers
28 views

Set the MPC tracker arguments

I have an affine system $\dot x(t)=X(x(t))+u(t) Y(x(t))$ with one input $u$ and two outputs (corresponding to the state $x=(x_1,x_2)$ of the system) and I would like to start from ...
  • 496
1 vote
1 answer
97 views

NMaximize with constraints vs. explicit Lagrange multiplier method [closed]

Could you explain the reason why these two outputs are different? ...
0 votes
0 answers
31 views

Export Semidefinite Program To MOSEK readible file

Mathematica supports using the MOSEK solver for semidefinite programs now. I have some code that generates the conditions for some SDP problem, which I want to solve using MOSEK. Problem is that it ...
1 vote
2 answers
75 views

Minimizing 1D convex function without derivatives?

I have a function which is nicely behaved, but expensive to compute. What's the fastest way to get 2-3 digits of accuracy? Using NMinimize is much slower calling <...
0 votes
0 answers
41 views

Determining the number of steps it takes to reach the minimum of a function starting at some initial point

I think I understand the idea. I have my function, the global minimum of that function, the point I am going to start at, and the step size. Here is my code below: ...
4 votes
2 answers
191 views

Mathematica can't find Minimum sum under integer constrains

I'm trying to verify a solution to a simple probability problem using Mathematica. Here's the problem: A drawer contains red socks and black socks. When two socks are drawn at random, the probability ...
1 vote
1 answer
69 views

Optimisation involving an extra variable

Mathematica is happy performing the following optimization: Minimize[{x - Log[x], x > 0}, x] (* {1, {x -> 1}} *) and also this one involving an extra ...
1 vote
0 answers
31 views

Thermodynamic Optimization: how can I optimize with an objective function containing ThermodynamicData[]?

In thermodynamics, there are a lot of optimization problems where the objective function containing thermodynamic property values, like "Enthalpy","Entropy", which is determined by ...
  • 453
3 votes
2 answers
117 views

Interior point method for unconstrained problems

I was recently working on applying the FindMinimum function to $f(x)=(x+1)(x-1)$, and chose the interior point method as the 'method', which yielded $x=0$. I would like to better understand how the ...
0 votes
0 answers
50 views

Finding values of constants for which 1st and 2nd order derivatives of a function vanish

I'm trying to find critical values of some constants $v_c$ and $T_c$, for which holds the equality below: $$\bigg(\frac{\partial P}{\partial v}\bigg)\biggr\rvert_{v=v_c,\; T=T_c}=0,\quad \bigg(\frac{\...
  • 27
7 votes
3 answers
333 views

How to write a condition for FindMinimum correctly

I would like that, when finding the minimum, the FindMinimum analyzes the variables (x and y) each time and finds q, depending on the current values of x and y. Can I somehow write this condition into ...
  • 263
5 votes
2 answers
123 views

Find Minimal covering sets for $n\times n\times n$ grid (covering means each grid point has a axis line in common with set)

Let $G_n$ be a $n\times n\times n$ lattice, so $G_n=$Join@@Join@@Array[{##}&,{10,10,10}]. Given a set of lattice points $U$, we say it 'covers' another set $V$ ...
  • 3,099
2 votes
1 answer
77 views

Faster minimization of $$\|I-x A B - x B A + x^2 A B A\|^2_F$$

Are there any tricks I can use to speed up minimization of the function below for positive definite matrices $A,B$ and scalar $x$? $$f(x)=\|I-x A B - x B A + x^2 A B A\|^2_F$$ This is a bottleneck in ...
0 votes
1 answer
36 views

Why does NMaximize show errors for the same code FindMaximum gives solution? The errors need not corresond to local vs. global solution aspect

...
-3 votes
1 answer
45 views

Maximum number of routings for n points [closed]

I'm trying to formulate an equation to calculate the maximum number of routings possible for a given amount of points, with the following rules or restrictions: A route must contain atleast one point ...
1 vote
2 answers
167 views

How to find the equation of a curve which is not symmetric [closed]

I need to find the equation of f1(x) by these three points (5,4) (2,5 , 0) (0, 1,5). I think it is not a standart symetric parabola.
4 votes
0 answers
170 views

Integer optimization problem with very many constraints

Let us consider an integer three-dimensional cube $\{0,1,\dots,100\}^3$. A point $P$ with nonnegative integer coordinates is said to be a radar point if all the distances (its number equals $101^3$) ...
  • 19.6k
3 votes
2 answers
97 views

How to change the manipulation of the point Q to a Locator?

I want to control the point Q by a Locator not with Slider, how to make this work? ...
  • 329
0 votes
1 answer
45 views

find maximum don't work with me i don' know why? [closed]

i have log function like this and i want to find maximum for it the log function like this ...
  • 359
0 votes
1 answer
70 views

How do we extract exact constraint function values from `FindMinimum`?

When we use optimization command such as e.g. FindMinimum, we minimize a function subject to the given constraints and seek to find the optimal solution where these constraints are satisfied. Now I ...
3 votes
0 answers
35 views

General hyperparameter searching?

I typically use naive random or grid search to choose them, but I'd like to ask if there are built-in or paclet-based methods that can help perform more principled general hyperparameter searches? For ...
  • 3,583
-5 votes
1 answer
125 views

How to plot two BVPs in Mathematica [closed]

I have two BVPs as: $x^{\prime\prime}(t)+tx(t)-t^{3}-2=0$ and $x^{\prime\prime}(t)+x^{2}(t)-t^{4}-2=0$ and their BCs are $x(0)=0$ and $x(1)=1$. Now the function $x(t)=t^{2}$ is their common solution. ...
  • 161
0 votes
0 answers
32 views

How to make the Semidefinite Optimization method work?

I am trying to use Mathematicas Semidefinite Optimization problem for moment matching. The code is as follows: ...
  • 1
4 votes
2 answers
283 views

Optimizing combinations of 3D figures

For every complex number $a$ one can define a function $Q_a$ on $\mathbb{C}$ ; $Q_a(b)=$IP[ar, ai, br, bi], $a,b\in \mathbb{C},ar=Re(a),ai=Im(a),br=Re(b),bi=Im(b)$, ...
  • 312
2 votes
2 answers
128 views

Finding the maximum on a plot and adding dashed lines

I am trying to plot the effective potential of massive particles with the help of this Mathematica code: ...
  • 627

1
2 3 4 5
40