The Stack Overflow podcast is back! Listen to an interview with our new CEO.

All Questions

Filter by
Sorted by
Tagged with
23
votes
2answers
1k views

Obtain approximate Hessian using FindMinimum

According to the documentation, when FindMinimum is told to use the method "QuasiNewton" on a unconstrained problem, it uses the ...
16
votes
2answers
596 views

Differentiating functions of vectors/matrices?

I'm dealing with derivatives of scalar functions of matrices and wondering if Mathematica can help me here. The standard approach of expanding it in terms of components is cumbersome. As an ...
10
votes
3answers
1k views

How can I complete a correlation matrix with missing values?

I would like to complete a correlation matrix with missing entries, such that the resulting matrix is positive semi-definite. Say I want to find some x and some y in the next matrix that satisfy ...
8
votes
5answers
861 views

Indicate minimal path sum

Described on the page: http://www.mathblog.dk/project-euler-81-find-the-minimal-path-sum-from-the-top-left-to-the-bottom-right-by-moving-right-and-down/ It is an example of the solution indicated in ...
8
votes
2answers
830 views

Is there any fast way to solve a quadratic matrix equation in Mathematica approximately?

Let the square nonsingular matrix $M$ is a given convergent matrix. What are the best scalar values for $\alpha$ and $\beta$ (in the real numbers domain), at which the following quadratic matrix ...
4
votes
2answers
818 views

Maximization in Mathematica using matrix and vector notation

I am trying to solve a simple maximization problem in Mathematica, using matrix and vector notation. ...
4
votes
1answer
1k views

FindMaximum “is not a real number at” nrnum problem

