I am currently trying to translate a Python image detection algorithm in C++ (in order to use it in a smartphone app) using OpenCV.  I have similar results to a certain point, where the two algorithms seem to diverge due to the accumulation of small differences in the images: I am applying some transformations to the image, but the number of decimal digits in Python is much larger than in C++ (where I use CV_64FC1 matrices), so I get more and more different results after some iterations...  Do you have any idea on how to overcome this issue?  Thanks in advance :)  EDIT: here is a code that gives a different result in Python and C++  void conv2(const Mat &amp;img, const Mat&amp; kernel, Mat&amp; dest) {   Mat source = img;   Point anchor(kernel.cols - kernel.cols/2 - 1, kernel.rows - kernel.rows/2 - 1);   flip(kernel, kernel, 0);   filter2D(source, dest, -1, kernel, anchor); }  void myFunc() {   Mat im = imread("3.png", IMREAD_GRAYSCALE);   im.convertTo(im, CV_64F);    int rows = im.rows;   int cols = im.cols;   int sze = 7;    Mat gauss = getGaussianKernel(sze, 1);   Mat f = gauss * gauss.t();   Mat fx, fy;   Sobel(f, fx, -1, 1, 0);   Sobel(f, fy, -1, 0, 1);   Mat Gx, Gy, Gxx, Gyy, Gxy;   filter2D(im, Gx, -1, fx);   filter2D(im, Gy, -1, fy);   pow(Gx, 2, Gxx);   pow(Gy, 2, Gyy);   Gxy = Gx.mul(Gy);    gauss = getGaussianKernel(sze, 38);   f = gauss * gauss.t();   conv2(Gxx, f, Gxx);   conv2(Gyy, f, Gyy);   conv2(Gxy, f, Gxy);   Gxy *= 2;    Mat Gxx_minus_Gyy = Gxx - Gyy;   Mat Gxy_squared, Gxx_minus_Gyy_squared;   pow(Gxy, 2, Gxy_squared);   pow(Gxx_minus_Gyy, 2, Gxx_minus_Gyy_squared);    Mat denom;   sqrt(Gxy_squared + Gxx_minus_Gyy_squared, denom);   // denom += numeric_limits&lt;double&gt;::epsilon();   Mat sin2theta = Gxy / denom;   cout.precision(dbl::max_digits10);   cout &lt;&lt; fixed &lt;&lt; sum(sin2theta) &lt;&lt; endl;   exit(1); }   And Python:  def conv2(img, kernel):     source = img     kernel = cv2.flip(kernel, 0)     rows, cols = kernel.shape     anchor = (int(cols - cols/2 - 1), int(rows - rows/2 - 1))     return cv2.filter2D(source, -1, kernel, anchor=anchor)   def myFunc():     im = cv2.imread('3.png', cv2.IMREAD_GRAYSCALE)     im = np.float64(im)      rows, cols = im.shape;     sze = 7      gauss = cv2.getGaussianKernel(sze, 1);     f = gauss * gauss.T;     fx = cv2.Sobel(f, -1, 1, 0)     fy = cv2.Sobel(f, -1, 0, 1)     Gx = cv2.filter2D(im, -1, fx)     Gy = cv2.filter2D(im, -1, fy)     Gxx = cv2.pow(Gx,2);     Gyy = cv2.pow(Gy,2);     Gxy = cv2.multiply(Gx, Gy);      gauss = cv2.getGaussianKernel(sze, 38);     f = gauss * gauss.T;     Gxx = conv2(Gxx, f)     Gyy = conv2(Gyy, f)     Gxy = 2*conv2(Gxy, f)     Gxx_minus_Gyy = Gxx - Gyy     Gxy_squared = cv2.pow(Gxy, 2)     Gxx_minus_Gyy_squared = cv2.pow(Gxx_minus_Gyy, 2)     denom = cv2.sqrt(Gxy_squared + Gxx_minus_Gyy_squared)     # denom += np.finfo(float).eps;     sin2theta = Gxy/denom     print(cv2.sumElems(sin2theta))     exit()   The call to myFunc() prints the sum of the elements in the "sin2theta" matrix: Python gives 86587.44928456949, and C++ gives 86825.05505451805947814, which starts to make a pretty important difference.
In my  I was printing a double using cout that got rounded when I wasn't expecting it.  How can I make cout print a double using full precision?
Does the MacBook battery cycle count reset when replacing a battery I've been  on battery cycle counts and checked out my current count on my MacBook (13-inch, Aluminum, Late 2008) - recommended maximum cycle count is 500.  I've had this laptop now for over 4 years and at the 2 year mark I had the battery replaced by AppleCare. The first time I checked out the cycle count was today and it's currently on 1004. Now my question is, is this the cycle count of the battery since I replaced it (as in, it reads the cycle count from the battery), or is it the combined cycle count (as in, it stores the count somewhere and increments occasionally)? My assumption is that it's the count of that battery but I have no idea how to verify this.  Either way, it looks like I need a new battery ;) Assuming $f:\mathbb R\to\mathbb R $ be an uniform continuous function, how to prove $$\exists a,b\in \mathbb R^+ \quad \text{such that}\quad |f(x)|\le a|x|+b.$$ Analogue of spherical coordinates in $n$-dimensions What's the analogue to spherical coordinates in $n$-dimensions? For example, for $n=2$ the analogue are polar coordinates $r,\theta$, which are related to the Cartesian coordinates $x_1,x_2$ by  $$x_1=r \cos  \theta$$ $$x_2=r \sin  \theta$$  For $n=3$, the analogue would be the ordinary spherical coordinates $r,\theta ,\varphi$, related to the Cartesian coordinates $x_1,x_2,x_3$ by  $$x_1=r \sin  \theta  \cos  \varphi$$ $$x_2=r \sin  \theta  \sin  \varphi$$ $$x_3=r \cos  \theta$$  So these are my questions: Is there an analogue, or several, to spherical coordinates in $n$-dimensions for $n&gt;3$? If there are such analogues, what are they and how are they related to the Cartesian coordinates? Thanks. I want to install the latest Python tarball on Ubuntu, downloaded from .  Is this is a correct way to install?  ./configure make make install   If not, how do I do that? msiexec is command prompt software that installs an  program. But I have found that you can install an MSI file from the command line by just typing in the name of the MSI file on the command line.  But in order to uninstall the MSI file, it seems you have to call the msiexec program and give it a /x or /uninstall.  How can I uninstall an MSI from the command line without using the msiexec routine? QGIS 2.0 - can't select items in Print Composer How to get Scilab 6.0.1 working on Ubuntu 18.04 LTS? I have installed clean Ubuntu MATE 18.04 LTS and installed Scilab from repository here with    sudo apt-get update sudo apt-get install scilab   After installation I tried to launch it from GUI (Applications → Other → Scilab) - it does not start. Then I tried to launch it from terminal with scilab command. Terminal output is as follows:  $ scilab /usr/bin/scilab-bin: error while loading shared libraries: libjava.so: cannot open shared object file: No such file or directory   so it can't find Java. I reported  about this problem.  I checked existence of libjava.so:  $ dpkg -S libjava.so   openjdk-11-jre-headless:amd64: /usr/lib/jvm/java-11-openjdk-amd64/lib/libjava.so   so it is in place.  What should I do to get Scilab 6.0.1 working on Ubuntu 18.04 LTS? The model used to open the store is incompatible with the one used to create the store Java: Why does if statement never resolve to true? Convergence of a Harmonic Continued Fraction Are global variables bad? I've recently started maintaining someone else's JavaScript code. I'm fixing bugs, adding features and also trying to tidy up the code and make it more consistent.  The previous developer used two ways of declaring functions and I can't work out if there is a reason behind it or not.  The two ways are:  var functionOne = function() {     // Some code };     function functionTwo() {     // Some code }   What are the reasons for using these two different methods and what are the pros and cons of each? Is there anything that can be done with one method that can't be done with the other? Do not hide VLQ flag option from users who already flagged and may wish to retract System hides an option to flag Very Low Quality in few cases, namely when post is:        Because of that users who already flagged it when none of above conditions applied miss an option to .  Suggest1 to show this flag option to such users so that they could retract a flag.    1 Frankly I won't mind if this gets  because I doubt that it is important. This is posted mainly to document how system behaves and to provide reference for those who may wonder why they can't retract flag in some cases. Some speculation here:   Is there a possibility it would pass 'undetected' through your hand, or is it certain death?  Can you conclude it to be vital, or only loose your hand?  Would it simply make a small cylindrical hole through your hand, or is there some sort of explosion-effect?  Assume your hand has a cross section of 50cm², and a thickness of 2cm, how much of the beam's energy would be transferred to your hand? How to calculate the summation $(\sum_{p = k}^{n} \binom{n}{p}) / 2^n$ quickly? I was solving a question which technically reduces to the following     Given $N$ items, it is equiprobable for each item to be good or bad, what is the probability that number of good items in the set are greater than or equal to $K$.   This can be reduced to $\dfrac{x}{2^n}$ where $\displaystyle x = \sum_{p = k}^{n} \binom{n}{p}$. Is there a more simplified form which is easier to calculate for large values of $N, K$?  Note: It may be safe to assume that we do not require extremely high precision while calculating(first 5-10 digits only).  Thanks! Is there to make the login screen appear on the external display in 18.04? On Ubuntu 18.04, I have connected my laptop to an external display and I am able to set the external display as primary and external display only mode. But when I turn on my laptop or log out from my session the display login screen is displayed only on my(internal) laptop screen. But once I login the display switches to external only and my laptop screen turns off as expected. Is there a way I can make the login screen appear only on the external screen on bootup or on logout as in 16.04? Also the login screen does not follow my cursor as in 16.04. Brownian motion - Hölder continuity Let $B$ stand for a Brownian motion on a finite interval $[0,1]$. If I am not wrong, I think that there exists a positive constant $c$, such that almost surely, for $h$ small enough , for all $0&lt; t &lt; 1- h$  \begin{align} |B(t+h)-B(t)| &lt; c\sqrt{h\log(1/h)} \end{align} or something like this. As a result   \begin{align} \bigg|\frac{B(t+h)-B(t)}{h}\bigg| &lt; K(h)  \end{align}  Am I correct ? Global variables in AngularJS Why does the review system disable the "First Posts" and "Late Answers" if I reached daily upvote limit? I was reviewing on , and I faced a weird thing. I can review "Close Votes", "Low Quality Posts", and "Suggested Edits" if I reached my daily vote limit, but I can't for "First Posts" and "Late Answers". Why?    If they just deserve an upvote/downvote then they should not include in the review system. But if we can improve them through leaving comments and by editing the posts then why can't we access them? How do I reference the only element in a singleton set? You can turn any element $n$ into a singleton set by adding braces, $\{n\}$. Is there an inverse to this operation, such that if I know the set is a singleton set I can easily reference its element?  For example, say I have the set $A = \{5,6,7,8\}$, and then some process that iteratively eliminates all but one element of $A$, and then I want to see what 10 plus the resulting element is, how could I write that?  The only way I can think of is by referencing the first element by its index, e.g., $10 + A_1$. Is there another way to do it though? In my case the elements of $A$ are already indices, so I would have to index an index, like $10 + x_{A_1}$. Which is not the worst thing in the world, I was just wondering if there is a better way.