Jekyll2023-07-07T14:24:01+00:00https://leofang.github.io/feed.xmlYao-Lung L. FangLeo Fang's personal websiteVersion control using Git2016-05-08T14:50:19+00:002016-05-08T14:50:19+00:00https://leofang.github.io/2016/05/08/version-control-using-git<p>(Last updated: May 12, 2016)</p>
<hr />
This note was written for our group as a <a href="https://en.wikipedia.org/wiki/Minimal_Working_Example" target="_blank">minimal working example</a> for collaborative writing using LaTeX and Git, and I'll keep updating this note. Below I show a step-by-step instruction to do version control using Git on the command line. The workflow is specifically designed for writing in LaTeX. Everything is tested on Mac with Git ver.2.3.2, so users of earlier versions should be careful. Please leave me a comment if you spot any mistake :)</p>
<p>Here's a list of steps (hyperlinked):<br />
<a href="#step1">1. One-time-only setting</a><br />
<a href="#step2">2. Clone an existing repository to local end</a><br />
<a href="#step3">3. Change remote name</a><br />
<a href="#step4">4. Push (pull) progress to (from) remote repository</a><br />
<a href="#step5">5. Check the change log</a><br />
<a href="#step6">6. Compare the difference between versions</a><br />
<a href="#step7">7. Using a master BibTeX file as a Git submodule</a><br />
<a href="#step8">8. Combining latexdiff and Git</a></p>
<p>****************************************<br />
<!--more Read more--><br />
<a name="step1" id="step1"><strong>1. One-time-only setting.</strong></a><br />
Every time someone makes a change in the files, Git would record the submitter's name and email. Therefore, it's necessary to identify oneself in a collaboration work. Below shows how to set up a global Git config ("global" in the sense that every Git project you create on your laptop will use the same config):</p>
<p>[code gutter="false" language="bash"]<br />
$ git config --global user.name "John Doe"<br />
$ git config --global user.email johndoe@example.com<br />
[/code]</p>
<p>This command lets you specify the default editor which will be used in <span style="background-color:#EEE9E9"><code>git commit</code></span>:</p>
<p>[code gutter="false" language="bash"]<br />
$ git config --global core.editor vim<br />
[/code]</p>
<p>For Mac users, one more action is necessary to automatically ignore the annoying <span style="background-color:#EEE9E9"><code>.DS_Store</code></span> file:</p>
<p>[code gutter="false" language="bash"]<br />
$ git config --global core.excludesfile ~/.gitignore<br />
$ echo .DS_Store > ~/.gitignore<br />
[/code]</p>
<p>After above steps, there should be two hidden files placed in the home directory: <span style="background-color:#EEE9E9"><code>.gitconfig</code></span> and <span style="background-color:#EEE9E9"><code>.gitignore</code></span>.</p>
<p><a name="step2"><strong>2. Clone an existing repository to local end.</strong></a><br />
After you collaborators write up something (a draft or a program) and push it to an online repository like GitHub or Overleaf, you'd like to clone it so that you can edit the files on your laptop. Assume you are in a working directory where you'd like to create a folder named <span style="background-color:#EEE9E9"><code>temp</code></span> to store the files, type</p>
<p>[code gutter="false" language="bash"]<br />
$ git clone http://git.example.org/123abc temp<br />
[/code]</p>
<p>Note that the above URL link should be replaced by the one pointing to your own Git project! Now you can <span style="background-color:#EEE9E9"><code>cd temp</code></span> and start working.</p>
<p><a name="step3"><strong>3. Change remote name</strong></a><br />
If you run <span style="background-color:#EEE9E9"><code>git status</code></span> in the <span style="background-color:#EEE9E9"><code>temp</code></span> folder, the output message should look like:<code>
<div style="background-color:#FFE4E1;padding:5px">On branch master<br />
Your branch is up-to-date with 'origin/master'.<br />
nothing to commit, working directory clean</div>
<p></code><br />
Apart from the branch concepts (in the beginning we only have one branch called master), the "origin" seems confusing. But it is just a name representing the remote host, and you can change it to anything you want to make it clear (effective locally). For example,</p>
<p>[code gutter="false" language="bash"]<br />
$ git remote rename origin overleaf<br />
[/code]</p>
<p>will replace <span style="background-color:#EEE9E9"><code>origin/master</code></span> by <span style="background-color:#EEE9E9"><code>overleaf/master</code></span>.</p>
<p><a name="step4"><strong>4. Push (pull) progress to (from) remote repository</strong></a><br />
Suppose you edit some files, you may want to ask Git to record this version. When you run <span style="background-color:#EEE9E9"><code>git status</code></span>, you'll see files that you've edited but not yet "staged" (meaning Git does not know which file to look at yet). If so, do <span style="background-color:#EEE9E9"><code>git add -u</code></span>, where the <span style="background-color:#EEE9E9"><code>-u</code></span> argument means including all updated files. Run <span style="background-color:#EEE9E9"><code>git status</code></span> again to check the modified files are staged.</p>
<p>But to put staged file into Git's record, we need to "commit" them. Run <span style="background-color:#EEE9E9"><code>git commit</code></span>, and an text editor you specified earlier will be opened to let you type information related to this change. Save it and it's done. Now this version is recorded in your local machine. (If the message you'd like to type is just one line, you can do this in command line by <span style="background-color:#EEE9E9"><code>git commit -m "This message will be logged"</code></span>.) Note that the two steps (<span style="background-color:#EEE9E9"><code>add</code></span> and <span style="background-color:#EEE9E9"><code>commit</code></span>) can be combined by <span style="background-color:#EEE9E9"><code>git commit -a</code></span> --- But use this carefully!</p>
<p>To sync the record between the local end and the remote repository, do</p>
<p>[code gutter="false" language="bash"]<br />
$ git push overleaf master<br />
[/code]</p>
<p>will upload the local master branch to "overleaf" (the name specified for the remote host). On the contrary, do</p>
<p>[code gutter="false" language="bash"]<br />
$ git pull overleaf master<br />
[/code]</p>
<p>will download the remote master branch on overleaf to local end. <strong>Caution:</strong> if you and your collaborators are working on the same branch (say you're writing a small-scale tex file on the master branch), it is highly recommended (see <a href="http://stackoverflow.com/questions/18930527/" target="_blank">here</a> and <a href="http://stackoverflow.com/questions/2472254/" target="_blank">here</a>) to use <span style="background-color:#EEE9E9"><code>git pull --rebase overleaf master</code></span> instead!</p>
<p>Two side notes: (i) <span style="background-color:#EEE9E9"><code>pull</code></span> is the combination of <span style="background-color:#EEE9E9"><code>fetch</code></span> and <span style="background-color:#EEE9E9"><code>merge</code></span>; (ii) <span style="background-color:#EEE9E9"><code>pull</code></span> and <span style="background-color:#EEE9E9"><code>checkout</code></span> are different. You use the latter to recover to earlier status when you mess up locally.</p>
<p><a name="step5"><strong>5. Check the change log</strong></a><br />
From the programmer point of view, the change log is extremely important as an essential ingredient of version control. To see the log, type <span style="background-color:#EEE9E9"><code>git log</code></span>. You will see a list of commit history in the following format:<br />
<code>
<div style="background-color:#FFE4E1">
commit 2277e9415a77ad89b142154a3a1b04be5730924b<br />
Author: John Doe <johndoe@example.com><br />
Date: Tue May 10 19:35:35 2016 -0400</div>
<p></code><br />
Each of these is called a revision with a 40-character identifier. But in practice, the first 6 characters are enough to identify a revision (in this case it's <span style="background-color:#EEE9E9"><code>2277e9</code></span>).</p>
<p><a name="step6"><strong>6. Compare the difference between versions</strong></a><br />
See the instruction in the "Exploring History" section <a href="http://swc-osg-workshop.github.io/2015-10-27-duke/novice/git/01-backup.html" target="_blank">here</a>. The key idea is to use the 6-character identifiers to do comparisons between revisions.</p>
<p><a name="step7"><strong>7. Using a master BibTeX file as a Git submodule</strong></a><br />
This step closely follows <a href="http://andrius.velykis.lt/2012/06/master-bibtex-file-git-submodules/" target="_blank">the blog by Andrius Velykis</a>, and the main reason of doing this is <em>to keep one and only one bib file up-to-date without forgetting where it is stored</em>.</p>
<p>Suppose your collaborator or you maintains a bib file on a repository, named <span style="background-color:#EEE9E9"><code>RefBib</code></span> for instance, and you'd like to use it in your tex file. Three scenarios: (i) you just initiated a Git project for writing in LaTeX: in this case, simply run</p>
<p>[code gutter="false" language="bash"]<br />
$ git submodule add git://example.org/user/RefBib<br />
[/code]</p>
<p>to add that bib file as a submodule to your Git project, where the URL points to the repository of <span style="background-color:#EEE9E9"><code>RefBib</code></span>; </p>
<p>(ii) your local repository is out-of-date (without any submodule), and the remote repository is up-to-date (with a submodule recently added): in this case, first pull the latest revision as usual,</p>
<p>[code gutter="false" language="bash"]<br />
$ git pull overleaf master<br />
[/code]</p>
<p>and you may be prompted to input some message regarding this merge (<span style="background-color:#EEE9E9"><code>pull</code></span> involves a <span style="background-color:#EEE9E9"><code>merge</code></span>, remember?). The problem is after pulling the subdirectory of the module (see the discussion below) is empty, and a few more actions are required to make it work:</p>
<p>[code gutter="false" language="bash"]<br />
$ git submodule update --init<br />
$ cd RefBib<br />
$ git checkout master<br />
[/code]</p>
<p>Note that in the second step we need to go to the subdirectory for a reason explained below; </p>
<p>(iii) you have not created the Git project yet and would like to clone from an existing one: this case is like starting from Step 2 above. The only difference is that here the submodule <span style="background-color:#EEE9E9"><code>RefBib</code></span> is assumed existing in the project. Run</p>
<p>[code gutter="false" language="bash"]<br />
$ git clone --recursive http://git.example.org/123abc temp<br />
[/code]</p>
<p>and Git will first pull down the main project, then pull down the submodule (thanks to the <span style="background-color:#EEE9E9"><code>--recursive</code></span> argument), and merge them automatically. </p>
<p>Anyway, after doing so, run <span style="background-color:#EEE9E9"><code>ls -al</code></span> and you'll see inside <span style="background-color:#EEE9E9"><code>temp</code></span> there is a folder named <span style="background-color:#EEE9E9"><code>RefBib</code></span>, which stores the bib file, and a hidden file <span style="background-color:#EEE9E9"><code>.gitmodules</code></span>; both of them should be kept track by Git. Now you can include the bib file as you normally do in your tex file. </p>
<p>Git submodules are sometimes confusing, and there are some subtleties I'd really like to skip here, but basically the key idea is that you should regard <span style="background-color:#EEE9E9"><code>temp</code></span> and <span style="background-color:#EEE9E9"><code>RefBib</code></span> as two different Git projects, each has its own Git version history. </p>
<p>Therefore, if you modify the bib file in <span style="background-color:#EEE9E9"><code>RefBib</code></span>, you should remember to go to the <span style="background-color:#EEE9E9"><code>RefBib</code></span> directory, commit the change, and push it to the remote repository of <span style="background-color:#EEE9E9"><code>RefBib</code></span> so that the status can be synced between your local copy and the remote one. On the other hand, in the main branch <span style="background-color:#EEE9E9"><code>temp</code></span> Git simply notes in <span style="background-color:#EEE9E9"><code>.gitmodules</code></span> that there's a submodule <span style="background-color:#EEE9E9"><code>RefBib</code></span> (pointing to a specific revision!) but does not store the content of it. An alternative of getting around these steps is to run</p>
<p>[code gutter="false" language="bash"]<br />
$ git push --recurse-submodules=on-demand<br />
[/code]</p>
<p>so that both the main project and the submodule will be pushed to their corresponding repositories.</p>
<p>Similarly, if you'd like to update your local submodule to the latest version on remote, you can either go to the subdirectory and pull as usual (because it's a separate project), or stay in the parent directory and run</p>
<p>[code gutter="false" language="bash"]<br />
$ git submodule update --remote<br />
[/code]</p>
<p>Either way would work. For further details of submodule, see <a href="https://git-scm.com/book/en/v2/Git-Tools-Submodules" target="_blank">here</a>.</p>
<p><a name="step8"><strong>8. Combining latexdiff and Git</strong></a><br />
LaTeX users probably know a convenient Perl script called <span style="background-color:#EEE9E9"><code>latexdiff</code></span> which marks up differences between two tex files. For version control systems such as Git, it has a counterpart called <span style="background-color:#EEE9E9"><code>latexdiff-vc</code></span>, which should already be installed along with <span style="background-color:#EEE9E9"><code>latexdiff</code></span>. The syntax is equally simple. Suppose you'd like to compare the current version of <span style="background-color:#EEE9E9"><code>example.tex</code></span> with that of a particular revision (assuming its 6-character identifier is <span style="background-color:#EEE9E9"><code>2277e9</code></span>), run</p>
<p>[code gutter="false" language="bash"]<br />
$ latexdiff-vc --git -r 2277e9 example.tex<br />
[/code]</p>
<p>and <span style="background-color:#EEE9E9"><code>latexdiff-vc</code></span> will create a compared tex file for you, just like what <span style="background-color:#EEE9E9"><code>latexdiff</code></span> does. The argument <span style="background-color:#EEE9E9"><code>--git</code></span> tells <span style="background-color:#EEE9E9"><code>latexdiff-vc</code></span> that the version control system is Git, and <span style="background-color:#EEE9E9"><code>-r 2277e9</code></span> specifies which revision to look at. For more sophisticated uses, see <a href="http://mirror.its.dal.ca/ctan/support/latexdiff/doc/latexdiff-man.pdf" target="_blank">the latexdiff manual</a>. </p>
<p>****************************************</p>
<p>I think these is the basics on Git. I've skipped things like branches (how to create one, to switch between them, to merge them, etc) and handling conflicts, but you can easily find instructions online. Here's a short list I found useful:<br />
<a href="https://git-scm.com/book/en/v2" target="_blank">The Pro Git ebook</a><br />
<a href="http://swc-osg-workshop.github.io/2015-10-27-duke/novice/git/index.html" target="_blank">Duke-OSG Workshop material</a><br />
<a href="https://ineed.coffee/3454/how-to-synchronize-an-overleaf-latex-paper-with-a-github-repository/" target="_blank">How to synchronize an Overleaf LaTeX paper with a GitHub repository</a><br />
<a href="http://ftb.rgaiacs.com/2015/02/07/git_and_overleaf.html" target="_blank">Git and Overleaf</a></p>
<div id="disqus_thread"></div>
<script>
/**
* RECOMMENDED CONFIGURATION VARIABLES: EDIT AND UNCOMMENT THE SECTION BELOW TO INSERT DYNAMIC VALUES FROM YOUR PLATFORM OR CMS.
* LEARN WHY DEFINING THESE VARIABLES IS IMPORTANT: https://disqus.com/admin/universalcode/#configuration-variables*/
/*
var disqus_config = function () {
this.page.url = PAGE_URL; // Replace PAGE_URL with your page's canonical URL variable
this.page.identifier = PAGE_IDENTIFIER; // Replace PAGE_IDENTIFIER with your page's unique identifier variable
};
*/
(function() { // DON'T EDIT BELOW THIS LINE
var d = document, s = d.createElement('script');
s.src = 'https://leofang.disqus.com/embed.js';
s.setAttribute('data-timestamp', +new Date());
(d.head || d.body).appendChild(s);
})();
</script>
<noscript>Please enable JavaScript to view the <a href="https://disqus.com/?ref_noscript">comments powered by Disqus.</a></noscript>{"login"=>"yf30@duke.edu", "email"=>"yao.lung.fang@duke.edu", "display_name"=>"Leo Fang", "first_name"=>"Yao-Lung", "last_name"=>"Fang"}yao.lung.fang@duke.edu(Last updated: May 12, 2016) This note was written for our group as a minimal working example for collaborative writing using LaTeX and Git, and I'll keep updating this note. Below I show a step-by-step instruction to do version control using Git on the command line. The workflow is specifically designed for writing in LaTeX. Everything is tested on Mac with Git ver.2.3.2, so users of earlier versions should be careful. Please leave me a comment if you spot any mistake :) Here's a list of steps (hyperlinked): 1. One-time-only setting 2. Clone an existing repository to local end 3. Change remote name 4. Push (pull) progress to (from) remote repository 5. Check the change log 6. Compare the difference between versions 7. Using a master BibTeX file as a Git submodule 8. Combining latexdiff and Git **************************************** 1. One-time-only setting. Every time someone makes a change in the files, Git would record the submitter's name and email. Therefore, it's necessary to identify oneself in a collaboration work. Below shows how to set up a global Git config ("global" in the sense that every Git project you create on your laptop will use the same config): [code gutter="false" language="bash"] $ git config --global user.name "John Doe" $ git config --global user.email johndoe@example.com [/code] This command lets you specify the default editor which will be used in git commit: [code gutter="false" language="bash"] $ git config --global core.editor vim [/code] For Mac users, one more action is necessary to automatically ignore the annoying .DS_Store file: [code gutter="false" language="bash"] $ git config --global core.excludesfile ~/.gitignore $ echo .DS_Store > ~/.gitignore [/code] After above steps, there should be two hidden files placed in the home directory: .gitconfig and .gitignore. 2. Clone an existing repository to local end. After you collaborators write up something (a draft or a program) and push it to an online repository like GitHub or Overleaf, you'd like to clone it so that you can edit the files on your laptop. Assume you are in a working directory where you'd like to create a folder named temp to store the files, type [code gutter="false" language="bash"] $ git clone http://git.example.org/123abc temp [/code] Note that the above URL link should be replaced by the one pointing to your own Git project! Now you can cd temp and start working. 3. Change remote name If you run git status in the temp folder, the output message should look like: On branch master Your branch is up-to-date with 'origin/master'. nothing to commit, working directory clean Apart from the branch concepts (in the beginning we only have one branch called master), the "origin" seems confusing. But it is just a name representing the remote host, and you can change it to anything you want to make it clear (effective locally). For example, [code gutter="false" language="bash"] $ git remote rename origin overleaf [/code] will replace origin/master by overleaf/master. 4. Push (pull) progress to (from) remote repository Suppose you edit some files, you may want to ask Git to record this version. When you run git status, you'll see files that you've edited but not yet "staged" (meaning Git does not know which file to look at yet). If so, do git add -u, where the -u argument means including all updated files. Run git status again to check the modified files are staged. But to put staged file into Git's record, we need to "commit" them. Run git commit, and an text editor you specified earlier will be opened to let you type information related to this change. Save it and it's done. Now this version is recorded in your local machine. (If the message you'd like to type is just one line, you can do this in command line by git commit -m "This message will be logged".) Note that the two steps (add and commit) can be combined by git commit -a --- But use this carefully! To sync the record between the local end and the remote repository, do [code gutter="false" language="bash"] $ git push overleaf master [/code] will upload the local master branch to "overleaf" (the name specified for the remote host). On the contrary, do [code gutter="false" language="bash"] $ git pull overleaf master [/code] will download the remote master branch on overleaf to local end. Caution: if you and your collaborators are working on the same branch (say you're writing a small-scale tex file on the master branch), it is highly recommended (see here and here) to use git pull --rebase overleaf master instead! Two side notes: (i) pull is the combination of fetch and merge; (ii) pull and checkout are different. You use the latter to recover to earlier status when you mess up locally. 5. Check the change log From the programmer point of view, the change log is extremely important as an essential ingredient of version control. To see the log, type git log. You will see a list of commit history in the following format: commit 2277e9415a77ad89b142154a3a1b04be5730924b Author: John Doe <johndoe@example.com> Date: Tue May 10 19:35:35 2016 -0400 Each of these is called a revision with a 40-character identifier. But in practice, the first 6 characters are enough to identify a revision (in this case it's 2277e9). 6. Compare the difference between versions See the instruction in the "Exploring History" section here. The key idea is to use the 6-character identifiers to do comparisons between revisions. 7. Using a master BibTeX file as a Git submodule This step closely follows the blog by Andrius Velykis, and the main reason of doing this is to keep one and only one bib file up-to-date without forgetting where it is stored. Suppose your collaborator or you maintains a bib file on a repository, named RefBib for instance, and you'd like to use it in your tex file. Three scenarios: (i) you just initiated a Git project for writing in LaTeX: in this case, simply run [code gutter="false" language="bash"] $ git submodule add git://example.org/user/RefBib [/code] to add that bib file as a submodule to your Git project, where the URL points to the repository of RefBib; (ii) your local repository is out-of-date (without any submodule), and the remote repository is up-to-date (with a submodule recently added): in this case, first pull the latest revision as usual, [code gutter="false" language="bash"] $ git pull overleaf master [/code] and you may be prompted to input some message regarding this merge (pull involves a merge, remember?). The problem is after pulling the subdirectory of the module (see the discussion below) is empty, and a few more actions are required to make it work: [code gutter="false" language="bash"] $ git submodule update --init $ cd RefBib $ git checkout master [/code] Note that in the second step we need to go to the subdirectory for a reason explained below; (iii) you have not created the Git project yet and would like to clone from an existing one: this case is like starting from Step 2 above. The only difference is that here the submodule RefBib is assumed existing in the project. Run [code gutter="false" language="bash"] $ git clone --recursive http://git.example.org/123abc temp [/code] and Git will first pull down the main project, then pull down the submodule (thanks to the --recursive argument), and merge them automatically. Anyway, after doing so, run ls -al and you'll see inside temp there is a folder named RefBib, which stores the bib file, and a hidden file .gitmodules; both of them should be kept track by Git. Now you can include the bib file as you normally do in your tex file. Git submodules are sometimes confusing, and there are some subtleties I'd really like to skip here, but basically the key idea is that you should regard temp and RefBib as two different Git projects, each has its own Git version history. Therefore, if you modify the bib file in RefBib, you should remember to go to the RefBib directory, commit the change, and push it to the remote repository of RefBib so that the status can be synced between your local copy and the remote one. On the other hand, in the main branch temp Git simply notes in .gitmodules that there's a submodule RefBib (pointing to a specific revision!) but does not store the content of it. An alternative of getting around these steps is to run [code gutter="false" language="bash"] $ git push --recurse-submodules=on-demand [/code] so that both the main project and the submodule will be pushed to their corresponding repositories. Similarly, if you'd like to update your local submodule to the latest version on remote, you can either go to the subdirectory and pull as usual (because it's a separate project), or stay in the parent directory and run [code gutter="false" language="bash"] $ git submodule update --remote [/code] Either way would work. For further details of submodule, see here. 8. Combining latexdiff and Git LaTeX users probably know a convenient Perl script called latexdiff which marks up differences between two tex files. For version control systems such as Git, it has a counterpart called latexdiff-vc, which should already be installed along with latexdiff. The syntax is equally simple. Suppose you'd like to compare the current version of example.tex with that of a particular revision (assuming its 6-character identifier is 2277e9), run [code gutter="false" language="bash"] $ latexdiff-vc --git -r 2277e9 example.tex [/code] and latexdiff-vc will create a compared tex file for you, just like what latexdiff does. The argument --git tells latexdiff-vc that the version control system is Git, and -r 2277e9 specifies which revision to look at. For more sophisticated uses, see the latexdiff manual. **************************************** I think these is the basics on Git. I've skipped things like branches (how to create one, to switch between them, to merge them, etc) and handling conflicts, but you can easily find instructions online. Here's a short list I found useful: The Pro Git ebook Duke-OSG Workshop material How to synchronize an Overleaf LaTeX paper with a GitHub repository Git and OverleafInstall IPython based on built-in Python on Mac OS X2015-05-31T17:52:02+00:002015-05-31T17:52:02+00:00https://leofang.github.io/2015/05/31/install-ipython-based-on-built-in-python-on-mac-os-x<p>(Last updated on May 8, 2016: syntax highlight added)</p>
<hr />
The Python distribution that comes with Mac OS X is notorious in that it is not easy to update or install modules, and that there is often a dependency issue for applications not preinstalled. Therefore, for OS X users it's usually recommended that using package managers such as <a href="https://www.macports.org" target="_blank">MacPorts</a> and <a href="http://brew.sh" target="_blank">Homebrew</a> instead, installing Python therein, and avoiding using the system Python. A better solution for novices is to install an independent Python distribution, including <a href="https://store.continuum.io/cshop/anaconda/" target="_blank">Anaconda</a> and <a href="https://www.enthought.com/products/canopy/" target="_blank">Enthought</a>.</p>
<p>While most of solutions are available for free, it seems a bit redundant to me to have multiple copies of Python. Sometimes I was confused which Python I was using. Therefore, after a clean installation I decided to test how much the system Python can do. The example I chose is to install a module called IPython which is not preinstalled on OS X and provides a graphical notebook interface similar to Mathematica. The procedure below has been tested on Mac OS X 10.10.3.<!--more Read more--></p>
<p>After some trial and error I realized that it is impossible to install it with the <span style="background-color:#EEE9E9"><code>easy_install</code></span> command. But <span style="background-color:#EEE9E9"><code>pip</code></span>, however, can be installed by <span style="background-color:#EEE9E9"><code>easy_install</code></span>. Therefore, one can do<br />
[code gutter="false" language="bash"]<br />
sudo easy_install pip<br />
sudo pip install ipython[all]<br />
[/code]<br />
We need <span style="background-color:#EEE9E9"><code>sudo</code></span> because the packages are installed in the system folder which only the root can access. The <span style="background-color:#EEE9E9"><code>[all]</code></span> tag in the second line tells <span style="background-color:#EEE9E9"><code>pip</code></span> to install everything that IPython may depend on. After installation one should be able to execute <span style="background-color:#EEE9E9"><code>ipython</code></span> in the command line. For a graphical interface, run <span style="background-color:#EEE9E9"><code>ipython notebook</code></span> instead.</p>
<p>Some users may run into a problem in which the zmq module is missing (see <a href="https://github.com/zeromq/pyzmq/issues/581" target="_blank">a related discussion</a>). A possible reason is that the zmq (or pyzmq) module has been previously installed by <span style="background-color:#EEE9E9"><code>easy_install</code></span>, whose egg version is incompatible with IPython (as of ver 3.1.0) and hence not recognized by IPython. The solution is to remove and re-install it using <span style="background-color:#EEE9E9"><code>pip</code></span>:<br />
[code gutter="false" language="bash"]<br />
sudo pip uninstall pyzmq<br />
sudo pip install pyzmq<br />
[/code]<br />
And one can test it by <span style="background-color:#EEE9E9"><code>import zmq</code></span> under the Python command line. It should work if the installation is successful.</p>
<p>One more thing: the <span style="background-color:#EEE9E9"><code>--pylab</code></span> flag in IPython has been deprecated (as of ver 3.1.0). One should instead execute <span style="background-color:#EEE9E9"><code>%pylab</code></span> in the notebook interface. If one wants the plots to be shown in the notebook interface rather than in a separated window, use <span style="background-color:#EEE9E9"><code>%pylab inline</code></span>.</p>{"login"=>"yf30@duke.edu", "email"=>"yao.lung.fang@duke.edu", "display_name"=>"Leo Fang", "first_name"=>"Yao-Lung", "last_name"=>"Fang"}yao.lung.fang@duke.edu(Last updated on May 8, 2016: syntax highlight added) The Python distribution that comes with Mac OS X is notorious in that it is not easy to update or install modules, and that there is often a dependency issue for applications not preinstalled. Therefore, for OS X users it's usually recommended that using package managers such as MacPorts and Homebrew instead, installing Python therein, and avoiding using the system Python. A better solution for novices is to install an independent Python distribution, including Anaconda and Enthought. While most of solutions are available for free, it seems a bit redundant to me to have multiple copies of Python. Sometimes I was confused which Python I was using. Therefore, after a clean installation I decided to test how much the system Python can do. The example I chose is to install a module called IPython which is not preinstalled on OS X and provides a graphical notebook interface similar to Mathematica. The procedure below has been tested on Mac OS X 10.10.3. After some trial and error I realized that it is impossible to install it with the easy_install command. But pip, however, can be installed by easy_install. Therefore, one can do [code gutter="false" language="bash"] sudo easy_install pip sudo pip install ipython[all] [/code] We need sudo because the packages are installed in the system folder which only the root can access. The [all] tag in the second line tells pip to install everything that IPython may depend on. After installation one should be able to execute ipython in the command line. For a graphical interface, run ipython notebook instead. Some users may run into a problem in which the zmq module is missing (see a related discussion). A possible reason is that the zmq (or pyzmq) module has been previously installed by easy_install, whose egg version is incompatible with IPython (as of ver 3.1.0) and hence not recognized by IPython. The solution is to remove and re-install it using pip: [code gutter="false" language="bash"] sudo pip uninstall pyzmq sudo pip install pyzmq [/code] And one can test it by import zmq under the Python command line. It should work if the installation is successful. One more thing: the --pylab flag in IPython has been deprecated (as of ver 3.1.0). One should instead execute %pylab in the notebook interface. If one wants the plots to be shown in the notebook interface rather than in a separated window, use %pylab inline.Install the cyberbit font on Mac with MacTeX/TeXLive 20142015-02-27T17:30:34+00:002015-02-27T17:30:34+00:00https://leofang.github.io/2015/02/27/install-the-cyberbit-font-on-mac-with-mactex-texlive-2014<p>(Last updated on May 15, 2016: syntax highlight added)</p>
<hr />
It is really annoying that APS requires to use the extremely user-unfriendly CJK package and the cyberbit font if one wants to add Chinese/Japanese/Korean names in the journal publication with the UTF-8 encoding. (We have XeTeX/XeLaTeX now, dude!) It took me a long time to figure out how to do this. Although the MacTeX 2015 will be coming out soon in a few months, I think it's still worth taking a note on how I did this successfully as an up-to-date reference.</p>
<p>This note is based on several good instructions I found online and I recommend readers to refer to them, including <a href="http://www.math.nus.edu.sg/aslaksen/cs/cjk.html" target="_blank">Helmer Aslaksen's webpage</a>, <a href="http://www.tug.org/pipermail/texhax/2004-January/001476.html" target="_blank">William Adam's mailing list post</a>, <a href="http://www.ece.uci.edu/~chou/unicode-tex.html" target="_blank">Pai Chou's webpage</a>, and <a href="https://tug.org/mactex/TeXLive2012+Changes.pdf" target="_blank">the official document of MacTeX on how to install fonts</a>. My quick note aims to give an update on where one should put the relevant files specifically for MacTeX 2014, so this is NOT a self-contained note! <!--more Read more--></p>
<ol>
<li>First of all, the link to the cyberbit font (cyberbit.zip) on various posts are dead. I found it can be downloaded <a href="http://www.fonts2u.com/bitstream-cyberbit.font" target="_blank">here</a> or <a href="http://ftp.netscape.com/pub/communicator/extras/fonts/windows/" target="_blank">here</a> (thank you, Wikipedia!).</li>
<li>The UCS package is not needed and the CJK package is preinstalled with the TeXLive distribution, so let's move on.</li>
<li>After generating the .tfm and .enc files, I moved the former to a path I created: <span style="background-color:#EEE9E9"><code>/usr/local/texlive/texmf-local/fonts/tfm/local/cyberbit</code></span>, and move the latter to <span style="background-color:#EEE9E9"><code>/usr/local/texlive/texmf-local/fonts/enc/local/cyberbit</code></span>.</li>
<li>The map file (cyberbit.map) goes to <span style="background-color:#EEE9E9"><code>/usr/local/texlive/texmf-local/fonts/map/local/cyberbit</code></span>.</li>
<li>The things below are different: the file <span style="background-color:#EEE9E9"><code>c70cyberbit.fd</code></span> should be put in <span style="background-color:#EEE9E9"><code>/usr/local/texlive/2014/texmf-dist/tex/latex/cyberbit</code></span>, and the font file itself (cyberbit.ttf) should be in <span style="background-color:#EEE9E9"><code>/usr/local/texlive/2014/texmf-dist/fonts/truetype/cyberbit</code></span>.</li>
<li>One then adds a line <span style="background-color:#EEE9E9"><code>Map cyberbit.map</code></span> to <span style="background-color:#EEE9E9"><code>/usr/local/texlive/texmf-local/web2c/updmap.cfg</code></span> (or create the file if it doesn't exist).</li>
<li>Finally, execute <span style="background-color:#EEE9E9"><code>sudo -H mktexlsr</code></span> and then <span style="background-color:#EEE9E9"><code>sudo -H updmap-sys</code></span> to update the font maps used by LaTeX, and it's done! The way to call the cyberbit font in a tex file is, as usual, <span style="background-color:#EEE9E9"><code>\begin{CJK}{UTF8}{cyberbit}</code></span>.</li>
</ol>
<p>I hope this note could be helpful for readers who are asked to use the annoying CJK package with the UTF-8 encoding. Let me know if you meet any problem and I'll try to answer your question if I know how to. I may expand this note as a self-contained post one day, but probably not recently...</p>
<p>ps. I found an <a href="http://www.math.zju.edu.cn/ligangliu/latexforum/tex_cjk.htm" target="_blank">excellent explanation</a> on how CJK works, but it's written in simplified Chinese.</p>
<p>ps2. Although I could successfully include my Chinese name when compiling the tex file on my laptop, my tex file failed to pass APS's LaTeX compiler twice in a row during initial submission and resubmission. If you have a successful experience, please let me know how you managed. I appreciate it.</p>{"login"=>"yf30@duke.edu", "email"=>"yao.lung.fang@duke.edu", "display_name"=>"Leo Fang", "first_name"=>"Yao-Lung", "last_name"=>"Fang"}yao.lung.fang@duke.edu(Last updated on May 15, 2016: syntax highlight added) It is really annoying that APS requires to use the extremely user-unfriendly CJK package and the cyberbit font if one wants to add Chinese/Japanese/Korean names in the journal publication with the UTF-8 encoding. (We have XeTeX/XeLaTeX now, dude!) It took me a long time to figure out how to do this. Although the MacTeX 2015 will be coming out soon in a few months, I think it's still worth taking a note on how I did this successfully as an up-to-date reference. This note is based on several good instructions I found online and I recommend readers to refer to them, including Helmer Aslaksen's webpage, William Adam's mailing list post, Pai Chou's webpage, and the official document of MacTeX on how to install fonts. My quick note aims to give an update on where one should put the relevant files specifically for MacTeX 2014, so this is NOT a self-contained note! First of all, the link to the cyberbit font (cyberbit.zip) on various posts are dead. I found it can be downloaded here or here (thank you, Wikipedia!). The UCS package is not needed and the CJK package is preinstalled with the TeXLive distribution, so let's move on. After generating the .tfm and .enc files, I moved the former to a path I created: /usr/local/texlive/texmf-local/fonts/tfm/local/cyberbit, and move the latter to /usr/local/texlive/texmf-local/fonts/enc/local/cyberbit. The map file (cyberbit.map) goes to /usr/local/texlive/texmf-local/fonts/map/local/cyberbit. The things below are different: the file c70cyberbit.fd should be put in /usr/local/texlive/2014/texmf-dist/tex/latex/cyberbit, and the font file itself (cyberbit.ttf) should be in /usr/local/texlive/2014/texmf-dist/fonts/truetype/cyberbit. One then adds a line Map cyberbit.map to /usr/local/texlive/texmf-local/web2c/updmap.cfg (or create the file if it doesn't exist). Finally, execute sudo -H mktexlsr and then sudo -H updmap-sys to update the font maps used by LaTeX, and it's done! The way to call the cyberbit font in a tex file is, as usual, \begin{CJK}{UTF8}{cyberbit}. I hope this note could be helpful for readers who are asked to use the annoying CJK package with the UTF-8 encoding. Let me know if you meet any problem and I'll try to answer your question if I know how to. I may expand this note as a self-contained post one day, but probably not recently... ps. I found an excellent explanation on how CJK works, but it's written in simplified Chinese. ps2. Although I could successfully include my Chinese name when compiling the tex file on my laptop, my tex file failed to pass APS's LaTeX compiler twice in a row during initial submission and resubmission. If you have a successful experience, please let me know how you managed. I appreciate it.Lara Fabian - Je suis malade2015-01-17T20:21:49+00:002015-01-17T20:21:49+00:00https://leofang.github.io/2015/01/17/lara-fabian-je-suis-malade<p>身為一個愛唱歌的死研究生,我常常藉由上網聽音樂來逃避研究做不出來、文章寫不出來的壓力 XD 我有個嗜好特別奇怪,就是我喜歡聽同一首歌曲給不同歌手演繹的版本,聽聽每個人唱這首歌的風格和唱法是什麼,然後把這些版本搜集起來,無聊時一口氣放完。有人可能會問我整個播放清單都是同一首歌,難道聽下來不會膩嗎?其實我覺得好像不太會,因為每個人唱的味道都不同,有時候根本可以當成不同的歌來聽,除非聽到一個不敬業的歌手只會模仿原唱而沒有自己的風格,不然要聽膩也蠻困難的。 <!--more Read more--></p>
<p>[caption id="attachment_133" align="alignleft" width="300"]<img class="wp-image-133 size-full" src="/assets/Lara_Fabian-Lara_Fabian.jpg" alt="" width="300" height="298" /> Lara Fabian (from Wiki)[/caption]</p>
<p>歌手 Lara Fabian 加上法文歌 Je suis malade 就是我很愛的組合。我是最近才知道有 Lara 這位歌手,但聽了她幾首歌立刻就迷上她了。查了一下發現她大紅的時間點跟 Celine Dion 差不多 (90年代左右,他們還參加了<a href="http://en.wikipedia.org/wiki/Eurovision_Song_Contest_1988" target="_blank">同一屆的歐洲歌唱大賽</a>),而且跟 Celine Dion 也很像,首先她們都是能唱多國語言的女歌手,其次是我發現 Lara 的音域廣度跟 Celine 有得拼,而且歌曲風格也蠻多元的。Je suis malade 是她第二張專輯收錄的歌,雖然 Lara 並不是原唱 (原唱應該是 <a href="http://en.wikipedia.org/wiki/Dalida" target="_blank">Dalida</a> 在1973年唱的),但應該可以算是她的代表曲。她在早期唱這首歌的唱法跟近期的版本差異相當大,可以聽到同一個歌手唱同一首歌如何隨著年紀增長而改變風格。Je suis malade 翻成英文意思是 I am sick (我生病了),網路上有<a href="http://lyricstranslate.com/en/Je-suis-malade-Im-sick.html" target="_blank">英文歌詞</a>可以看,大部分會看我 blog 的人應該都不會說法文 (我也不會),所以聽這首歌時我建議注意力放在 Lara 如何用飽滿的情緒撐起她的聲音,跟一般流行歌手不同,她的聲音是相當有表情的!以下我列出幾個 Youtube 上找得到的版本讓各位比較看看。</p>
<p>這應該是我能找到網路上最早期的演出,是我突然想聽這首歌的時候會第一個開來聽的版本。仔細聽她進副歌前如何「唸」歌詞唸出一種心理壓力很大、神經衰弱的感覺 (然後如何搖頭晃腦 XD)。</p>
<p>httpvh://www.youtube.com/watch?v=uGthVEza97U</p>
<p>查了一下似乎是 2003 的表演。不知道為什麼她在這個版本看起來特別傷心。最後的清唱很驚人。</p>
<p>httpvh://www.youtube.com/watch?v=dPOI7TRFdAY</p>
<p>這應該是較近期 (2010 後,詳細時間不確定) 的演出,風格看起來更像是一個生了重病的人在呻吟。在最後的副歌把麥克風拿得遠遠的,在這麼寬廣的音樂廳還能唱得這麼有力,真的很厲害。</p>
<p>httpvh://www.youtube.com/watch?v=DjLEVtm00-0</p>
<p>同場加映</p>
<p>另外一些較近期的演出版本</p>
<p>httpvh://www.youtube.com/watch?v=DTt5TQRawPs</p>
<p>httpvh://www.youtube.com/watch?v=snWD2yXzu-I</p>
<p>Lara跟小孩子合唱</p>
<p>httpvh://www.youtube.com/watch?v=2FckQePrlXM</p>
<p>Daniel Lévi 唱給台下的 Lara 聽</p>
<p>httpvh://www.youtube.com/watch?v=lqqUcw4LgBA</p>
<p>Serge Lama (作詞者) 的版本,其實我沒有特別喜歡他的版本,不過也是另一種截然不同的風格</p>
<p>httpvh://www.youtube.com/watch?v=isCJAxWtreY</p>
<p>Serge 和 Lara 對唱 (不愛 XD)</p>
<p>httpvh://www.youtube.com/watch?v=9pfX31PILJw</p>
<p><strong>Update:</strong></p>
<p>For Lara fans: 我找到Youtube上有人上傳完整版的節目。上面介紹的最早期的Je suis malade就是在這節目上唱的!</p>
<p>https://www.youtube.com/watch?v=tfTqWCdI6kE</p>{"login"=>"yf30@duke.edu", "email"=>"yao.lung.fang@duke.edu", "display_name"=>"Leo Fang", "first_name"=>"Yao-Lung", "last_name"=>"Fang"}yao.lung.fang@duke.edu身為一個愛唱歌的死研究生,我常常藉由上網聽音樂來逃避研究做不出來、文章寫不出來的壓力 XD 我有個嗜好特別奇怪,就是我喜歡聽同一首歌曲給不同歌手演繹的版本,聽聽每個人唱這首歌的風格和唱法是什麼,然後把這些版本搜集起來,無聊時一口氣放完。有人可能會問我整個播放清單都是同一首歌,難道聽下來不會膩嗎?其實我覺得好像不太會,因為每個人唱的味道都不同,有時候根本可以當成不同的歌來聽,除非聽到一個不敬業的歌手只會模仿原唱而沒有自己的風格,不然要聽膩也蠻困難的。 [caption id="attachment_133" align="alignleft" width="300"] Lara Fabian (from Wiki)[/caption] 歌手 Lara Fabian 加上法文歌 Je suis malade 就是我很愛的組合。我是最近才知道有 Lara 這位歌手,但聽了她幾首歌立刻就迷上她了。查了一下發現她大紅的時間點跟 Celine Dion 差不多 (90年代左右,他們還參加了同一屆的歐洲歌唱大賽),而且跟 Celine Dion 也很像,首先她們都是能唱多國語言的女歌手,其次是我發現 Lara 的音域廣度跟 Celine 有得拼,而且歌曲風格也蠻多元的。Je suis malade 是她第二張專輯收錄的歌,雖然 Lara 並不是原唱 (原唱應該是 Dalida 在1973年唱的),但應該可以算是她的代表曲。她在早期唱這首歌的唱法跟近期的版本差異相當大,可以聽到同一個歌手唱同一首歌如何隨著年紀增長而改變風格。Je suis malade 翻成英文意思是 I am sick (我生病了),網路上有英文歌詞可以看,大部分會看我 blog 的人應該都不會說法文 (我也不會),所以聽這首歌時我建議注意力放在 Lara 如何用飽滿的情緒撐起她的聲音,跟一般流行歌手不同,她的聲音是相當有表情的!以下我列出幾個 Youtube 上找得到的版本讓各位比較看看。 這應該是我能找到網路上最早期的演出,是我突然想聽這首歌的時候會第一個開來聽的版本。仔細聽她進副歌前如何「唸」歌詞唸出一種心理壓力很大、神經衰弱的感覺 (然後如何搖頭晃腦 XD)。 httpvh://www.youtube.com/watch?v=uGthVEza97U 查了一下似乎是 2003 的表演。不知道為什麼她在這個版本看起來特別傷心。最後的清唱很驚人。 httpvh://www.youtube.com/watch?v=dPOI7TRFdAY 這應該是較近期 (2010 後,詳細時間不確定) 的演出,風格看起來更像是一個生了重病的人在呻吟。在最後的副歌把麥克風拿得遠遠的,在這麼寬廣的音樂廳還能唱得這麼有力,真的很厲害。 httpvh://www.youtube.com/watch?v=DjLEVtm00-0 同場加映 另外一些較近期的演出版本 httpvh://www.youtube.com/watch?v=DTt5TQRawPs httpvh://www.youtube.com/watch?v=snWD2yXzu-I Lara跟小孩子合唱 httpvh://www.youtube.com/watch?v=2FckQePrlXM Daniel Lévi 唱給台下的 Lara 聽 httpvh://www.youtube.com/watch?v=lqqUcw4LgBA Serge Lama (作詞者) 的版本,其實我沒有特別喜歡他的版本,不過也是另一種截然不同的風格 httpvh://www.youtube.com/watch?v=isCJAxWtreY Serge 和 Lara 對唱 (不愛 XD) httpvh://www.youtube.com/watch?v=9pfX31PILJw Update: For Lara fans: 我找到Youtube上有人上傳完整版的節目。上面介紹的最早期的Je suis malade就是在這節目上唱的! https://www.youtube.com/watch?v=tfTqWCdI6kE遊記:Princeton + Philadelphia + New York (1)2012-07-30T01:50:07+00:002012-07-30T01:50:07+00:00https://leofang.github.io/2012/07/30/%E9%81%8A%E8%A8%98%EF%BC%9Aprinceton-philadelphia-new-york-1<p>上禮拜我跟忠廷開車去Pinceton參加凝態物理的summer school<br />
大嫂團則跑去紐約四處打卡兼血拼 XD</p>
<p>先來談談summer school好了<br />
除去負責主辦的幾位學生很晚才寄行前通知這點讓我有點感冒之外<br />
大致上辦得很不錯<br />
10鎂包含了四天的課程和早午餐<br />
算是物超所值 XD<br />
(不過早餐是一堆bagel+coffee,中餐則是某種神奇的肉+pasta+花椰菜+可樂...我都不愛 Orz) <!--more Read more--></p>
<p>這次的主題是Quantum computation與Criticality<br />
我覺得安排的不錯<br />
各個講者的題目都或多或少互相有關連<br />
像是Fendley (from Virginia)講完Conformal Field Theory之後<br />
Sachdev (from Harvard)接著講AdS與CFT的關聯<br />
或是Girvin (from Yale)先講quantum circuit<br />
Houck (from Princeton)再接力補完circuit operation & simulation<br />
(而且他們兩個講的題目剛好就是他們之前合作的幾個project!)<br />
諸如此類的<br />
更難能可貴的是幾乎所有講者都全程參與這四天的課程<br />
所以他們很清楚什麼題材是別人已經提過<br />
可以直接跳過講更深入的<br />
在休息和午餐時間也都會跟學員們一起行動<br />
因此大家有很多機會跟講者討論問題<br />
(或是聽Sachdev跟Girvin等人大戰deterministic quantum mechanics做為飯後娛興節目 XD)<br />
感覺蠻不錯的</p>
<p>(待續 XD)</p>{"login"=>"yf30@duke.edu", "email"=>"yao.lung.fang@duke.edu", "display_name"=>"Leo Fang", "first_name"=>"Yao-Lung", "last_name"=>"Fang"}yao.lung.fang@duke.edu上禮拜我跟忠廷開車去Pinceton參加凝態物理的summer school 大嫂團則跑去紐約四處打卡兼血拼 XD 先來談談summer school好了 除去負責主辦的幾位學生很晚才寄行前通知這點讓我有點感冒之外 大致上辦得很不錯 10鎂包含了四天的課程和早午餐 算是物超所值 XD (不過早餐是一堆bagel+coffee,中餐則是某種神奇的肉+pasta+花椰菜+可樂...我都不愛 Orz) 這次的主題是Quantum computation與Criticality 我覺得安排的不錯 各個講者的題目都或多或少互相有關連 像是Fendley (from Virginia)講完Conformal Field Theory之後 Sachdev (from Harvard)接著講AdS與CFT的關聯 或是Girvin (from Yale)先講quantum circuit Houck (from Princeton)再接力補完circuit operation & simulation (而且他們兩個講的題目剛好就是他們之前合作的幾個project!) 諸如此類的 更難能可貴的是幾乎所有講者都全程參與這四天的課程 所以他們很清楚什麼題材是別人已經提過 可以直接跳過講更深入的 在休息和午餐時間也都會跟學員們一起行動 因此大家有很多機會跟講者討論問題 (或是聽Sachdev跟Girvin等人大戰deterministic quantum mechanics做為飯後娛興節目 XD) 感覺蠻不錯的 (待續 XD)相對論性流體力學2012-05-06T03:18:18+00:002012-05-06T03:18:18+00:00https://leofang.github.io/2012/05/06/%E7%9B%B8%E5%B0%8D%E8%AB%96%E6%80%A7%E6%B5%81%E9%AB%94%E5%8A%9B%E5%AD%B8<p>這是我的電磁學期末專題報告<br />
其實我還蠻偷懶的<br />
因為這個題目根本就是幾年前上老闕古力課學的東西 :P<br />
只是因為它可以用covariant formulation描述<br />
所以才稍微跟電磁學扯上關係<br />
不過話雖如此<br />
我從期中考之後也花了好大一番功夫思考<br />
如何把這個題目講的合理又好懂<br />
還搬了一堆書回家查 XD</p>
<p>而且讓人扼腕的是<br />
我只有十五分鐘可以報告<br />
其中五分鐘是用來回答問題的<br />
所以我準時在十分鐘結束時喊卡<br />
(其他人都超過時間~哭哭)<br />
結果只能講到導出古典流體力學為止.......<br />
後面好多精采的(私以為 XD)都沒講到<br />
不過反正自己邊準備也覺得好玩<br />
就不管那麼多了</p>
<p>以下是我做的投影片<br />
<a href="http://sites.duke.edu/leofang/files/2012/05/rfd.pdf">Relativistic Fluid Dynamics</a></p>{"login"=>"yf30@duke.edu", "email"=>"yao.lung.fang@duke.edu", "display_name"=>"Leo Fang", "first_name"=>"Yao-Lung", "last_name"=>"Fang"}yao.lung.fang@duke.edu這是我的電磁學期末專題報告 其實我還蠻偷懶的 因為這個題目根本就是幾年前上老闕古力課學的東西 :P 只是因為它可以用covariant formulation描述 所以才稍微跟電磁學扯上關係 不過話雖如此 我從期中考之後也花了好大一番功夫思考 如何把這個題目講的合理又好懂 還搬了一堆書回家查 XD 而且讓人扼腕的是 我只有十五分鐘可以報告 其中五分鐘是用來回答問題的 所以我準時在十分鐘結束時喊卡 (其他人都超過時間~哭哭) 結果只能講到導出古典流體力學為止....... 後面好多精采的(私以為 XD)都沒講到 不過反正自己邊準備也覺得好玩 就不管那麼多了 以下是我做的投影片 Relativistic Fluid Dynamics均勻帶電圓盤的電位2012-05-05T09:11:57+00:002012-05-05T09:11:57+00:00https://leofang.github.io/2012/05/05/8<p>寫這兩篇的起因是因為我覺得教授給的標準答案很奇怪 (見Part 1)<br />
而且跟他討論的時候他很堅持這答案是對的<br />
完全不聽我解釋我的作法<br />
因此後來我索性直接把文章寄給全班<br />
事實上我們的算法是等價的<br />
(而且是在凌晨五點自己發現的,哈哈)<br />
但我不了解為什麼他只接受特定的作法</p>
<p>總之這件事已經告一段落了<br />
我也認清跟某些人討論大多只是在浪費時間<br />
效率實在不高</p>
<p>以下是我寫的兩篇文章<br />
<a href="http://sites.duke.edu/leofang/files/2012/05/potential1.pdf">potential of a uniformly charged disk – part 1 </a><br />
<a href="http://sites.duke.edu/leofang/files/2012/05/potential-new2.pdf">potential of a uniformly charged disk – part 2</a></p>{"login"=>"yf30@duke.edu", "email"=>"yao.lung.fang@duke.edu", "display_name"=>"Leo Fang", "first_name"=>"Yao-Lung", "last_name"=>"Fang"}yao.lung.fang@duke.edu寫這兩篇的起因是因為我覺得教授給的標準答案很奇怪 (見Part 1) 而且跟他討論的時候他很堅持這答案是對的 完全不聽我解釋我的作法 因此後來我索性直接把文章寄給全班 事實上我們的算法是等價的 (而且是在凌晨五點自己發現的,哈哈) 但我不了解為什麼他只接受特定的作法 總之這件事已經告一段落了 我也認清跟某些人討論大多只是在浪費時間 效率實在不高 以下是我寫的兩篇文章 potential of a uniformly charged disk – part 1 potential of a uniformly charged disk – part 2