Basically I have an overdetermined linear system of equations Ax=b, I can use numpy.linalg.lstsq to obtain the least square solution to this latter. However, when I multiply both sides of the equation by a weight diagonal matrix F, the least square solution is different while the equations are technically not. Here is a minimal example:  $A=\begin{bmatrix}1&amp;2&amp;3\\1&amp;3&amp;6\\1&amp;6&amp;2\\1&amp;4&amp;5\end{bmatrix}$ $b=\begin{bmatrix}1\\2\\3\\4\end{bmatrix}$ $F=\begin{bmatrix}0.1&amp;0&amp;0&amp;0\\0&amp;1&amp;0&amp;0\\0&amp;0&amp;10&amp;0\\0&amp;0&amp;0&amp;2\end{bmatrix}$  The solution given of numpy.linalg.lstsq to Ax=b is $x=\begin{bmatrix}-1.56643\\0.685315\\0.374126\end{bmatrix}$  The solution given of numpy.linalg.lstsq to FAx=Fb is $x=\begin{bmatrix}-21.46375975\\3.27144095\\2.41928963\end{bmatrix}$  I though about the equations having different weights in the least square, leading to a different solution chosen by the algorithm, but I am not sure if this is the correct reasoning.  The code:  from numpy import array, diag, dot from numpy.linalg import lstsq  A = array([[1, 2, 3], [1, 3, 6], [1, 6, 2], [1, 4, 5]]) b = array([1, 2, 3, 4]).T F = diag([0.1, 1, 10, 2]) print(lstsq(A, b, rcond=None)[0]) #[-1.56643357  0.68531469  0.37412587] print(lstsq(dot(F,A), dot(F,b), rcond=None)[0]) #[-21.46375975   3.27144095   2.41928963]
Suppose that $\hat{x}$ is the least squares solution of $Ax = b$.  That is, $\min{|r|}, r = Ax - b$ with respect to $x$.  Is $\hat{x}$ also the least squares solution of $JAx = Jb$?  I suspect so, but I'm not sure how to prove it.  If $J$ is invertible, it's easy enough to prove as you can just cancel it out from both sides.  But what if it's not invertible?
$\displaystyle \int\nolimits_0^8 \sqrt{x^4+4x^2}\,dx$.   Alright, so I thought I had this figured out. Here's what I did:   I factor out an $x^2$ to get $\sqrt{x^2(x^2+4)}$. I let $x = 2\tan(\theta)$, therefore the integrand is $\sqrt{4\tan^2(\theta)  (4\tan^2(\theta) + 4)}$. Factor out a 4 and it becomes $\sqrt{(16\tan^2(\theta)  (\tan^2(\theta) + 1))}$ Which equals $\sqrt{16\tan^2(\theta) \sec^2(\theta)}$ This is easy to take the sqrt of. The integrand becomes $4\tan(\theta)\sec(\theta)$. Now, the integral of this is $4\sec(\theta)$ And it's evaluated from $0$ to $\arctan(4)$ right? Because as $x$ goes to $0$, so does $\theta$, and as $x$ goes to $8$, $\theta$ goes to $\arctan(4)$... But the end result $(4 (\sec(\arctan(4)) - 1) )$ isn't the correct answer   I put it into WolframAlpha and I get $(8/3) (17\sqrt{17} - 1)$, which is the right answer. How did they get that? (there's no "show steps" option)  Any help is greatly appreciated!  PS, what's the syntax for doing sqrts and exponentials? DNS Resolution for example.com - Can you explain? How to print a string at a fixed width? Two load icons simultaneously appearing in Android app This  confirms that the Android app is using two different loaders since last year, but just today I've noted that, at the questions page, it is using them simultaneously. I've never noted this, so I believe this bug was recently created.  I hope the following gif is clear enough to show the issue. Also, note that the bigger loader is "freezing".    SE Android App Version: 1.0.60 My Android OS Version: 5.0.2  Still observed in version 1.0.89 Are there examples of third-(or higher)-order linear differential equations in physics or applied mathematics? The classical second-order linear ordinary differential equation is that named after Sturm and Liouville: formally, \begin{equation} (pu')'=ru. \end{equation} It arises naturally in many physical situations, for example through radial considerations of Schrödinger's equation. A higher-order "analogue" of it is the Orr$-$Sommerfeld equation, which, after relabelling the coefficients, may be written as \begin{equation} (\phi u'')''=\psi u. \end{equation} It also arises naturally, namely from certain simplifications applied to Navier$-$Stokes' (in)famous equation, and describes to great accuracy the cross-stream behaviour of channel fluid flow.  I have been thinking long and hard about whether there are additional higher-order linear differential equations that emerge naturally from our mathematical models of the world. It even seems pretty much all of the linear partial differential equations (heat, wave, Schrödinger, etc.) are of second order. Does anybody know of higher-order examples? I just ordered the Nvidia GTX card. I have a dilemma, though. Should I keep using the driver which is available in "additional drivers" in Ubuntu, or should I install the driver from the Nvidia site?  So which driver is the best for me? How to sort this JSON Is there a max length for an array in C++?  Is it a C++ limit or does it depend on my machine? Is it tweakable? Does it depend on the type the array is made of?  Can I break that limit somehow or do I have to search for a better way of storing information? And what should be the simplest way?  What I have to do is storing long long int on an array, I'm working in a Linux environment. My question is: what do I have to do if I need to store an array of N long long integers with N > 10 digits?  I need this because I'm writing some cryptographic algorithm (as for example the p-Pollard) for school, and hit this wall of integers and length of arrays representation. I would like to manipulate the HTML inside an iframe using jQuery.  I thought I'd be able to do this by setting the context of the jQuery function to be the document of the iframe, something like:  $(function(){ //document ready     $('some selector', frames['nameOfMyIframe'].document).doStuff() });   However this doesn't seem to work. A bit of inspection shows me that the variables in frames['nameOfMyIframe'] are undefined unless I wait a while for the iframe to load. However, when the iframe loads the variables are not accessible (I get permission denied-type errors).  Does anyone know of a work-around to this? Realtek RTL8723be doesn't have good reception How can I make an InputField with a proper newline/carriage return? Minecraft 1.7.4 server issues with loading world Is it possible to sneak up on a Force user? In Return of the Jedi, Luke and Darth Vader both sense each other's presence on the moon. In The Force Awakens, Kylo Ren   senses Han Solo on the Starkiller Base  Is it possible to sneak up on a powerful Force user? Or do you have to be   related to them  or significant to them in some way to be detected? Are there any examples of a Force user not sensing someone (in canon), or any successful attempt at disguising someone from a Force user? To clarify, I am talking about physical presence, not Force ability.   Han Solo doesn't have the Force, but Kylo sensed him anyways Does being refused entry to Singapore mean I am now blacklisted? My friend who is an Indonesian citizen tried to enter Singapore this week and was refused entry at the Singapore Harbour Front Ferry Terminal by immigration.  This was his first trip overseas and is not used to international travel, so due to his inexperience and that he was excited to go to Singapore, he possibly made some mistakes on trying to be granted access into Singapore.   He was told he was to enter a Singapore address for his stay or a friend or relative he will stay with. He was only staying for one day and was going to catch the ferry back at night, so he had no plan to stay in Singapore and as such had no address to put. They then asked why he was traveling alone and that he should travel with somebody for his first trip. He told them he always travels alone in Indonesia and finds it easier to see and do things alone. He was then asked why he was entering Singapore and the reason he gave was to purchase some electronics which he cannot buy in Indonesia. They asked for how much money he had and they then advised that he did not have enough money to purchase the items he was after. They refused his entry and he was then escorted to a ferry and returned to Indonesia. His passport was not stamped and he was not fingerprinted.   He was given a Notice of Refusal of Entry which had the reason as "Being ineligible for the issue of a pass under current immigration policies" form on his departure. Also included on this form is his passport number etc. He was not advised of him being banned or a time frame that he cannot enter Singapore.  My questions are: Has he been banned or restricted to enter Singapore for a period of time? When entering countries including Singapore, does he need to tick the box stating he has been refused entry into another country? I am hoping to get my friend to Australia at the end of the year for a 10 day holiday and will this hinder his chance of getting a visa and entering Australia? Is the product of symmetric positive semidefinite matrices positive definite? I need to concatenate two String arrays in Java.  void f(String[] first, String[] second) {     String[] both = ??? }   What is the easiest way to do this? Removing extra page before and after \tableofcontents My main file generate extra page before \tableofcontents with header title "Table of contents". How can I remove this page?  I am copying the main.tex file code for your reference.   \documentclass[twoside,12pt]{Classes/aesm_edspia}  \begin{document} \addtocounter{page}{-1} \makethese  \onehalfspacing \newpage\thispagestyle{empty}\addtocounter{page}{-5}   %depth in the table of contents and section numbering \setcounter{secnumdepth}{3} \setcounter{tocdepth}{3} \frontmatter  \pagestyle{fancy} \fancyhf{} \fancyhead[LE,RO]{Acknowledgements} \fancyfoot[RO]{\thepage} \fancyfoot[LE]{\thepage} \renewcommand{\headrulewidth}{0.5pt} \renewcommand{\footrulewidth}{0pt}  \pagestyle{fancy} \fancyhf{} \fancyhead[LE,RO]{Table of Contents} \fancyfoot[RO]{\thepage} \fancyfoot[LE]{\thepage} \renewcommand{\headrulewidth}{0.5pt} \renewcommand{\footrulewidth}{0pt}  \input{Abstract/Abstract}  \tableofcontents \listoffigures \listoftables   \mainmatter \pagestyle{fancy} \fancyhf{} \fancyhead[LE,RO]{Introduction} \fancyfoot[RO]{\thepage} \fancyfoot[LE]{\thepage} \renewcommand{\headrulewidth}{0.5pt} \renewcommand{\footrulewidth}{0pt}   \end{document} Why does energy have to be emitted in quanta? I was reading some popular science book and there was this sentence. It says that energy has to be emitted in discrete portions called quanta. Otherwise the whole energy in the universe would be converted into  high frequency waves.  I'm not a physicist, so this conclusion seems to me like a huge leap.  First, we assume that energy is emitted in a continuous way (not in quanta).  And how do we get to the statement "the whole energy in the universe would be converted into  high frequency waves"? If I replace my main panel, will I need to fit AFCIs? This question is about whether "circuits" can be grandfathered if the breaker or panel is changed but the circuit is otherwise not disturbed.   Code is NEC 2017.  My existing main panel has plenty of ampacity but few spaces, and thus, is totally full.  I have several potential paths for an upgrade.    One involves fitting a subpanel and moving 4 circuits (2 double-stuff breakers) there, and adding circuits there.    The other involves outright replacing the main with a very fine 60 space main panel.  No more space problems!  But what happens with AFCI and GFCI requirements? If this were a new house,  nearly all my circuits would require it, but I am grandfathered.  Will the  "new main" scenario void the grandfathering and require that nearly all circuits be upgraded to that protection?   Or can I just move over my old breakers and call it good? I have an application which is a relatively old. Through some minor changes, it builds nearly perfectly with Visual C++ 2008. One thing that I've noticed is that my "debug console" isn't quite working right. Basically in the past, I've use AllocConsole() to create a console for my debug output to go to. Then I would use freopen to redirect stdout to it. This worked perfectly with both C and C++ style IO.  Now, it seems that it will only work with C style IO. What is the proper way to redirect things like cout to a console allocated with AllocConsole()?  Here's the code which used to work:  if(AllocConsole()) {     freopen("CONOUT$", "wt", stdout);     SetConsoleTitle("Debug Console");     SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_GREEN | FOREGROUND_BLUE | FOREGROUND_RED); }   EDIT: one thing which occurred to me is that I could make a custom streambuf whose overflow method writes using C style IO and replace std::cout's default stream buffer with it. But that seems like a cop-out. Is there a proper way to do this in 2008? Or is this perhaps something that MS overlooked?  EDIT2: OK, so I've made an implementaiton of the idea I spelled out above. Basically it looks like this:  class outbuf : public std::streambuf { public:     outbuf() {         setp(0, 0);     }      virtual int_type overflow(int_type c = traits_type::eof()) {         return fputc(c, stdout) == EOF ? traits_type::eof() : c;     } };  int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpCmdLine, int nCmdShow) {     // create the console     if(AllocConsole()) {         freopen("CONOUT$", "w", stdout);         SetConsoleTitle("Debug Console");         SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_GREEN | FOREGROUND_BLUE | FOREGROUND_RED);       }      // set std::cout to use my custom streambuf     outbuf ob;     std::streambuf *sb = std::cout.rdbuf(&amp;ob);      // do some work here      // make sure to restore the original so we don't get a crash on close!     std::cout.rdbuf(sb);     return 0; }   Anyone have a better/cleaner solution than just forcing std::cout to be a glorified fputc?