Questions tagged [constraint]
The constraint tag has no usage guidance.
158
questions
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
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
0
answers
28
views
Adding constrains in a SYM function "Classicalsymmetries"
Please help me add constrains on my code. The function runs perfectly fine without the constrains but it gives me 7 cases and I only need one where all the constrains I have hold.
This is the code ...
0
votes
0
answers
44
views
Identify a condition among variables that satisfy an inequality
I have a symbolic function that produces the output
a = (1 - e - mu/n) Log[(1 - e - mu/n)/(1 - mu/n)] + (e + mu/n) Log[((e + mu/n) n)/mu]
If I substitute ...
0
votes
0
answers
53
views
Problem maximizing a function
I have a problem maximizing the following function:
...
1
vote
1
answer
44
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
106
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
0
answers
33
views
Optimization over nested variables, vectors and matrices
I am trying to optimize a function that is fairly complicated, but at the end I just want to solve a parametrized assignment problem using integer linear optimization with Mathematica.
The main ...
0
votes
2
answers
48
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
57
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
68
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 ...
0
votes
1
answer
64
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
289
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
30
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
48
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
579
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
162
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
146
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
142
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
232
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
153
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
51
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
74
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
183
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
150
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
128
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
271
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
58
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
661
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
162
views
How do you make two interactive sliders dependent on eachother?
I have this code.
Definition of q is:
...
2
votes
1
answer
179
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
36
views
Matrix modification with constraint on it
$q$ is a real antisymmetric matrix and can be defined as:
...
3
votes
2
answers
183
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
230
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
136
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
43
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
100
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
57
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
109
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
153
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
144
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
296
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
153
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
226
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
118
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
40
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
106
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
488
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
197
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
...