I have a data matrix $X$ with shape $p\times n$.  It might not matter but I interpret $X$ is $n$ vectors each containing $p$ features.  Then I compute $Q = X X^{T} / n$. This implies that $Q$ is positive definite.  I interpret $Q$ as covariance matrix of data which are columns of $X$. (Normally mean should be subtracted from $X$ before computing covariance this way. However the mean of $X$ is 0 in my case. That is why the formula for covariance is simpler in my case.)  Then I compute $Q^{-1}$, the inverse of $Q$. Which should be also positive definite.  I want to compute Mahalanobis distance for each column $x$ of $X$ as follows:  $\sqrt{x^T Q^{-1} x}$  However for some columns I get that $x^T Q^{-1} x$ is negative. This should not be possible in theory. So I suspect that the error is caused by numerical errors caused by software.  I use the Math.Net numerics library in C#. How do I avoid this problem?   I tried replacing $Q$ and $Q^{-1}$ by their transpose. The result should be the same in theory but slightly differs in practice. But the difference wasn't big enough I still get negative number for the same column.  What else I can do?
I have an expression for a covariance matrix $C$ in terms of the indices $i$ and $j$.  In this way I can analytically calculate the elements of my covariance matrix, however when I try to invert $C$ matlab gives a warning about the matrix being close to singular.  The inversion therefore doesn't work, by which I mean the multiplying $C$ by the inverse given i do not get the identity.  I have tried calculating the pseudo inverse but this also does not work.  I have also tried adding a small constant along the diagonal but again the results do not work.  In general I'm working with matrices of dimension 1200 but I will give low dimensional example matrix that has the same properties, i.e. the matrices are symmetric about the diagonal and the anti-diagonal     19.9939  19.9954  19.9958  19.9951  19.9933  19.9905  19.9865    19.9954  19.9973  19.9981  19.9978  19.9965  19.9940  19.9905    19.9958  19.9981  19.9993  19.9995  19.9985  19.9965  19.9933    19.9951  19.9978  19.9995  20.0000  19.9995  19.9978  19.9951    19.9933  19.9965  19.9985  19.9995  19.9993  19.9981  19.9958    19.9905  19.9940  19.9965  19.9978  19.9981  19.9973  19.9954    19.9865  19.9905  19.9933  19.9951  19.9958  19.9954  19.9939   As mentioned in the title the matrix isn't positive, however the the negative eigenvalues are very small suggesting that the matrix is not positive only due to machine precision.  The negative eigenvalues are $-1.4048e-14$ and $-2.4571e-15$.  How can I go about inverting these matrices?
What is the string concatenation operator in Oracle? What is the string concatenation operator in Oracle SQL?    Are there any "interesting" features I should be careful of?    (This seems obvious, but I couldn't find a previous question asking it). Password Protect QGIS project On a shared computer, I have a QGIS project which links up to a PostGIS database that contains my data. If a user wants to access layers from the db, they have to enter the db credentials, so that's OK.   However, I have previously logged on and imported layers from my db into QGIS, and manipulated them in QGIS (styling options based on meta-data, etc.)... Anybody who opens my QGIS project can view these layers in QGIS, and can therefore see the data I wish to be protected in my db.  Is there a way to password protect my QGIS project? Find a recurrence relation for the number of ways to arrange $n$ dominoes to fill a $2$ by $n$ checkerboard. I am having trouble with this question, please take a look at it:     Find a recurrence relation for the number of ways to arrange $n$ dominoes to fill a $2$ by $n$ checkerboard.   I have just started reading the topic and it is one of the starting problem. Please help. You can give me some hints, a complete answer is also appreciated.  Thanks We will generate a csv file with below values  yp1234,577,1,3 yp5678,577,3,5 yp9012,132,8,9   I need to extract data and create files based on second column. If it's 577 then the whole line has to be extracted and placed in a separate file. I mean I need a file having lines with second column as 577 alone and another file with second column as 132 alone  I tried using IF but didn't work As part of the definition of a cone spell in the handbook:     A cone's point of origin is not included in the cone's area of effect, unless you decide otherwise.   As an example, what would either case be for a casting of Burning Hands?   Could the caster include themselves? or does this mean that they can exclude the first square of the cone? How do you report percentage accuracy for glmnet logistic regression? Cards entering the battlefield simultaneously and "Enter the Battlefield" effects Is there any table or any other way(metadata/rest api) we can query the list views of a particular object that a user/group  has access.  Example:  SELECT Name FROM table_x WHERE UserOrGroupId = '1234..' AND  SobjectType = 'Account'   I can see an object named UserListView in workbench, but query on that returns no data. Is it deprecated? Creating lots of random cuts on a surface Here's an image of a cube with lots of edges added. It was created using knife tool and lots of clicking:    What would be the best way to randomly generate such cuts with less effort...? The  currently says  In the context of Stack Exchange sites, any copying and pasting of any amount of text or code that wasn't written by you is plagiarism if you try, explicitly or implicitly, to pass it off as your own work. (italics mine)  There is also a concept of . Should this also be addressed in the FAQs? In other words, is it OK to copy (large parts of) your own answer  without proper attribution? Convert a string/integer to superscript in C# I have a Java String that contains XML, with no line feeds or indentations. I would like to turn it into a String with nicely formatted XML. How do I do this?  String unformattedXml = "&lt;tag&gt;&lt;nested&gt;hello&lt;/nested&gt;&lt;/tag&gt;"; String formattedXml = new [UnknownClass]().format(unformattedXml);   Note: My input is a String. My output is a String.   (Basic) mock result:    &lt;?xml version="1.0" encoding="UTF-8"?&gt; &lt;root&gt;   &lt;tag&gt;     &lt;nested&gt;hello&lt;/nested&gt;   &lt;/tag&gt; &lt;/root&gt; I want to write a program for this: In a folder I have n number of files; first read one file and perform some operation then store result in a separate file. Then read 2nd file, perform operation again and save result in new 2nd file. Do the same procedure for n number of files. The program reads all files one by one and stores results of each file separately. Please give examples how I can do it. Vueling is currently experiencing , with many flights delayed by several hours. Assuming I'm at the airport and my flight is certainly delayed by more than 3 hours, can I simply book another flight and claim compensation later?  According to EU's :     In addition, if you are denied boarding, your flight is cancelled or arrives more than 3 hours late on arrival at the final destination stated on your ticket, you may be entitled to compensation of EUR 250 - 600, depending on the distance of the flight.   But it's not clear if I actually have to board the flight or if simply having a purchased ticket is sufficient. I presume it would be possible to negotiate with Vueling representatives at the airport, but I'd rather not wait in the inevitable 100-person line to their counter if I'm covered by EU law. How to find $\partial\chi^2/\partial a$ where $\chi^2=\sum_{i=1}^N\dfrac{D(x_i)-a-b(x_i)^2}{\sigma_i^2}$?  My attempt: \begin{align} \dfrac{\partial}{\partial a}\sum_{i=1}^N\dfrac{D(x_i)-a-b(x_i)^2}{\sigma_i^2} &amp;= \dfrac{\partial}{\partial a}\sum_{i=1}^N\dfrac{D(x_i)-b(x_i)^2}{\sigma_i^2}-\sum_{i=1}^N\dfrac{-a}{\sigma_i^2}\\ &amp;=\sum_{i=1}^N\dfrac{D(x_i)-b(x_i)^2}{\sigma_i^2}-\dfrac{\partial}{\partial a}\sum_{i=1}^N\dfrac{-a}{\sigma_i^2}\\ &amp;=\sum_{i=1}^N\dfrac{D(x_i)-b(x_i)^2}{\sigma_i^2}-\dfrac{1}{\sigma_i^2}\cdot\dfrac{\partial}{\partial a}\sum_{i=1}^N-a\\ &amp;=\sum_{i=1}^N\dfrac{D(x_i)-b(x_i)^2}{\sigma_i^2}-\dfrac{1}{\sigma_i^2}\cdot\dfrac{\partial}{\partial a}a^N\\ &amp;=\sum_{i=1}^N\dfrac{D(x_i)-b(x_i)^2}{\sigma_i^2}-\dfrac{1}{\sigma_i^2}\cdot N\cdot a^{N-1}\\ \end{align}  Is this correct?  EDIT: As per the accepted answer, this is how I got my final partial derivative. \begin{align}             \dfrac{\partial}{\partial a}\sum_{i=1}^N\dfrac{D(x_i)-a-b(x_i)^2}{\sigma_i^2} &amp;= \dfrac{\partial}{\partial a}\Bigg[\sum_{i=1}^N\dfrac{D(x_i)-b(x_i)^2}{\sigma_i^2}-\sum_{i=1}^N\dfrac{-a}{\sigma_i^2}\Bigg]\\             &amp;=\dfrac{\partial}{\partial a}\Bigg[\sum_{i=1}^N\dfrac{D(x_i)-b(x_i)^2}{\sigma_i^2}\Bigg]-\dfrac{\partial}{\partial a}\Bigg[\sum_{i=1}^N\dfrac{-a}{\sigma_i^2}\Bigg]\\             &amp;= 0-\dfrac{\partial}{\partial a}\Bigg[\dfrac{-a}{\sigma_1^2}+\dfrac{-a}{\sigma_2^2}+\cdots+\dfrac{-a}{\sigma_N^2}\Bigg]\\             &amp;= -\Bigg[\dfrac{\partial}{\partial a}\Bigg[\dfrac{-a}{\sigma_1^2}\Bigg]+\dfrac{\partial}{\partial a}\Bigg[\dfrac{-a}{\sigma_2^2}\Bigg]+\cdots+\dfrac{\partial}{\partial a}\Bigg[\dfrac{-a}{\sigma_N^2}\Bigg]\Bigg]\\             &amp;= -\Bigg[\dfrac{-1}{\sigma_1^2}\cdot\dfrac{\partial}{\partial a}[a]+\dfrac{-1}{\sigma_1^2}\cdot\dfrac{\partial}{\partial a}[a]+\cdots+\dfrac{-1}{\sigma_N^2}\cdot\dfrac{\partial}{\partial a}[a]\Bigg]\\             &amp;= -\Bigg[\dfrac{-1}{\sigma_1^2}+\dfrac{-1}{\sigma_2^2}+\cdots+\dfrac{-1}{\sigma_N^2}\Bigg]\\             &amp;= \sum_{i=1}^{N}\dfrac{1}{\sigma_i^2}\\         \end{align} How do I show that $X = \left\{ (x,y) \in \mathbb{R}^2 \mid x \in \mathbb{Q}\text{ or }y \in \mathbb{Q}\right\}$ is path connected?    Note that $X$ is a topological space with subspace topology $\tau = \left\{ U \cap X \mid U\text{ is open in }\mathbb{R}^2\right\}$.  I only know two things (with respect to path connectedness):   A topological space $X$ is path connected iff for every $p,q \in X$, there is a continuous function $f: [a,b] \to X$ with $f(a)=p$ and $f(b) = q$.    Continuity $f$ is defined as for every open set in $X$, its preimage is open in $[a,b]$ (with subspace topology induced by $\mathbb{R}$ (with standard topology) )   Suppose $X$ and $Y$ are two topological spaces and $f: X \to Y$ is a continuous surjection. If $X$ is path connected, then $Y$ is path connected. How do I convert or upgrade roads? I'm trying to optimize my road system a bit, mostly converting regular small roads into one-way roads. But the only way I can see to do that is to remove the old road entirely and build a new one. I can't seem to just build over the old one.   I can understand that limitation in cases where the new road type is larger, but it should be possible to upgrade to roads with the same size without tearing down the old road manually.   Is there an easier way to convert or upgrade roads, or do I have to manually remove the existing road every time? I'm new to Linux but not to app development. I come from a RealBasic on a Mac background.   I've accepted that I need to learn a new language to develop for Linux (since RB won't run on 64 bit distros and is a cloed proprietary language) but I want to make sure I pick the right one.   I've been looking at Python and was all set to go until I read that PyGTK is becoming obsolete with the introduction of GTK 3. Is this true? The Ubuntu developer website stills seems to recommend it with Glade for the UI but I want to make sure that I don't learn something that's on the way out! css vertical centering how could i vertically center a &lt;div&gt; within a &lt;div&gt; ?  my code so far:  &lt;div style="height:322px;overflow:auto;"&gt;     &lt;div style="border: Solid 1px #999999;padding:5px;"&gt;     &lt;/div&gt; &lt;/div&gt;   i have tried "top:50%;" and "vertical-align:middle;" without success  EDIT: okay so it's been discussed a lot. and i've maybe started another mini flame war. but for argument sake, how would i do it with a table then? i've used css for everything else so far so it's not like i'm not trying to employ "good practices".  EDIT: the inner div does not have a fixed height SF Short Story about resetting the world every day Trying to identify a short story. I recall it was quite short, shorter than a novella. I read it within the last few years, but my impression is that it's from the second half of the twentieth century, maybe the sixties. I can't recall if I read it online, in an anthology, or collection. Set in America, a middle-aged man stumbles on a team (maybe like dwarves or gnomes) whose job it is to set up the world for the next day by removing all the previous day's &quot;stuff&quot;, like street furniture? (I know that makes no sense). He disrupts this process and somehow prevents progressing to the next day. I also remember the story was quite lighthearted with the team behaving in a very grumpy way like interrupted workmen. I thought the title was something like &quot;What happened to Tuesday&quot; or similar. For some reason, I thought it was by Keith Laumer, but a search doesn't reveal anything. The trope was similar to &quot;The Tunnel Under the World&quot; by Pohl, and &quot;The Adjustment Team&quot; by Dick, in that reality was constantly changed and controlled by an organisation of some kind.