Show that:  \begin{align*}   a \cos \theta + b \sin \theta = \sqrt{a^2+b^2} \cos (\theta - \varphi) \end{align*}  fyi, the context is in studying the differential equation:  \begin{align*}   y''(t) + c^2 y(t) &amp;= 0 \\ \end{align*}  which has general solution:  \begin{align*}   y(t) &amp;= a \cos (ct) + b \sin (ct) \\ \end{align*}  My textbook says that this can easily be transformed into, where $\varphi \in \mathbb{R}$:  \begin{align*}   y(t) &amp;= \sqrt{a^2 + b^2} \cos (ct - \varphi) \\ \end{align*}
I don't understand this. These identities are given in the online notes for MIT's 18.01 calculus class. It's related to taking the sum of two trig functions and transforming them into a single trig function. I can use the formulas to do this, but I am having trouble finding anything on the internet to use a proof for my understanding.  Thanks for any responses!  EDITED (added after the first answer):  Sorry, the identity goes like this:  $A\sin{k(x-c)}=a\sin{kx}+b\cos{kx}$ ,  with the relationships  $a=A\cos{kc}$ , $b=-A\sin{kc}$ , $A=\sqrt{a^2+b^2}$ , and $\tan{kc}=-b/a$
I can print with printf as a hex or octal number.  Is there a format tag to print as binary, or arbitrary base? I am running gcc. printf(&quot;%d %x %o\n&quot;, 10, 10, 10); //prints &quot;10 A 12\n&quot; print(&quot;%b\n&quot;, 10); // prints &quot;%b\n&quot; Reference for general-topology How do I fix the GPG error "NO_PUBKEY"? I added some extra repositories with the Software Sources program. But when I reload the package database, I get an error like the following:     W: GPG error:  trusty InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 8BAF9A6F   I know I can fix it using apt-key in a terminal, according to the official Ubuntu documentation. But I would have liked to do it graphically. Is there a way to do this without using a terminal? Correlations with unordered categorical variables I have a dataframe with many observations and many variables. Some of them are categorical (unordered) and the others are numerical.  I'm looking for associations between these variables. I've been able to compute correlation for numerical variables (Spearman's correlation) but :   I don't know how to measure correlation between unordered categorical variables. I don't know how to measure correlation between unordered categorical variables and numerical variables.   Does anyone know how this could be done? If so, are there R functions implementing these methods? Don't delete comments with link to duplicate if they are modified A user just posted his question a second time here on meta after the first was closed as a duplicate. I wrote a comment on the second post, explaining that the answer to his question is in the linked duplicate and that he shouldn't circumvent the closure process by asking a second identical question.  When the second post was closed as a duplicate my comment was automatically deleted. As far as I understand this is a heuristic that removes obsolete comments, which it considers every comment that contains a link to one of the duplicates.  This heuristic is too aggressive and removes comments that go beyond "Duplicate here: link". I suggest that it should be changed to only remove the default duplicate comment, and not any comment that was edited by the owner nor any free-form comment that happens to include a link to the duplicate.  This also triggers for any comment that contains the word "duplicate" and link to any question, not only the question being chosen as duplicate, which makes this much worse. I just found out about the Mesh Display : Length feature in the "N" panel (thanks to ) that allows one to measure the length of a face or vertice.  But my first encounter with this tool gives me complex feelings of love and hate, see how, as I was trying to measure the aspect ratio of this TV screen, I am getting WIDTH = 20.33 and HEIGHT = 37.57.  These values seem awfully wrong, since my betrusted eyes tell me the height should be shorter than the width.    I have tried measuring the single vertices as well, to identical results. How can I easily encrypt a file? Is there any simple (IE: right click in Nautilus) way to password protect a particular folder/file in Ubuntu? I've got a few files containing sensitive info and I'd much prefer that if/when I leave my computer alone, they aren't accidentally accessed by someone else.  The secruty does not have to be extremely tight. My only concern is that when family/friends come over, I don't really like the idea of them looking at my bank details, accounts or, you guessed it, porn collection.  A simple, effective way to let me put my machine in the hands of someone else knowing that said machine can not cause me embarresment is the sole reason why I'd like to see this in Ubuntu. Are global variables thread-safe in Flask? How do I share data between requests? Can I Create a Dictionary of Generic Types? Why couldn't Harry see Thestrals at the end of Goblet of Fire? Why couldn't Harry see Thestrals at the end of Goblet of Fire after the senseless and shocking death of Cedric Diggory?   At the end of Goblet of Fire, the carriages still appeared horseless to Harry:     Hermione turned away, smiling at the horseless carriages which were now trundling towards them up the drive, as Krum, looking surprised, but gratified, signed a fragment of   parchment for Ron.   Goblet of Fire - Page 629 - British Hardcover - Adult Edition   At the beginning of Order of the Phoenix, Harry sees the Thestrals for the first time:     Here stood the hundred or so horseless stagecoaches that always took the students above first year up to the castle. Harry glanced quickly at them, turned away to keep a lookout for Ron and Hermione, then did a double-take.   The coaches were no longer horseless. There were creatures standing between the carriage shafts.   Order of the Phoenix - Page 178 - British Hardcover - Adult Edition   We know that only those who have seen death can see Thestrals:     ‘Don’ worry, it won’ hurt yeh,’ said Hagrid patiently. ‘Righ’, now, who can tell me why some o’ yeh can see ’em an’ some can’t?’   Hermione raised her hand.   ‘Go on then,’ said Hagrid, beaming at her.   ‘The only people who can see Thestrals,’ she said, ‘are people who have seen death.’   ‘Tha’s exactly right,’ said Hagrid solemnly [...]   Order of the Phoenix - Page 394 - British Hardcover - Adult Edition   A month went by between Cedric's death and the end of the spring term -- is this enough time for Harry to have truly internalized Cedric's death? Goblet of Fire indicates that Harry was in shock following Cedric's murder, but was able to relate the story of Cedric's death to Mr. and Mrs. Diggory.     When he looked back, even a month later, Harry found he had few memories of the following days. It was as though he had been through too much to take in any more. The recollections he did have were very painful. The worst, perhaps, was the meeting with the Diggorys that took place the following morning.   [...]   ‘He suffered very little, then,’ she said, when Harry had told her how Cedric had died.'   Goblet of Fire - Page 621 - British Hardcover - Adult Edition   So, then, why couldn't Harry see Thestrals at the end of Goblet of Fire? My overall upgrade went well, but I am left with a critically lingering issue of mysql-server not being able to install itself, and nothing I am trying gets it to work.  This is the error I see when trying to install/reinstall it:  Setting up mysql-server-5.7 (5.7.11-0ubuntu6) ... Job for mysql.service failed because the control process exited with error code. See "systemctl status mysql.service" and "journalctl -xe" for details. invoke-rc.d: initscript mysql, action "start" failed. dpkg: error processing package mysql-server-5.7 (--configure):  subprocess installed post-installation script returned error exit status 1 dpkg: dependency problems prevent configuration of mysql-server:  mysql-server depends on mysql-server-5.7; however:   Package mysql-server-5.7 is not configured yet.  dpkg: error processing package mysql-server (--configure):  dependency problems - leaving unconfigured No apport report written because the error message indicates its a followup error from a previous failure.                    Processing triggers for systemd (229-4ubuntu4) ... Processing triggers for ureadahead (0.100.0-19) ... Errors were encountered while processing:  mysql-server-5.7  mysql-server E: Sub-process /usr/bin/dpkg returned an error code (1)   I've tried completely removing it, though doing so attempts to install MariaDB because of dependencies (?). Any suggestions on what I can do to fix this would be most welcome.  EDIT: Looks like I'm not the only one: What is this "forbidden" icon in my systray? The following is a systray applet icon that appeared in my Unity session after I upgraded to Ubuntu 16.10. Its menu is tall, narrow and empty. What is it? How to fill a rectangular hole with an even amount of vertices on either side? I tried crating faces but it left missing edges. In the end I was left with all the right lines but there was no vertex in the center.    Here's a follow up image in case you're wondering what I mean. Notice how there's no vertex in the center. I understand that the vibration modes of an elementary string determines the identity of its particle. When I first heard this, I visualized a stiff circular steel band-like entity vibrating with 2, 3, 4, 5,... nodes or antinodes, the number determining the particle. This was further supported when I asked a well-known physicist how one gets from equations to physical strings, and he said he recognized the harmonic nature of the solutions.  Bu then I noticed that physicists seem to accept the image of a soft spaghetti-like string flopping about with no well-defined vibrational modes. I asked another physicist about this, and his answer was simply that a string has multiple modes, not necessarily in a harmonic progression.  So my questions are 1) How do you visualize the vibrations of a string, and 2) how are they related to particle identity? I'll be generous and say it might be reasonable to assume that nature would tend to minimize, or maybe even maximize, the integral over time of $T-V$.  Okay, fine.  You write down the action functional, require that it be a minimum (or maximum), and arrive at the Euler-Lagrange equations.  Great.  But now you want these Euler-Lagrange equations to not just be derivable from the Principle of Least Action, but you want it to be equivalent to the Principle of Least Action.  After thinking about it for awhile, you realize that this implies that the Principle of Least Action isn't really the Principle of Least Action at all:  it's the "Principle of Stationary Action".  Maybe this is just me, but as generous as I may be, I will not grant you that it is "natural" to assume that nature tends to choose the path that is stationary point of the action functional.  Not to mention, it isn't even obvious that there is such a path, or if there is one, that it is unique.  But the problems don't stop there.  Even if you grant the "Principle of Stationary Action" as fundamentally and universally true, you realize that not all the equations of motions that you would like to have are derivable from this if you restrict yourself to a Lagrangian of the form $T-V$.  As far as I can tell, from here it's a matter of playing around until you get a Lagrangian that produces the equations of motion you want.  From my (perhaps naive point of view), there is nothing at all particularly natural (although I will admit, it is quite useful) about the formulation of classical mechanics this way.  Of course, this wouldn't be such a big deal if these classical ideas stayed with the classical physics, but these ideas are absolutely fundamental to how we think about things as modern as quantum field theory.  Could someone please convince me that there is something natural about the choice of the Lagrangian formulation of classical mechanics (I don't mean in comparison with the Hamiltonian formulation; I mean period), and in fact, that it is so natural that we would not even dare abandon these ideas? It would be nice if backticked code in question titles were rendered the same way they are in question bodies. Since there are so many questions with code in them I feel it would be a big plus. .  This would look a lot nicer in listings and on the page itself if the code strings were rendered as such.  Similar ideas discussed . Creating controls within a Loop I have have some code which adds new cells to a table and fills them with text boxes.   The way I've coded it so far works fine:          TableCell tCell1 = new TableCell();         TableCell tCell2 = new TableCell();         TableCell tCell3 = new TableCell();         TableCell tCell4 = new TableCell();         TableCell tCell5 = new TableCell();         TableCell tCell6 = new TableCell();         TableCell tCell7 = new TableCell();          TextBox txt1 = new TextBox();         TextBox txt2 = new TextBox();         TextBox txt3 = new TextBox();         TextBox txt4 = new TextBox();         TextBox txt5 = new TextBox();         TextBox txt6 = new TextBox();         TextBox txt7 = new TextBox();          tCell1.Controls.Add(txt1);         tCell2.Controls.Add(txt2);         tCell3.Controls.Add(txt3);         tCell4.Controls.Add(txt4);         tCell5.Controls.Add(txt5);         tCell6.Controls.Add(txt6);         tCell7.Controls.Add(txt7);          tRow.Cells.Add(tCell1);         tRow.Cells.Add(tCell2);         tRow.Cells.Add(tCell3);         tRow.Cells.Add(tCell4);         tRow.Cells.Add(tCell5);         tRow.Cells.Add(tCell6);         tRow.Cells.Add(tCell7);   As you can see there's basically 4 instructions getting repeated 7 times. I'm sure there has to be a way to accomplish this with just 4 lines of code within a FOR loop and having all the names dynamically assigned but I just can't seem to find anything that would point me in the direction of how to do it.  Something like the following is what I'm after:      for (int i = 0; i &lt; 6; i++)     {          TableCell tCell[i] = new TableCell();         TextBox txt[i] = new TextBox();         tCell[i].Controls.Add(txt[i]);         tRow.Cells.Add(tCell[i]);      }    Any help would be much appreciated. How do I rename a directory via the command line? I have got the directory /home/user/oldname and I want to rename it to /home/user/newname. How can I do this in a terminal? Say I have a Zombie token, , and  on the battlefield. Can I sacrifice the Zombie token to activate both the Altar's and Seer's abilities?  Similarly, if I have one card in hand, and  and  on the battlefield can I discard the one card to both of their abilities?  If I have a  with 3 charge counters can I activate both of its abilities by tapping it to add a counter, and tapping it to remove 3 counters and destroy a permanent without untapping it in between? adding hours in date time format java