I was given the following exercise:  Find the gcd of $x^4+x^3+2x^2+x+1 $ and $x^3+4x^2+4x+3 $ in $\mathbb{Q}[x]$ using the Euclidean algorithm.  Well, I  used the Euclidean algorithm and got $10x^2+10x+10$. But then I decided to check it on WolframAlpha and got $x^2+x+1$,that is the same answer divided by 10.   Also,by factorization of the polynomials I got the same answer as WolframAlpha.  I think that I  can “ditch” the 10 on the answer I got using the algorithm but I don’t see why (maybe I am overlooking some propriety of the gcd?)
Excuse me for the confusing title. I was asked to find $gcd(x^2+3x+2,x^2+x)$  What i did is i factorized both polynomials $x^2+x=(x+1)x$  $x^2+3x+2=(x+1)(x+2)$  So i expected the gcd to be $x+1$   But using the euclidean algorithm i found out the gcd to be $2x+2$. Why is factorizing wrong? Is it because $K[X]$ is not factorial ? Would the euclidean algorithm also work if the polynomials are in $\Bbb Z[X]$ ???
Getting a collection of index values using a LINQ query Is there a better way to do this?  string[] s = {"zero", "one", "two", "three", "four", "five"};  var x =  s .Select((a,i) =&gt; new {Value = a, Index = i}) .Where(b =&gt; b.Value.StartsWith("t")) .Select(c =&gt; c.Index);   i.e. I'm looking for a more efficient or more elegant way to get the positions of the items matching the criteria. A cannonball is launched from a point 100 m above ground, at a speed of 20 m/s. This is modelled by the equation $h(t)=-4.9t^2 +20t +100$ The speed of sound (of the cannonball is) 380m/s If a person sitting directly underneath the cannonball runs as soon as they hear the sound do they escape the cannon? My main question is &quot;$y=-380x+100$&quot; the correct equation to model the cannon's sound? How can I encrypt and decrypt a string in C#? du shows completely different folder size for * and folder name I'm trying to move some data over and to start with I'd like to make sure that the size is ok. I run into a problem however, if I check the folder with   du -sh  myfolder/ 780M    myfolder/   but   du -sh * .. 71M     myfolder ..   I thought it might be something to do with hidden files but this particular folder does not have any inside.  Am I missing something? Deriving Newton's Third Law from homogeneity of Space I'm currently studying  and Python programming. I just want to know how I would go about executing a Linux command in Python. The commands I want to execute are:  echo 1 &gt; /proc/sys/net/ipv4/ip_forward iptables -t nat -A PREROUTING -p tcp --destination-port 80 -j REDIRECT --to-port 8080   If I just use print in Python and run it in the terminal will it do the same as executing it as if you was typing it yourself and pressing Enter? What does E mean in 9.0122222900391E-5? I often find this at the bottom of pages.  Page generated in 0.00013899803161621  Sometimes, I come across  Page generated in 9.0122222900391E-5  What does that time mean? I tried searching Wikipedia for E and maths but found the . My guess is E stand for Exponential and -5 is the power it is raised to. And the displayed time is a really small number. But that doesn't make sense when compared to the other time in the question. 0.00013899803161621 is bigger than 9.0122222900391E-5. If it means x times $10^{-5}$, then 9.0122222900391E-5 will be 0.000090122222900391 which is smaller than 0.00013899803161621. What does E stand for? Many browsers and Internet companies have recently claimed that SSL Certificates with a signature algorithm of SHA1 will imminently no longer be considered secure.  Most notably, .  Yet I've read that since the SSL/TLS negotiation and Cipher Suite don't make use of plain SHA1 (or even MD5), and instead use SHA1 within an ; that using a Cipher Suite with SHA1 is still an acceptable security practice.  Is this the case?    While we're on it, is it also the case of using MD5 in a cipher suite? How to enforce sender address to be "logged-in-user@example.org" in Postfix? I have set up a Postfix server with SMTP AUTH (STARTTLS on port 587). All my users are in the domain "example.org". I want to enforce the sender address to be "logged-in-user@example.org".  I learned that this can be achieved with the main.cf options  smtpd_sender_restrictions = reject_sender_login_mismatch, ... smtpd_sender_login_maps = hash:/etc/postfix/smtpd_sender_login_maps   with a login_maps file like:  a@example.org a b@example.org b c@example.org c ...   (see also ), but this would mean I'll have to edit the login_maps file every time I have a new user. I don't need such a flexible mapping: It should always be "logged-in-user@example.org". Is there an easier option? Simple way to compare processors Today, comparing processors is obviously not just looking at the frequency and the number of cores.  When choosing a new PC, how do you compare processors? Is there some resource, like a site or something that does (not necessarily super-precise) processor comparisons?  Thanks. Speeding up a NOT IN subquery Good evening,  I'm currently up to try to improve the performance of some of my queries. As far as I know, statements like "IN" or "NOT IN" are even faster with a large amount of values if a subquery on an indexed field without conditions is used.  SELECT * FROM table1 WHERE field1 NOT IN (SELECT index_field FROM table2)   When it comes to use conditions at table2, the query becomes realy slow on a large amount of data.  SELECT * FROM table1 WHERE     field1 NOT IN (         SELECT             index_field         FROM table2         WHERE             user_id = '2'     )   I was thinking about using LEFT Join but when I need to to the filtering for the user_id, it also becomes slow.  How may I solve this problem? Currently, I've no clue about that.  The original query looked sth. like this  SELECT     i.* FROM stream_item si LEFT JOIN user__publisher_item ui     ON ui.user_id = 2     &amp;&amp; ui.item_id = si.item_id INNER JOIN item i     ON i.id = si.item_id WHERE      si.stream_id IN (5,7,8,9,19,24,29,42,43,44)     &amp;&amp; ui.id IS NULL || (         ui.`read` = 0 || ui.saved = 1     ) GROUP BY     si.item_id ORDER BY     si.`found` DESC LIMIT 0,10     id      select_type     table   type        possible_keys                                                                           key                 key_len     ref                 rows        Extra 1       SIMPLE          si      index       PRIMARY,stream_2_item,stream_id_found                                                   stream_2_item       4           \N                  663236      Using temporary; Using filesort 1       SIMPLE          ui      eq_ref      user_id_item_id,user_2_item,user_id_read_saved_hidden,user_id_saved,user_id_hidden      user_id_item_id     8           const,si.item_id    1           Using where 1       SIMPLE          i       eq_ref      PRIMARY                                                                                 PRIMARY             4           si.item_id          1      I have a table which represents the n:m relationship between stream and items. An unique item can be accessible via multiple streams. Based upon this i have a state-table for user dependent states of an item. Currently, the user-state-entry will only be generated, if the item was read or saved the first tim. Otherwise, there is no entry in the user_item table. In the beginning, this query was fine but now, it takes a lot of time. Even if I leave out the "INNER JOIN" it takes 7 seconds on the current tables with around 500k rows each.  The table-structure in the background is as follows:   stream stream_item //n:m relation between stream and items item //unique items stream_group //user-defined groups of multiple streams stream_group_streams //_n:m relation between stream_groups and streams_ user user_item //state-table that holds the user-dependent states of an item - if there is no state, no row exists for an item   I already asked this question at  but added my 2 Edits with further information to late so that I haven't got an answer anymore. php function for collating external variables into a single object regardless of GET or POST I recall reviewing someone else's PHP code once and he had a function or class method that rolled all GET and POST variables into a single plain old object that could then be passed around. If the same name-value pair appeared in both GET and POST, POST would win.  Is there a well-coded PHP add-on out there of any sort that does exactly this? Cropping the exact same part of several pictures I have several pictures that are exactly the same except for some small variations. It was one picture that was photoshopped in several different ways. Now, I need to crop them all (13 in total) but I need to crop exactly the same part of it. It needs to be pixel perfect.  How do I do that with Pixelmator? MSBuild exec task with for I am trying to run the following commands as part of an MSBuild script:  for /R . %f in (*.targets) do copy /Y "%f" "C:\Program Files (x86)\MSBuild\Microso ft\VisualStudio\TeamBuild"   The commands is implemented in an exec the following way:  &lt;Exec WorkingDirectory="$(SolutionRoot)" Command="for /R . %f in (*.targets) do copy /Y &amp;quot;%f&amp;quot; &amp;quot;$(MSBuildExtensionsPath)\Microsoft\VisualStudio\TeamBuild&amp;quot;" /&gt;   The command works fine from console, but when trying to run it from MSBuild I get the error:   Task "Exec"   Command:   for /R . %f in (*.targets) do copy /Y "%f" "C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\TeamBuild"   f" "C:\Program was unexpected at this time. C:\Users\rd-build\AppData\Local\Temp\OH Test2\Continuous.BuildTargets\BuildType\TFSBuild.proj(98,5): error MSB3073: The command "for /R . %f in (*.targets) do copy /Y "%f" "C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\TeamBuild"" exited with code 255. Done executing task "Exec" -- FAILED.   Any suggestions? Does addition imply an order? Consider any integer, suppose a number 3. We can break any such integer down into a sequence of 1's. So, we can write: $$ 3\equiv1+1+1 $$ 3 represents what we get when we add 1 to 1 to another 1. Conceptually, what I am getting confused with, is the fact that notionally, at least according to this definition, there is one unit at the beginning, to which we add another, and yet a third. There seems to be a sequence here, which would imply there being an order. Am I missing something obvious? How can I listen to communication between a process and a serial port? On a Gentoo Linux machine, a process is communicating with another computer via serial port (/dev/ttyS1). I want to listen to this communication (i.e. what is being sent/received by the process) without further interfering.   How can I achieve this with just basic Linux tools? I even can change the serial port the process is communicating with, so maybe I can 'shortcut' two devices (/dev/ttyS1 and /dev/xxx) listen to all communication, when all output to /dev/ttyS1 is forwarded to /dev/xxx and vice versa. But how do I do it? Something with socat? After installing Adobe PDF reader, it opens files with the .PDF file extension. Ones' default web browser opens .html files and notepad opens .txt files, etc.  Where exactly in the registry are these filetype - program associations stored in the registry?   In other words, how does Windows know with which software/program it must open a certain file(type)? Generalized mean value theorem I know and understand the mean value theorem. But at the moment I don't have the intuition to understand the generalized mean value theorem     If $f$ and $g$ are continuous on the closed interval $[a,b]$ and differentiable on the open interval $(a,b)$, then there exists a point $c\in(a,b)$ where$$[f(b)-f(a)]g'(c)=[g(b)-g(a)]f'(c).$$If $g'$ is never zero on $(a,b)$, then the conclusion can be stated as$$\frac{f'(c)}{g'(c)}=\frac{f(b)-f(a)}{g(b)-g(a)}.$$   What is the intuition? And how can you prove this (generally) ? What kinds of desktop environments and shells are available? Does anyone know why typedefs of class names don't work like class names for the friend declaration?  class A { public: };  class B : public A { public:    typedef A SUPERCLASS; };  typedef A X;  class C { public:    friend class A;             // OK    friend class X;             // fails    friend class B::SUPERCLASS; // fails };