Questions tagged [constraint]
The constraint tag has no summary.
166 questions
6
votes
1
answer
299
views
Optimization with vector constraint function
I would like to minimize a vector function subject to a vector constraint function. Unlike previous posts (Constrained FindMaximum with array valued function and Constrained optimization with a ...
2
votes
1
answer
96
views
find basis for list of vectors satisfying constraint
Given a list of integer-valued vectors $w \subset \mathbb{Z}^5$
...
2
votes
1
answer
137
views
Numerically minimizing functional given integral constraint
Not sure whether Maths or MMA SE is more appropriate since I have problems even tackling the problem. Consider the following question: (Let's say I work in 3D, a box or something) Minimize a ...
1
vote
0
answers
118
views
NDSolve: Prescribe a linear constraint on a boundary
This is a representative volume element problem on a unit square.
I would like to apply the following linear constraint on a boundary:
$u(x,1)=u(x,0)+0.3$
How can do this? There seems to be no way. ...
3
votes
1
answer
202
views
Maximize finds solution outside the constraint
I'm trying to maximize a (quite simple) polynomial inside a sphere. The command is simply:
...
1
vote
0
answers
101
views
TimeConstrained and optimization
I am trying to understand why wrapping TimeConstrained[] around optimization, e.g., MinValue[] can sometimes fail.
To reproduce ...
2
votes
2
answers
226
views
Mathematica LinearSolve with additional constraints
I want to solve a linear Matrix equation over GF(2). I am currently using Mathematica's LinearSolve[A,B, Modulus->2] function to solve for X in the equation AX = ...
4
votes
1
answer
271
views
Using mathematica to find the equation of curves, by providing images, providing constraints, or both
By "collaborate", I mean to give some instructions or constraints.
Consider the following curves: (as examples, only to illustrate my question in a better way):
Curve (I): Assume it is f ...
0
votes
1
answer
128
views
Maximization subject to constraints
I want to solve for parameters and not specific values.
...
4
votes
0
answers
102
views
Find perspective projection matrix under constraints
I have taken a photo (with a rectilinear lens) of a house's outside wall that sits on top a roof, from which I wish to take measurements from. However, to do so I would need to correct the perspective ...
0
votes
1
answer
144
views
Solving for Lagrangian multipliers with additional assumptions
I want to solve the Lagrangian with two multipliers $\lambda_1$ and $\lambda_2$, but with an additional convexity assumption. However, when I solve it case by case under such an assumption, I get 0 as ...
4
votes
1
answer
397
views
Two-directional vibration of Euler–Bernoulli beam with Lagrange multiplier
Background
I'm going to investigate a beam-pendulum coupling system (in this question I won't consider the pendulum though), that is, a spherical pendulum is suspended on the tip of a cantilever beam. ...
1
vote
1
answer
118
views
Find an instance satisfying equation
I have the following equation with two variables xi and nu.
...
0
votes
0
answers
84
views
Problem maximizing a function
I have a problem maximizing the following function:
...
1
vote
1
answer
158
views
Error with NMaximize: "The following constraints are not valid" which disappears if the objective is changed
I am trying to optimize under constraint using NMaximize, however the constraints are flagged as invalid. I could not see the problem with the constraints so I ...
1
vote
1
answer
180
views
Finding the maximum of a non-linear function symbolically
I have the function $$f(x,\alpha) = x^\alpha - \frac{x^2}{2}$$ where $x>0$ is the main variable of interest and $\alpha \in (0,1)$ is the parameter of curvature:
...
0
votes
2
answers
106
views
Constraints in a set of equations
I am currently working on a system of equations that is subject to a determinant constraint. Specifically, I have a matrix $B$ with $\det(B) = 0$, and I aim to construct a linear combination of its ...
0
votes
0
answers
91
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 ...
0
votes
1
answer
142
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 ...
1
vote
1
answer
131
views
NIntegrate MonteCarlo with phase-space constraints
I wanted to use NIntegrate in Mathematica to perform a multi-dimensional Monte-Carlo integration numerically.
I am a physics student, and I want to calculate probabilty (cross-section) of a high ...
8
votes
1
answer
403
views
Creating a random symmetric matrix with a particular rank
The documentation about LinearAlgebra has a section on Constructing Matrices, but the examples of random matrices using RandomReal don't offer an obvios way to ...
0
votes
0
answers
58
views
Solving a system of equations with distributional constraints
I'd like to generate samples of real numbers respecting distributional constraints. I tried (here, for a sample of 17 reals):
...
0
votes
1
answer
103
views
Generating a 2 variables polynomial with constraints
I would like to generate automatically a polynomial in two variables $(s,t)$ which is symmetric under the exchange of those variables. There are three kinds of terms; at order $k$, we have
$$(s+t)^k, \...
8
votes
2
answers
1k
views
How do I plot a function subject to a constraint?
While learning about Lagrange multipliers, I am finding examples on how a constraint is applied to a function.
Given the following two functions (where E^ is ::e::):...
6
votes
3
answers
281
views
How to define variables $a$,$b$,$c$,$d$ are all elements of set $\{2,3,5,7\}$?
I would appreciate it if somebody could help me with the following problem:
I want to create a Wolfram Language expression that states that all $a$,$b$,$c$,$d$ variables are elements of the set $\{2,...
1
vote
1
answer
233
views
LinearOptimization - how to solve with vector constraints?
I have the following linear program that I am able to solve in MATLAB. However, I want to move to Mathematica.
For some fixed constants $n$, $\delta$ and $\varepsilon$ and fixed $(n+1)$-dimensional ...
5
votes
1
answer
225
views
Optimal control via ParametricNDSolve
I'm wondering about the possibility of employing ParametricNDSolve to solve a class of constrained optimal control problems.
Here's an example: The system under ...
5
votes
2
answers
300
views
ContourPlot -- coloring the plot lines
I have 2D implicit functions which I would like to plot in color, with given color functions.
E.g.:
ContourPlot[y^2 - x^3 + x^4 == 0, {x, 0, 1}, {y, -1/2, 1/2}]
...
3
votes
1
answer
317
views
Imposing constraints on any undefined symbol appearing in a matrix automatically
I want to know how can I can I tell Mathematica that all symbols that appear in an object, e.g. a matrix, obey certain constrains, without having to write these conditions by hand.
More specifically, ...
0
votes
1
answer
78
views
How is Mathematica minimizing correlation exactly with linear constraints?
I made a random data matrix as
data = Table[Random[], {i, 5}, {j, 5}];
In my case it was
$$ \left(
\begin{array}{ccccc}
0.951203 & 0.546669 & 0.86928 &...
2
votes
1
answer
121
views
How to find constrains on variables that make a system of inequalities not have a solution
My problem is as follows:
How do I ask Mathematica the following question. Let $f(x,y,z,a,b)$ be a 5 variable polynomial. I want to find all values of $a,b$ for which $f$ has no zeros in the region $...
1
vote
1
answer
262
views
Find right end-point satisfying an integral constraint
I am solving the following system of first-order ODEs with a variable right-end point l1num and boundary condition at that point ...
1
vote
1
answer
292
views
Can this previously solved three-dimensional constrained integration also be solved with certain added products in the integrand?
In Solved3DConstrainedIntegration
the constrained three-dimensional (Hilbert-Schmidt-metric-based HSmetric) integration problem for the absolute separability probability of the two-qubit (quantum bit)...
2
votes
1
answer
290
views
Constrained Optimization with Interpolating Functions
My goal is to use a gradient descent type method to maximize interpolating function1 with respect to the constraint that interpolating function2 <= 0.5. I am working with 4D data (please see below)....
2
votes
2
answers
415
views
Draw a (1/4) partial 3D cylinder in a quadrant
Here is a code to draw a full cylinder $\theta \in [0, 2\pi)$:
Graphics3D[Cylinder[{{0, 0, 0}, {1, 0, 0}}, 1/2]]
My question is that how do we draw a 1/4 of the cylinder, such that it only appears in ...
0
votes
0
answers
100
views
Generating iteration and constraint lists dynamically
I have a model for which I want to perform a set of calculations with successively deeper iterations and more constraint. In other words for a given value of a Do iterator, n, I want to:
perform a ...
0
votes
1
answer
1k
views
Equation of motion through the Lagrangian with Lagrange multipliers
I ask for advice, I'm a little confused. I have such a Lagrangian.
$L=\frac{1}{2}m(\dot{x}^2+\dot{y}^2)-\lambda(2x^2+3y^2-1^2)$
Here $\lambda(2x^2+3y^2-1^2)$ is the constraint on the phase variables.
...
4
votes
2
answers
297
views
How do you make two interactive sliders dependent on eachother?
I have this code.
Definition of q is:
...
2
votes
1
answer
284
views
use of parametric ndsolve with a constraint
I want to solve differential equation
$$ \frac{y''[x]}{(1+y'[x]y'[x])^{3/2}} = -a -y[x]/ \sqrt{2} + x/ \sqrt{2} $$ subject to boundary condition $y(-1) = y(1) = 0$ for some value of $a$. $a$ is found ...
0
votes
0
answers
57
views
Matrix modification with constraint on it
$q$ is a real antisymmetric matrix and can be defined as:
...
3
votes
2
answers
283
views
Creating a matrix of dimension d with constraints on indices
Is there a way to create a matrix $q$ of dimension $d$ with constraints on the indices given by:
$$d\longrightarrow dimension$$
$i,j $ are indices
$$q_{i,j}=\begin{cases}
-b & j=i+d,\\
c & j=...
1
vote
1
answer
329
views
How to enforce constraints on matrix equations for unknowns to have only one non zero element per row?
I am trying to find a nice and efficient way to approach the following problem:
I need to solve (for example using Solve, Reduce, or NSolve) certain type of equations involving a set of unknown square ...
0
votes
1
answer
260
views
Maximization under constraints / find maxima
I am trying to code the following maximization program that I am not able to solve algebraically (Of course I manage to get the first derivative, but struggle finding its root):
$\begin{equation} Max_{...
1
vote
0
answers
86
views
Find the ratio of two volumes of 6 x 6 positive-definite symmetric matrices
Consider the class $A$ of $6 \times 6$ positive definite matrices with real entries and unit trace (that is, the sum of the six diagonal entries is 1). (In quantum information-theoretic parlance, this ...
1
vote
1
answer
144
views
Control evaluation for functional constraints
I'm trying to understand how to use Mathematica to find a solution subject to constraints, where one of the constraints is specified as a predicate function. But I don't know how to control evaluation ...
0
votes
0
answers
82
views
Construction of Navigation Function: Error
https://en.wikipedia.org/wiki/Navigation_function
https://www.sciencedirect.com/science/article/abs/pii/S0921889015302451
https://arxiv.org/pdf/1605.00638.pdf - Paragraph III
I am trying to create a ...
0
votes
2
answers
215
views
listing of vectors satisfying some special constraint
We have
list = {{1, 1, 0}, {1, 0, 1}, {0, 1, 1}, {-1, 1, 0}, {1,-1, 0}, {-1, -1, 0}, {-1, 0, 1}, {1, 0, -1},{-1, 0, -1},{0, -1, 1},{0, 1, -1},{0, -1, -1}}
...
2
votes
2
answers
298
views
FindMinimum with constraint produces incorrect results
Issuing the following:
FindMinimum[{x, ((2 x + 1)/(3 x - 2))^(4 x - 3) <= 10^-10}, {x, 2}]
produces a value of 13.1686 . The constraint for that value is: 1....
1
vote
3
answers
203
views
Maximize - Non binding constraint is changing the result
When I add a non-binding constraint to a maximization problem the result changes. I don't understand why.
Below you can find the code that I am using.
For the maximization A, H = 6837.66
For the ...
3
votes
1
answer
422
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 &...