Questions tagged [constraint]
The constraint tag has no usage guidance.
147
questions
0
votes
0
answers
29
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
0
answers
17
views
Generating a 3 variables polynomial with constraints on 2
This post is a follow-up of Generating a 2 variables polynomial with constraints.
I would like to generate automatically a polynomial in three variables $(s,t,u)$ which is symmetric under the exchange ...
0
votes
1
answer
39
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
312
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::):...
0
votes
0
answers
51
views
Solving a KKT constrained optimization problem
I am quite new to Mathematica and I tried to solve constrained optimization problem but the script just keeps running without finishing so I wanted to check if the problem is simply untractable or if ...
6
votes
3
answers
143
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
98
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
114
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
218
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
113
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
50
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
66
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
175
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
136
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
84
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
237
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
49
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
410
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.
...
3
votes
2
answers
102
views
How do you make two interactive sliders dependent on eachother?
I have this code.
Definition of q is:
...
2
votes
1
answer
130
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
35
views
Matrix modification with constraint on it
$q$ is a real antisymmetric matrix and can be defined as:
...
3
votes
2
answers
142
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
139
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
85
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
42
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
86
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
56
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
105
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
134
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
134
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 ...
2
votes
1
answer
146
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 &...
2
votes
2
answers
97
views
Calculate the Viswanath's constant (Random Fibonacci sequences)
How Can I calculate first few digits of Viswanath's constant?
Viswanath’s constant ≈ 1.1319882487943 is a real number whose nth power approximates the absolute value of the nth term of some random ...
0
votes
1
answer
162
views
How to find a numerical solution for a differential equation with constraints?
I want first to apologize for my poor english level ^^ Let me present my issue.
I want resolve numerically (I use Python) for x in [0;1] the following differential equation : $$dy/dx = a(y - y^2) $$
...
2
votes
1
answer
117
views
Verify a conjectured formula for a modification of a 3D constrained integration successfully solved using Mathematica
I've acquired somewhat indirect--and not fully conclusive--evidence that the solution of a certain three-dimensional constrained integration takes the form
...
1
vote
1
answer
37
views
Plotting 3D region depending on 2 parameters with constraints
I'm trying to plot the full range that a set of estimates gives. They depend on some parameters and conditions, but I haven't been able to to it effectively with RegionPlot3D. Here is the set that I ...
0
votes
0
answers
37
views
Bug with ValueQ involving fractions? [duplicate]
Expected behavior:
ClearAll[f];
ValueQ[f[1]]
False
Unexpected behavior:
...
0
votes
1
answer
102
views
Find the probability (relative volume) of a certain 4-ball with respect to Hilbert-Schmidt measure
Let us consider the set of points {x,y,z,1-x-y-z} and impose the strict ordering constraint
...
2
votes
1
answer
237
views
Solving an equation with a constraint involving not-equal
I am trying to solve an equation with a constraint involving not-equal.
For example:
$2 x + 3 y = 5$ with the constraint $2 x + 4 ≠ 2$.
How should I approach this?
Edit 1
I tried the suggestions in ...
1
vote
2
answers
195
views
Confirm and possibly simplify a 2009 result for a 2D constrained integration
This is a direct descendant of two other recent questions,
3D and Equivalence,
both of which have been
answered in skillful, interesting manners. (See also the comment [actually answer] of JimB to
...
1
vote
1
answer
164
views
How to force LinearModelFit to return Non-negative coefficients?
LinearModelFit[{m,v}] will return a coefficients list $\beta$ from the design matrix $m$ and response vector $v$, where $m.\beta$ is fitted to $v$. However, the ...
0
votes
2
answers
71
views
FindMaximum under binary constrains
I'm trying to find a maximum for a function whose variables have binary values (either -1 or 1). The clumsy code for that constraint I use is shown below. There must be a more compact code, and I ...
3
votes
3
answers
409
views
Evaluate a certain three-dimensional constrained integral
The result of the three-dimensional integration
...
2
votes
0
answers
66
views
How to generate a large number of constraints for all indices ($\forall i$)
Is it possible to generate a set of constraints in the form "$\forall$".
For example:
\begin{align}
\min\ & f\left(\sum x_i\right)\\
s.t.\ & \\
& x_i\geq 17 && \forall i=...
2
votes
1
answer
182
views
Solving symbolic system of non-linear equations takes too long
I am trying to solve a set of system of symbolic non-linear equations:
...
4
votes
1
answer
67
views
Nonlinearmodelfit with integral or nintegral as constrain
Until now I have been using the Nonlinearmodelfit without any issues, but I want to add a new constrain (Integral or NIntegral) to my modelfit.
My fitting function is ...
0
votes
1
answer
104
views
Global optimisation - Error bound on NMaximize?
Is it possible to obtain an error bound on NMaximize? e.g. convert the number returned by NMaximize into a rigorous upper bound ...
1
vote
0
answers
53
views
Tackling variational problem with constraints [closed]
I need to minimize (preferably symbolically) functional with constraints:
$$
F = \int_{0}^{\pi/2} f(x)cos{x}dx\,\\
1.1 \geq f(x) \geq 0\\
2.\int_{0}^{\pi/2} f(x)dx=Const\\
3. f(0) =1\\
4.f(\pi/2) = 0\...
0
votes
1
answer
58
views
1
vote
1
answer
133
views
Constrained NDSolve
Consider n particles constrained on the surface of a unit sphere. $i^{th}$ particle experiences a force from every other $j^{th}$ of the form $$\vec{f_{ij}}=\frac{k ...
5
votes
1
answer
185
views
How do I tell FindMinimum to only work with positive, real numbers?
I have a function that I'm trying to minimize. It currently works reasonably well with this:
...