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

Let R be the region enclosed by the curves [closed]

Use Mathematica. Let R be the region enclosed by the curves y=x^3-3x and y=2x^2 (i) Sketch the region R. (ii) Find the area of region R.
-2 votes
0 answers
53 views

draw a triangle [closed]

Given a triangle with vertices (0,6), (4,0), and (6,8). How do you use Graphics to draw the triangle as well as it's altitudes, perpendicular bisector, medians, and angle bisectors in Mathematica?
3 votes
0 answers
46 views

NMinimize NelderMead postprocessing method [closed]

I am using NMinimize with the NelderMead method. I have a very good initial solution supplied via InitialPoints. If I turn off postprocessing ("PostProcess"->False) then the output is ...
0 votes
0 answers
44 views

Why do the solutions from the FindMinimum produce a lot of unphysical oscillatory points?

The parameters. Here I mention all the parameters I use in my code including some of the functions that I define for convenience Parameter set-I ...
2 votes
1 answer
28 views

Using NMinimize for a real-valued function of complex variables

I am trying to use NMinimize to minimize a real-valued function of complex arguments, with a supplied initial point. This doesn't seem to work well. For example, the following gives errors like "...
0 votes
1 answer
60 views

Finding only non-negative roots with FindRoot

Given an arbitrary function F, how do I force FindRoot to look only for non-negative roots, returning nothing otherwise?
  • 4,362
0 votes
0 answers
30 views

Calculating minimal unknown coefficients of a sum

I have a problem, where I have to find the minimum of a function with a sum in it (coefficients are unknown): psi[x_] := 1 + a*x + b*x^2 + c*x^3 + d*x^4 + ... ...
0 votes
0 answers
15 views

Plot taking longer than usual time to be produced

I have the following code for a function ...
3 votes
0 answers
33 views

Performing Tobit Regression in Mathematica by Maximum LogLikelihood

I am trying to estimate a tobit model by maximum likelihood method in Mathematica. I can not find the build-in function. So I try to perform it manually. Here is the log likelihood function of Tobit ...
0 votes
0 answers
41 views

Invalid Constraints error in Non-linear Optimization

I am trying to write the code to solve a certain optimal control problem, but I keep running into an issue when I pass on my constraints to NMininimize[]. The ...
1 vote
1 answer
61 views

Simple SDP using Hermitian matrices

I would like to run the following semidefinite program $$ \textrm{Minimize}\,\, \textrm{tr}\big({AX}\big)\\ \textrm{subject to}\,\, X \geq B_1\,, X \geq B_2\,, $$ where $A$, $B_1$ and $B_2$ are ...
0 votes
1 answer
47 views

Find the minimum value of a constrained multivariable function [closed]

Say I have a function of four variables $f(x_1,x_2,x_3,x_4)$ and a constraint $g(x_1,x_2,x_3,x_4)$ (both are quite complicated, that's why I don't write them explicitly). I want to find the minimum ...
  • 123
0 votes
0 answers
32 views

Moving average MA(1) coefficient estimation

I am new to mathematica, I have some simulated a moving average, MA(1), data and I want to estimate the coefficients, theta, of it using Maximum likelihood estimation or log likelihood. Can someone ...
0 votes
0 answers
12 views

Is there a way to print all the outputs NMaximize runs through for different variable combinations?

I've got some function of 4 angles ($\theta1$, $\phi1$, $\theta2$,$\phi2$) that I'd like to maximize using NMaximize, but I'd like to be able to see the output for ...
  • 13
2 votes
1 answer
50 views

Using the result of Solve as a function of parameters

I am trying to find b2 maximising a function I named 'EG1EUB'. And 'EG1EUBb2' is the frist order condition. Based on my understanding, Solve gave me a single solution saying that b2 is the second root....
  • 45
0 votes
0 answers
65 views

Reduce local maximum of function, a problem of optimization

So I have this almost linear function (for evey frequency it is the square root of a sum of squares), but not quite. ...
3 votes
1 answer
138 views

Holes in ContourPlot3D

I have a polynomial polyHP and I put some conditions Reg on it and I try to plot it with ...
  • 41