I'm experiencing a problem using FindMaximum that I don't understand (due to my newbie knowledge of Mathematica's syntax). That is, FindMaximum sometimes returns a (correct) answer, but sometimes ...
4
votes
2answers
830 views

Optimizing functions taking matrix arguments

I'm looking for general information on how to optimize matrix valued functions, I have the following function I'm looking to maximize (or figure out if this is possible at all). ...
4
votes
1answer
111 views

quadratic constraint feasibility

Suppose that $A$ is an $n \times n$ matrix, and I have observed some entries of $A$, say, $A_S$ ($A$ restricted on $S$) for some subset $S$ in $\{1,...,n\} \times \{1,...,n\}$. I want to know if it's ...
3
votes
1answer
318 views

Optimize a parametric matrix to get a lowest possible eigenvalue

This question is a followup of Plot the lowest eigenvalues of a parametric matrix Now I can get the lowest eigenvalue LowEign(t) of the matrix for a given t numerically. When I plot the LowEign ...
3
votes
3answers
213 views

Defining a function for the construction of a bordered hessian

I think in Mathematica the omission of a function that can create a bordered matrix. This code works ...
3
votes
1answer
200 views

Decomposing a diagonal positive real matrix

I would like to 'decompose' a diagonal positive real matrix $E$ of rank $D$ onto $\sum_{i=1}^{D}c(i)N^i$: $$E = \left( \begin{array}{ccc} 0 & & & \\ & a & & \\ &...
3
votes
2answers
877 views

Optimization problem with matrix positivity constraints

Is it possible for Mathematica to parametrically find a local minimum of a given function (say of some variable $x$ where $(a,b,c)$ serve as parameters) subject to the constraint that a given ...
3
votes
2answers
109 views

Programming with Mathematica Syntax - Dunford decomposition

I am always amazed while I am reading some solutions of problems in mathematical problems of this site with Mathematica. For instance, look at the problem 48. Whereas I am writing 100 lines of code ...
3
votes
1answer
156 views

Find maximum of the norm of matrix

g = 0.9; H = {{g, I}, {I, -g}}; G = MatrixExp[t*H]; Plot[Norm[G], {t, 0, 20}, AspectRatio -> 1] FindMaxValue[Norm[G], {t, 1}] The matrix has a parameter t. ...
3
votes
2answers
125 views

How to efficiently optimize a strictly increasing linear function over convex set

I am trying to minimize the trace of a symmetric matrix $B$ fulfilling $x^T A_i x \leq x^T B x \ \forall x \forall i$ for given (in general) indefinite symmetric matrices $A_i, i = 1, ..., n$. The ...
3
votes
1answer
54 views

Minimize matrix column totals

I would like to pick up n (2 in example) columns from matrix. The sum/total of these columns should be minimal. ...
3
votes
1answer
152 views

How to sort Matrix

I am on permutation project, and I have trouble with my result, the sequence of my result is not same with Permutations in Mathematica here the code ...
3
votes
1answer
67 views

An optimization problem involving the calculation of MatrixRank gets wrong

I was trying to solve an optimization problem involving rank of a matrix and experimenting with a very simple one. A 2x2 matrix which contains only one parameter a11...
2
votes
1answer
746 views

Minimizing a Matrix

...
2
votes
2answers
411 views

Need an efficient method for finding certain matrices

I am trying to write a function which produces square matrices with certain characteristics. The function should have two inputs: number of the rows, n number of ...
2
votes
1answer
139 views

How to improve the speed of NMaximize function

My problem is as follows: Consider a 5*5 matrix Obj with 0 and 1 Obj = Array[x, {5, 5}]; The objective function is: ...
1
vote
1answer
69 views

Solve the vector-matrix equation. Minimize the length of the desired n-dimensional vector

There is the following vector-matrix equation. where C - nonzero constant. [x1 x2 ... xn] - vector of real numbers. M - matrix of real numbers of dimension n x n It is required to find a vector $x$...
1
vote
3answers
99 views

Find k largest edges with unique nodes (kind of maximum weighted matching)

I have a weighted graph, and I am interested to find k largest edges with unique nodes. Currently, I do it in the following manner ...
1
vote
1answer
51 views

Specific aggregation of matrix elements

Let us consider the matrix 'x1': x1 = {{1, 2, 3, m}, {4, 5, 6, n}, {7, 8, 9, o}, {10, 11, 12, o}} MatrixForm[x1] From the matrix 'x1' we compute the matrix 'x2':...
1
vote
1answer
623 views

How can I fit a matrix function with multiple variables to given eigenvalues?

I have a 5x5 matrix function H[kx] ...
1
vote
2answers
538 views

Find the minimum element of a row of a matrix and its column index for each row

I am trying to find the minimum value of a row of a matrix and its corresponding column. Please run the code below. OptV is the matrix that I would like to create which must give the output of the ...
1
vote
1answer
75 views

Count and NMinimize don't seem to work together

Initially I write down a 2x2 unitary (Uni) , make a tensor product 4 times (LocalUni) and apply it to an initial numerical matrix Rho, to obtain RhoLU, that depends on 12 parameters. This is my code: ...
1
vote
1answer
117 views

NMinimize error

I want to use NMinimize in the following way: ...
1
vote
1answer
167 views

Optimizing matrix inequalities over trace

I need to solve the following problem. Given $n \times n$ Hermitian matrices $A\geq 0$ and $B_1, ~ B_2$ (need not be positive semidefinite), with $Tr(AB_1)<0~,Tr(AB_2)<0$ construct a ...
1
vote
0answers
16 views

How to minimize the eigenvalues of a hermitian matrix?

Suppose I have a complex hermitian matrix, M[x_,y_] whose eigenvalues must be real.I tried to minimize the first eigenvalue by writing following command:f[x_,y_]:=Eigenvalues[M[x,y]][[1]]; Minimize[f[...
1
vote
0answers
109 views

Exponential Matrix Differentiation

I have been struggling with the following question while solving an optimization problem in $\mathbb{R}_{+}^G$. Basically, I have $$\min_{y \in \mathbb{R}_{+}^G} F(y) = y^{T}\mathcal{K} + \exp(-y^{T} \...
1
vote
0answers
83 views

Which method to use for finding maximum without actually computing optimization function explicitly?

I am new to Mathematica and I am currently working on an optimization problem. The optimization function that I have easy to calculate for some assignment of variable but it is very difficult to ...
1
vote
0answers
138 views

NMaximize with matrix input

I defined function f[x_, fixed_] := {...}. Here x is an $M\times N$ matrix. I want to maximize $f$ with respect to $x$. I have ...
0
votes
2answers
86 views

An optimization problem involving the calculation of `MatrixRank` as a constraint

I am dealing with an optimization problem that involves the rank of a matrix as a hard constraint. I am starting with this simple example ...
0
votes
1answer
41 views

How can I specify the region for every variable simultaneously in NMinimize?

I want to use NMinimize to find the unknown unitary matrix that solves a (possibly nonlinear) matrix equation. For example, the one that transforms the Pauli matrix ...
0
votes
1answer
701 views

Solving linear system with constraints

I need to come up with a solution for a rather, odd situation. Let's say I have an $M \times N$ matrix called ${\bf A}$, and I would like to solve it for ${\bf x}$ where $b_1 \le {\bf A} {\bf x} \le ...
0
votes
1answer
64 views

Finding a column from Max comparing each element of two columns; subsequent column used for backward calculation

I have lensp=21; rho=0.975; e1=0; pid= 0.5212; qid=0.4788; tid=10; based on my own calculations I have given vectors of dimension ...