Python script seems to do incorrect arithmetics.  import _thread import time  def mult(pixel : int, multiplier : tuple) -&gt; float:     "multiplies either r,g,b pixel by row vector (0.257, 0.504, 0.098),(-0.148,-0.291,0.439),(0.439,-0.368,-0.071))"      sum=0     for mul in multiplier:         sum += (pixel * mul)         print(sum)     return sum  redMul = [0.257, 0.504,0.098] greenMul = [-0.148, -0.291, 0.439] blueMul = [0.439, -0.368,-0.071]  redAdd = 16 greenAdd = 128 blueAdd = 128  try:    _thread.start_new_thread(mult,(1,blueMul)) except:     print("Error: unable to start thread")   code outputs:  0.439 0.07100000000000001 1.3877787807814457e-17   when expecting:  0.439  0.071 0   What is the cause of this error and how can i resolve it?
Consider the following code:   0.1 + 0.2 == 0.3  -&gt;  false   0.1 + 0.2         -&gt;  0.30000000000000004   Why do these inaccuracies happen?
Execute command in remote active terminal How do I get the difference between two Dates in JavaScript? I'm creating an application which lets you define events with a time frame.  I want to automatically fill in the end date when the user selects or changes the start date.  I can't quite figure out, however, how to get the difference between the two times, and then how to create a new end Date using that difference. Directory-tree listing in Python How to Disable new terms (free tagging) with Taxonomies? What are some good books for learning the concepts of Kinematics, Newton laws, 2D Motion of Object etc.? Show that any set of 7 distinct integers includes two integers $x$ and $y$, such that either $x-y$ or $x+y$ is divisible by 10 Show that any set of 7 distinct integers includes two integers $x$ and $y$, such that either $x-y$ or $x+y$ is divisible by 10. I'm trying to apply the pigeonhole principle, but haven't been able to come up with a convincing argument.   Though similar to , I think the difference between the two is enough to warrant a second post. Dual-system Windows and Ubuntu I did dual boot with Windows 7 &amp; Ubuntu 14.04. I get both in boot menu but can't boot into Windows 7. The primary drive where Windows 7 was configured now shows to be logical drive with all files in it. How to resolve it ?  This is what it shows:  irshad@irshad-desktop:~$ lsblk NAME   MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT sda      8:0    0 465.8G  0 disk      ├─sda1   8:1    0  58.6G  0 part /media/irshad/B2E08E69E08E339F     ├─sda2   8:2    0     1K  0 part      ├─sda5   8:5    0 195.3G  0 part /media/irshad/8E90A6A690A6946D     ├─sda6   8:6    0 182.8G  0 part /media/irshad/7650B08250B04B1F    ├─sda7   8:7    0    25G  0 part /    └─sda8   8:8    0     4G  0 part      sr0     11:0    1  1024M  0 rom     I tried to run update-grub but I get the following result.  $ sudo update-grub  Generating grub configuration file ...  /etc/grub.d/06_custom: 31: /etc/grub.d/06_custom: function: not found  /etc/grub.d/06_custom: 34: /etc/grub.d/06_custom: save_env: not found  /etc/grub.d/06_custom: 36: /etc/grub.d/06_custom: Syntax error: "}" unexpected How can I reset or revert a file to a specific revision? How can I create and extract zip archives from the command line? Is being good at mathematic contests necessary to pursue a career in mathematics or physics? I am extremely poor in solving a problem quickly, which leaves me doing badly in olympiads and other contests. But, if I just don’t give up on a problem, no matter how much time it takes, I usually end up solving it. To have a future in mathematics or physics, is it necessary for me to excel at contests, because these days children excelling at contests have an advantage over those who don’t (not complete advantage, but advantage nonetheless)? I've recently been learning about differential equations, and my teacher has been giving some particularly difficult examples out for those of us who finish early. He gave us the following differential equation: $$x=y\frac{dy}{dx}-\left(\frac{dy}{dx}\right)^{2}$$ With the hint "Differentiate with respect to $y$, then let $\frac{dy}{dx}=p$". I've solved it after the lesson and would like someone to check whether or not I've done so correctly.    Following the hint, $$\frac{dx}{dy}=\frac{1}{p}=p+y\frac{dp}{dy}-2p\frac{dp}{dy}$$ Which rearranges to $$p-\frac{1}{p}+y\frac{dp}{dy}=2p\frac{dp}{dy}$$ Multiplying through by $\frac{dy}{dp}$, $$\left(p-\frac{1}{p}\right)\frac{dy}{dp}+y=2p$$ Rearranging into the form $\frac{dy}{dp}+f(p)y=g(p)$, and writing $p-\frac{1}{p}=\frac{p^{2}-1}{p}$ $$\frac{dy}{dp}+\frac{p}{p^{2}-1}y=\frac{2p^{2}}{p^{2}-1}$$ Our integrating factor is $$e^{\int\frac{p}{p^{2}-1}dp}=e^{\frac{1}{2}\ln(p^{2}-1)}=\sqrt{p^{2}-1}$$ So we have $$\sqrt{p^{2}-1}\frac{dy}{dp}+\frac{p}{\sqrt{p^{2}-1}}y=\frac{2p^{2}}{\sqrt{p^{2}-1}}$$ The left hand side is, by design, $\frac{d}{dp}(y\sqrt{p^{2}-1})$, and the right hand side can be integrated as follows: $$\int \frac{2p^{2}}{\sqrt{p^{2}-1}}dp=\int\frac{2(p^{2}-1)+2}{\sqrt{p^{2}-1}}dp=\int 2\sqrt{p^{2}-1}dp+\int \frac{2}{\sqrt{p^{2}-1}} dp$$ These can both be solved using the substitution $p=\cosh(u)$, and gives $$y\sqrt{p^{2}-1}=p\sqrt{p^{2}+1}-\cosh^{-1}(p)+\alpha$$ Where $\alpha$ is an arbitrary constant. Dividing, we finally have $$y=p+\frac{\cosh^{-1}(p)+\alpha}{\sqrt{p^{2}-1}}$$  Here I was stuck for a long time, until I realised that we also have the equation we began with: $x=py-p^{2}$, which we can solve as a quadratic in $p$ to also get $$p=\frac{y\pm \sqrt{y^{2}-4x}}{2} \implies p^{2}=\frac{y^{2}+y^{2}-4x \pm 2y\sqrt{y^{2}-4x}}{4}$$  Thus, $$y=\frac{y\pm \sqrt{y^{2}-4x}}{2}+\frac{\cosh^{-1}\left(\frac{y\pm \sqrt{y^{2}-4x}}{2}\right)+\alpha}{\sqrt{\frac{y^{2}-2x \pm y\sqrt{y^{2}-4x}}{2}-1}}$$  This is as good as I can do - we have a relation between $y$ and $x$ - am I done? Is this the correct answer? Is there an easier way?     Thank you for your time.    Following the suggestion by @Valentin $$\frac{dy}{dp}=1+\frac{\frac{1}{\sqrt{p^{2}-1}}\sqrt{p^{2}-1}-p\frac{\cosh^{-1}(p)+\alpha}{\sqrt{p^{2}-1}}}{p^{2}-1}=1+p\frac{1-\frac{\cosh^{-1}(p)+\alpha}{\sqrt{p^{2}-1}}}{p^{2}-1}$$ Hence, $$dx=\frac{dy}{p}=dp\left(\frac{1}{p}+\frac{1-\frac{\cosh^{-1}(p)+\alpha}{\sqrt{p^{2}-1}}}{p^{2}-1}\right)$$ How to Export this animation as a gif file for powerpoint presentation Constructing $g$ holomorphic differentials on $\omega^3=(z-1) \cdots (z-8)$ Let us have a surface $X$ which satisfy the equation $\omega^3 = (z-1)(z-2)\cdots (z-8)$ It's stated in the task, that there are exactly $g$ holomorphic differentials on the curve. How can I find $g$ and construct them?  The genus $g$ of this curve (I tried to use Riemann-Hurwitz theorem)  The map $X(z,\omega) \to CP^1(\omega)$ has degree 3. and we have 8 branching points with 3 leaves at each. $\chi(Domain) = DegreeOfMap * \chi(Target) - \sum_{points}(BranchingLeaves - 1) $ $2-2g = 3 *(2) - 8*2 $ hence $ 12 = 2g$ and  $g = 6$ I know that in case of hyperelliptic curve there are $g-2$ (If i'm not mistaken) holomorphic differetials and they are of sort $\frac{z^k dz}{w}$. But the form of the curve equation was heavily used. UPD: there is a branhing point at $\infty$, because if we go around all points $ 1 \cdots 8$ at once, we get that cubic root of the right side is multiplied by $\exp{4 \pi /3}$ $2-2g = 3 *(2) - 9*2 $ hence $ 12 = 2g$ and  $g = 7$ (I hope that this is true) beamer - global transition shifts slide content Using beamer with the , I want to have a global transition effect (a fast fade) which I set using the following code:  \addtobeamertemplate{background canvas}{\transfade[duration=0.2]}{}   as found on  answer.  However, doing it messes up with my slides settings. It doesn't change every slides, only the \section ones that are slightly shifted to the right, adding a white line on the left, as seen here:   I tried using XeLaTeX and LuaLaTeX, as they are the only compilers I could use for my current font, but they both have the same issue.  It probably comes from the theme, however I have no clue why it would happen or how to fix it.  Edit :   \documentclass{beamer} \usetheme{m} \addtobeamertemplate{background canvas}{\transfade}{}  \begin{document} \section{test} \end{document}   Requires the mtheme to work How to prevent windows from sleeping? How to show that the cohomology of a Grassmannian has a basis consisting of the equivalent classes represented by Schubert cycles? Let $G(r, n)$ be the Grassmannian of the set of all $r$-planes in a $n$-dim vector space. How to show that the cohomology of a Grassmannian has a basis consisting of the equivalent classes represented by Schubert cycles? I am confused since I don't know how to compute the cohomology of a variety (how to construct the co-chain complex). I am really appreciate if you can compute the cohomology of, for example, $G(2,4)$ and show that it has a basis consisting of the equivalent classes represented by Schubert cycles. copy and paste doesn't work in terminal Find $\int \frac{x^3}{x^2-1} \:\mathrm{d}x$ Find $\displaystyle \int \dfrac{x^3}{x^2-1} \:\mathrm{d}x$.   I think there are a few ways to do this. We could just break this up using long division or break it up into partial fractions then use long division. My homework says to break this up into its roots so that's why I brought up partial fractions. Is that the best way to do it here? What points in the complex plane satisfy $|z|=arg(z)$. Badges loading broken in election statistics We have an  and I noticed the badges are not loading in the election statistics like they should be. It just hangs forever loading badge information:    Unfortunately I blew off reporting this for a couple days figuring it would resolve itself, but it doesn't seem to be a temporary problem.