6 votes
3 answers
444 views

Fast pairwise difference

I'm trying to construct a matrix $A_{ij}=X_i-Y_j$ where $X$ and $Y$ are vectors with thousands of real numbers. The fastest and closest thing I found is ...
0 votes
0 answers
24 views

Can I avoid FindMinimum ruining my Asserts with symbolic stuff?

I am new with Mathematica, so forgive me if I completely misunderstood the nature of the problem... Problem description I want to optimize a fairly complex function bypassing explicit derivative ...
  • 151
2 votes
2 answers
64 views

NMaxValue - function is not a real number

I'm trying to use NMaxValue to numerically find maximal values of the function F[z]. The problematic part of my code is as ...
0 votes
0 answers
55 views

Numerical solution of the integral for the profile of a vortex

I am trying to solve numerically the integral extracted from the article by Vanyó et al. (https://doi.org/10.1103/PhysRevE.90.013002) $$ h(r') = \int_{0}^{r^{\prime}} \frac{\partial p}{\partial r} / \...
2 votes
2 answers
151 views

Getting an exact value from FindMinimum [closed]

FindMinimum[{(Sin[a]^2 + Sin[b]^2)/Sin[c]^2, a + 2 b == π/2 && a + b + c == π && a > 0 && b > 0}, {a, b, c}] The numerical ...
  • 793
4 votes
3 answers
185 views

Computing $c$ that minimizes $\left(\sum_i h_i c_i\right)^2/\sum_i h_i^2 c_i$

I need to solve the following problem. Given a set a vector of positive numbers $h_i$, find $c_i$ which solves the following optimization problem : minimize $$k$$ subject to $$\begin{equation} k\sum_i ...
3 votes
1 answer
88 views

Is it normal that adding constraints on the parameters of NonlinearModelFit increases execution time 100 times??

Normally, reducing the optimization domain by adding constraints should reduce the time of execution. In my case however, this puts the NonlinearModelFit in a coma. Without constraints, 8 seconds ...
  • 1,314
0 votes
2 answers
34 views

Maximizing functions with statements similar but result different

I would like to know why when I maximize the sum of two functions with similar expressions (Qu and Qm), it gives me different results (nu and nm), since they should be the same results because the ...
0 votes
1 answer
25 views

Verbose NMaximize for long optimisations

I am currently running a command: NMaximize[{expression, constraints}, {x1, ..., xn}] that takes quite a while to converge. Is there a way to run Nmaximize in a ...
1 vote
0 answers
47 views

Solving the Unbalanced Assignment Problem with FindMinimumCostFlow?

I want to adapt this code from this answer to work with unbalanced bipartite graphs: ...
  • 151
0 votes
0 answers
33 views

How to define a multivariate region of space on which to minimize a function?

My objective is to optimize a function that takes two vectors as argument: a parameter vector of probability to be optimized on, and the input data. In other words am trying to tell Mathematica that ...
  • 151
2 votes
1 answer
46 views

How to predict number from a set of data?

I have 2 sets of data. For example, ...
0 votes
1 answer
66 views

Integro-differential equation with parameters

I am trying to solve an optimization problem with constraints that leads to the following integro-differential equation ...
  • 219
0 votes
0 answers
49 views

Code not getting solved by NMaximize as 1/0 is encountred

I have the following code. This code requires to solve the model with two variables to optimize the function. a1 and a2 are the variables as shown in the code ...
2 votes
1 answer
86 views

Code running for longer period to evaluate

0I have the following code where I want to maximize a stochastic function based on two variables. The code is taking a very long time to evaluate but still not giving answers. Can anyone help? ...
2 votes
0 answers
98 views

Placing shapes along a square spiral

Proposed code example is inspired by the main idea of this challenge. Wolfram Language provides great opportunities in computational geometry. But not all of them are equal in terms of speed and ...
  • 793
1 vote
1 answer
87 views

Understanding the calculation of the periodic function $f(x)=x-x^3, \quad -1<x<1$

It is given the following periodic function $$f(x)=x-x^3, \quad -1<x<1$$ This is an odd function, so the coefficients $a_n,a_0$ of the Fourier Series are zero. Usually, I face function with two ...
2 votes
0 answers
94 views

Still bug in NMaximize

Executing in 13.2 on Windows 10 ...
  • 21k
2 votes
1 answer
112 views

Plotting a Stochastic function

I have a stochastic function and I tried to plot it in Mathematica ...
3 votes
2 answers
270 views

Can Mathematica resume the data that has been completely closed/quit?

Imagine that I run these four simple plots on a PC and then close and quit Mathematica, say the notebook file name is NOTE1 ...
  • 659
0 votes
0 answers
61 views

What strategy would you adopt for this deep search on a function?

Ok, so I have a problem where I have a function that depends on 9 parameters and a bound condition $$f(x,y,z,w,t,u,v,r,s)<K$$ Now all these variables take discrete values such as: $$x \in \{x_1, ...
2 votes
1 answer
103 views

ImplicitRegion with parameters

My goal would be to run the following code: ...
  • 4,402
0 votes
0 answers
80 views

Maximization Problem

I am trying to find the solution of the following problem. $ \max_{n_{\in [1,M]}} \frac{n \left(\frac{k (n-2 (\rho -1) \tau )}{\frac{k n (n-2 (\rho -1) \tau )}{2 (n+1)^2}+1}-2 \rho (\tau -1)\right)}{...
  • 70
3 votes
1 answer
83 views

How to more efficiently code integer constraints in LinearOptimization and Maximize

I've written the following code and it works, but my code syntax is inefficient. This is a linear optimization with binary (0,1) integer constraints. Instead of writing each Ri as between 0 and 1 and ...
  • 1,393
0 votes
2 answers
58 views

How do to create 3D plot for the argument from two another arguments for maximum of the function?

How do to create 3D plot of ${t_{opt}} = {f_2}\left( {x,y} \right)$, where ${t_{opt}}$ is corresponding to maximum value of ${f_1}\left( {x,y,t} \right)$ at the limited ranges of $x,y,t$? If $t$ ...
  • 3
5 votes
2 answers
154 views

Routine to find all sets that are solution of a equation

So I have been wodering if Mathematica has any in-built function that would easily solve me these problem without manual search using for cycles that slow down the computation. Let's imagine I have a ...
2 votes
1 answer
69 views

Numerical Optimization over arrays of variable length

Consider the following command line. We work in the n=2 dimensions, in the sense that I have an 'x' variable of dimension n=2, and n+1=3 variables y1, y2, y3 of dimension 2 each. I have hard coded as ...
3 votes
1 answer
96 views

Why doesn't FindInstance work with inequalities?

I'm trying to use FindInstance to find some simple counterexamples to the equality a^(1/n)+b^(1/n)=((a+b)^((1/n))) , with a, b and n integers. (Ex: a -> 9, b -&...
2 votes
1 answer
94 views

Can I solve a system for a postive semidefinite variables?

I have the following system, where I want to find the solution set consisting of real, nonzero, symmetric positive semidefinite matrices $G$ and $DD$ such that the block matrix $X$ defined below is ...
0 votes
1 answer
64 views

Why, if you write the expression in the form of two functions, does the code stop working?

I would like to find the minimum of the function EER[a, v] using parallel computing. If I write the code like this, it works: ...
  • 771
1 vote
1 answer
52 views

Convergence with Maximize - Iterations, Precision

I have problems with some applications for finding convergence - below is one example of failure for {x=0.35,y=0.35,z=0.3}, but it works fine for {x=0.3,y=0.3,z=0.4}. How can I increase the iterations ...
  • 197
0 votes
1 answer
83 views

Maximization of a concave function with contraints in the arguments

I have been struggling on solving this problem. Suppose you have a function f(x, y) that is concave in x and y. I want to find (x, y) that maximize f(x, y) with x ...
  • 41
1 vote
1 answer
49 views

Nminimize output of ParametricNDSolveValue

I want to minimize the time a family of ODEs vanishes. To do so, I'm using WhenEvent to extract the vanishing time and put the result inside Nminimize: ...

1
2 3 4 5
41