Dienstag, 20. Dezember 2011

Most useless installation instructions

Isn't it always a great pleasure to install new software? Especially if some installation steps dont work. However, gracefull developers always include instructions some of them very helpful, like "Click on Continue", others epically useless. E.g.

So this guy wants to install phpBB. From phpBB: "If you see a "Could not connect to the database" error, this means that you didn't enter the database data correctly and it is not possible for phpBB to connect. Make sure that everything you entered is in order and try again. Again, if you are unsure about your database settings, please contact your host." Oh really? No, I enter wrong stuff ON PURPOSE because I enjoy spending time reading error messages YOU MORONS!

Freitag, 11. November 2011

What makes a good talk? How do I prepare it?

Seminar at a group where nobody knows your work:
• Most important point: the talk is not for you, it's for the audience. The talk has to be designed such that the audience enjoys it, not you
• Who is the audience? What do they know? How much introduction is required such that it becomes understandable what I'm saying?
• Once I know who the audience is going to be: draft the talk in four slides. Condense the material
• Readable graphs (large units/labels, thickness of lines), i.e. if graphs are not prepared nicely, it shows that the preparation of the talk was not a priority
• Better the audience understands a little a bit, instead of it totally does not understand anything
• Simple Rule of thumb 1: Not more than two messages per slide
• Simple Rule of thumb 2: Not more than six bullet points, not more than 6 white-spaced expressions per bullet point No bullet points, substitute bullet points by figures
• Dont read the bullet points, memorize them. Go through them while facing the people, not the slides Address each figure and make it clear why it is there
• The slides dont substitute the talking. The talking is the main message carrier, the slides should allow to assist when explaining. Thats why text is not required, instead figures
• Dont base the talking on the slides, base the slides on the talking.
• Timing (excluding questions): 5% personal introduction: "who is this guy?", 10% content introduction, 70% content, 10% summary/conclusions, 5% aknowledgements
• Start practicing the talk at least 3 days a week ahead.
• Avoid text
• In the start of the talk, it's fine to show something unrelated so people remember you

Donnerstag, 3. November 2011

GNUPlot 002: EPS Bounding Box

I plot some data in gnuplot and want to include it in a Latex document. One option is to use the gnuplot terminal "postscript enhanced eps" and print to an eps file. The eps file can be converted to a PDF and then included in the Latex document which is compiled with pdflatex. However, it may happen that the bounding box is too large and then the diagram takes up too much space. And nobody wants to hand-edit the bounding box, or manually select the graph in Preview and save manually to pdf.

What I now do is to use gnuplot terminal "postscript enhanced" and print to ".ps" file. Then I use the tool ps2eps, which generates a better bounding box. The call is

ps2eps -f -B -l -R + data.ps

-f: forces overwrite of existing eps files, -B recalculates bounding box, -l adds a bit to it, so it does not terminate on the labels, -R + sometimes rotation is required. No output file is required.

Then, the .eps file is opened in preview and saved to PDF. If using "convert" again PDF will have a too large white space margin, probably there are some options to adjust this, havent found them yet.

Another option (Credits: Janus)
http://www.gnuplot.info/scripts/files/fixbb

Mittwoch, 2. November 2011

Latex 001: Making a table cover the page width

The below Latex element defines a table which extends over the whole page width. Notice the 'table*' environment, which lets the table extend over two columns.
\begin{table*}[htbp]\begin{tabular*}{\textwidth}{l@{\extracolsep\fill}lrrrr}\\\hline1B2V & 32 & -4.06 & 4.23 & 4.72 & 7.30\\1DUK & 64 & -0.35 & 3.94 & 4.45 & 4.80\\1DEK & 137 & 1.88 & 4.87 & 5.19 & 5.80\\\end{tabular*}\caption{Some values.}\label{tab:values}\end{table*}

Dienstag, 1. November 2011

CGI 001: Combining Javascript and CGI

I wrote a minimal example involving Javascript and CGI. Javascript only
<html>
<script type="text/javascript">
function helloworld()
{
document.write("Hello World.");
}
</script>
<body>
<input type="button" value="Hello World." onClick="helloworld()">
</body>
</html>
</pre>

Including CGI:
<html>
<script type="text/javascript">
function helloworld()
{
return true;
}
</script>
<body>
<form action="./hello.cgi" onSubmit="return helloworld()">
<input type="submit" value="Hello World.">
</form>
</body>
</html>

The CGI part in Python
#!/usr/bin/python
print "Content-type: text/plain\n\n"
print "Hello World."

The Javascript function is nothing but a pseudo-function. It does nothing, but control of flow does go through it, otherwise the form is not submitted to the CGI.
Important to note is that the CGI script access the element name property, not the ID.

Mittwoch, 14. September 2011

GNUPlot 001: Postscript postproduction

I generated a graph with gnuplot:
Settings were:
 set terminal postscript set output 'outfile.ps' set size 0.6,0.6 set xlabel "Reaction Coordinate" set ylabel "dE[kcal/mol]" plot 'data.dat' with lines lw 4 set output

If i open this file in preview, the file is oriented 90° counter-clock wise. This can be fixed with 'ps2eps'.
The command I used was:
ps2eps -f -R + -B -l data.eps

Samstag, 3. September 2011

Python 003: Summing specific items of nested lists

Say we're faced with the challenge of summing the last element of a list of nested lists.
An example might be
a=[[2,4,6],   [4,2,5],   [2,5,6]]

where we're interested in the sum of 6+5+6. In Python this can conveniently be done using the reduce/lambda pair of functions:
>>> reduce(lambda x,y: x+y, [i[-1] for i in a])17>>>

Samstag, 30. Juli 2011

Schey 003: Surface Integral over Half Sphere

test

\left[ \begin {array}{ccc} \sin \left( \phi \right) \cos \left( \theta \right) &-R\sin \left( \phi \right) \sin \left( \theta \right) &R\cos \left( \phi \right) \cos \left( \theta \right) \\ \noalign{\medskip}\sin \left( \phi \right) \sin \left( \theta \right) &R\sin \left( \phi \right) \cos \left( \theta \right) &R\cos \left( \phi \right) \sin \left( \theta \right) \\ \noalign{\medskip} \cos \left( \phi \right) &0&-R\sin \left( \phi \right) \end {array} \right]

Dienstag, 12. Juli 2011

Web 002: Interactive Figure

I wrote a script to illustrate the superposition principle. The more cosine functions are superpositioned, the more precise can the position be described (by integrating over the probability density). Naturally, all information about the momentum is lost, since the probability of each momentum component becomes smaller and smaller with increasing superposition number.
The foregoing is illustrated by the below figure.
What I want to achieve now is to have this be interactive on the web. Since the only variable in the calculation is an integer (the number of superpositions), I would like to introduce something like a knob, which the user can click and turn and by doing so increase/decrease the number of superpositions. While he is doing this, the figure should update dynamically, i.e. for every selection the correct wavefunction should be displayed.
How can this be done? What are the general requirements for this? We will see.

Freitag, 24. Juni 2011

Jmol 003: Arranging Protein on NW Surface

The below picture was obtained with the following Jmol script.

load 1PDB.pdbload APPEND nwSurface.xyzmodel allaxes onselect proteinboundbox {1.1} on

The protein is surrounded by its boundbox. What I now want is to mark the three of the sides of the bound box, as I indicated with arrows added with paint. Maybe the boundbox and the arrows could also be separate "objects" (?), generated on the fly from the structure.
The point is, now the user could click a radio button indicating that the protein is oriented with its (red/green) face towards the wire. If he is not happy with that, he could click the rotate button, returning the box/protein/ensemble ensemble to be oriented with the (red/blue) face towards the wire (for now rotations by 90° is fine). If it is this orientation he expects (depending maybe on binding sites in the protein) he then would click the red/blue radio button and submit the form. Depending on the selected radio button, the appropriate distance of the center of the box to the wire can be obtained.

After a little trying, the following turned out.
The command used for the red vector is

draw xVec vector {-58.19/2.0, -47.57/2.0, -54.71/2.0} {58.19, 0.0, 0.0} width 5.0 color red

What I now require is to have the vectors rotate together with the protein, so maybe the easiest is to have the vectors be part of the protein structure.

Mittwoch, 22. Juni 2011

Jmol 002: Control over Two Structures

I loaded two structures into a jmolApplet by the following code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN""http://www.w3.org/TR/html4/loose.dtd"><html><head><title>UI Controls example</title><script src="./jmolDir/Jmol.js" type="text/javascript"></script></head><body>     <script type="text/javascript">     jmolInitialize("./jmolDir");     jmolApplet(400, "load 1AVD.pdb;\             load APPEND nwSurface.xyz;\             axes on;\             boundbox on;");     </script><br /></body></html>
This results in the figure below.
A protein structure is placed above an array of carbon atoms which are supposed to illustrate the surface of a nanowire. What I would like to do now is to be able to rotate the protein with respect to the surface (i.e. keeping the surface in the same orientation regarding the indicated coordinate system).
Unfortunately, I dont know how to include Jmol on Blogspot, otherwise I naturally would have included it directly here as well.
The input from Bob Hanson at the Jmol Mailing list is actually pointing me into exactly the correct direction. This script was tested in a local version of Jmol but it should just as well be working in a browser.
load 1PDB.pdbload APPEND nwSurface.xyzselect proteinset allowRotateSelected Trueset dragSelected True

Now using <ALT>+<Left_Mouse> the user can rotate the protein structure without changing the surface and <ALT>+<SHIFT>+<Left_Mouse> to drag the structure over the surface.

Dienstag, 21. Juni 2011

The function below allow the user to load a structure into a Jmol applet.
#!/usr/bin/pythonprint "Content-type: text/html\n\n"import cgiimport cgitbcgitb.enable()def getJmolPage(target):   newpage  = ''   newpage += '<html>\n'   newpage += '  <head>\n'   newpage += '      <title>Load PDB Form</title>\n'   newpage += '      <script src="./jmolDir/Jmol.js" type="text/javascript"></script>\n'   newpage += '  </head> \n'   newpage += '  <body> \n'   newpage += '  <script type="text/javascript">\n'   newpage += '  jmolInitialize("./jmolDir");\n'   newpage += '  jmolApplet(400, "load ../x_output/%s.pdb");\n'   newpage += '  </script><br />\n'   newpage += '  </body>\n'   newpage += '</html>\n'   return newpage % (target)if __name__ == '__main__':   form = cgi.FieldStorage()   target = form['PDBID'].value   print getJmolPage(target)
Note, all HTML code had to be escaped in order to be posted on the blog.

Donnerstag, 16. Juni 2011

System/Web Programming
File Permissions: Good short summary of dangers in web programming
HTML/JavaScript: Displaying text when clicking on checkbox.
Showing hiding a text field here.
Users on Mac OS X: Difference between wheel and staff.
JavaScript and Numbers.

Science
Ising Model: Derivative of Magnetization, Source, Phase transition
Lipases: Chemical Industry Review.

Dienstag, 14. Juni 2011

PyMOL 004: Illustrating a periodic system

I have enclosed the structure inside a rectangular box. Now I would like to translate it in order to generate the image of a periodic plane.

Using the supercell.py script on the PyMOL wiki, the following figure was generated. The command was
supercell 40,4,1, withmates=1
at the PyMOL prompt.

How can I have little boxes around all proteins?

After aligning all proteins on the surface, the output is the following.

Montag, 30. Mai 2011

Shell 006: Replacing String with incrementing index

Lets say we have some text as below.
headerfoofoofooheaderbarbarbarheaderbazbazbaz

where we want the "header" be replaced by "model {1,2,3}".
I was pointed out to a couple of solutions over at LinuxQuestions.org

An awk solution.
$awk 'BEGIN { cntr = 0 } /header/ { cntr++ ; print "model", cntr } !/header/ { print$0 }' infile

where 'infile' contains the data.

A bash solution.
#!/bin/bashfilename=dataindex=1for entry in grep -n model $filenamedo line=echo$entry | awk -F":" '{print$1}' sed -e "$line s/model/model $index/" -i$filename        index=$(($index + 1))done

An even shorter awk solution.
awk '$0 = /header/?"model "++c:$0' file

A one line bash solution

Mittwoch, 13. April 2011

Shell 005: String processing

A directory contains the following
~/shell ls -l00_01_boxpdb.py00_01_realign.py00_02_callPDB2PQR.py00_03_getPointCharges.py00_04_getCharge.py01_01_connect.py How can the leading terms be removed? ~/shell for i in 0*> do> mv $i${i:6}> done

Grep matches the beginning of the line output by 'ls' with 'd', which indicates a directory. " 'awk {print $8}' " then prints the 8th column of the output (so the directory name is available again). Dienstag, 12. April 2011 Vim 005: Efficient formatting The following example demonstrates how to format a run control file efficiently. The initial PYTHONPATH in the file is  export PYTHONPATH=$HOME/shellscripts:$HOME/tree/lib64/python2.4/site-packages:$HOME/kemibin/2010/woche_03/wave/

and it is difficult to read. It would be nice to have all directories added to the path on separate lines. In Vim, this can be done by issueing:
:s/:\$/:\rexport PYTHONPATH=\$PYTHONPATH:\$/g \r is the line feed character (apparently it works on Linux, even if its the Windows line feed character). The common Unix linefeed character is \n. \$ escapes the dollar sign so it can be found and replaced/inserted (it would be considered the end of the line if not escaped). Calling the command returns
export PYTHONPATH=$HOME/shellscripts:export PYTHONPATH=$PYTHONPATH:$HOME/tree/lib64/python2.4/site-packages:export PYTHONPATH=$PYTHONPATH:$HOME/kemibin/2010/woche_03/wave/ There remains a colon on all but the last lines. Replacing this would require the command to recognize if it is operating on a line which is not the last one of the selection. Vim 004: Pasting into Vim If a piece of text is copied into the clipboard and then pasted into Vim (while in insertion mode), most likely the text will be very ill formatted and kind of "drifting" to the right with increasing line number. Especially this is likely to happen when copying from a formatted document but is very unwanted e.g. when code should be pasted into Vim. In Vim, use :set paste to enable pasting from the clipboard. Vim 003: Deleting all Lines of given Kind In a file, all lines containing a given identifier 'IDENT' can be deleted by calling (within Vim): :d/IDENT/g Sonntag, 10. April 2011 Shell 005: Redirect Part of a File Suppose a file contains data starting from a given keyword (the content above the keyword is considered not relevant). If only the content from after the keyword is to be redirected to a new file (in a batch), this can be done using sed. for i in file-*.logdo sed -n '0,/DONE/!p'$i > ${i/file/new}done "!" tells it to ignore everything from the start of the file "0" to the first line containing the keyword "/DONE/", then p makes it print the rest, with a shell redirection of the output to a new file. Regards to David the H. at LinuxQuestions for pointing this out to me. Freitag, 8. April 2011 Vim 002: Submitting Vim Command from the shell A Vim command can be submitted to Vim directly from the shell (without entering Vim) by calling: vi "+:%s/+0/+1/g" "+wq"$i

Notice the '+' operator within the command string. Also notice the 'wq' command to save and "exit" Vim once it finished its job. This is an excellent way of processing a batch of files.

Shell 003: Tail

All but the top 40 lines of a file can be catted to a new file by calling:

I found it here.

PyMOL 003: Displaying Atom Coordinates

In PyMOL, the coordinates of atoms of a selection can be printed by first selecting the atoms of interest and then calling

PyMOL>iterate_state 1, sele, print name, x, y, z

where 'sele' is just the selection created when clicking on the atoms of interest.

Sonntag, 3. April 2011

GAMESS 002: Copying to a new job type

When a batch of optimizations finished, the final coordinates need to be transfered to for example a HESSIAN job. At the same time, the file should change the extension from .log to .inp and the jobtype identifier should change from opt to hes. On the command line, this can be done in a for-loop by issueing:
mzh @ ~/shell $for i in a-{1,2,3}-opt.logdoOPTLOG=$iHESLOG=${OPTLOG/opt/hes} # Rename jobtypeHESINP=${HESLOG/log/inp}           # Rename extensiongrep -i -A 29 "equilibrium" $OPTLOG|tail -n 26 >>$HESINPdone

I dont know how to rename two parts of a file name in the same step, i.e. how to get from 'a-{1,2,3}-job-opt.log' to 'a-{1,2,3}-job-hes.inp' in one command. That's why I rename part of the file step by step. Then, after I have the filename ready in a variable, the important content is written to this file. The molecule has 26 atoms, but the identifier is 29 lines above the end of the coordinate block, that's why I tail it (I dont know how to identify an empty line which terminates the coordinate block-- there is no identifier for the ending of the coordinate block). The generic command would be to insert N+3 where N is the number of atoms in the file.IMPORTANT: remember the '>>' append operator when transfering to the input file.

Now a more tricky part, transfering the Hessian matrix from the GAMESS output .dat file to the SADPOINT job file. How can this be automated in a smart way?
This line of code is the solution:

mzh ~/shell $awk '/ \$HESS/,/^ \$END/' hess.dat >> sad.inp I dont know what the ',' does. Note the quotes. There also appear to be other ways of doing this: mzh ~/shell$ ruby -ne 'print if /\$HESS/../\$END/' file

or
mzh ~/shell $f=0;while read l; do [[$l =~ \$HESS ]] && f=1; [[ f -eq 1 ]] && echo$l;        [[ $l =~ \$END ]] && f=0;    done < file

These other options are less readable to me, but seem to work nicely.

Freitag, 1. April 2011

Fails.

Fail-001: Compilation of OpenBabel fails.

Donnerstag, 31. März 2011

Python 002: Version Introspection

When working with Python 2.x and Python 3.x at the same time, its quite probably that the version of the currently running version of Python becomes a question of interest.
One can obtain the version of the running Python instance by issueing
from sys import version_infoif version_info < (3,0):   print version_infoelse:   print(version_info)

Vim 001: Editing Code

Consistent formatting of code is essential for efficient developement.
A part of the formatting also comes from introducing syntactic elements such as stars to group the code by content. In Vi this can be done in a simple way.
ESQ -> N -> a -> * -> ESQ -> RETURN

where N is the number of stars to be added, e.g. 40, or 78 to indicate the maximum width the code should take up.

Python 001: Module introspection

Python has great self introspection capabilities.
Sometimes flow of control runs through different modules. If I want to know which module is currently in the scope, here is how I can do this:

#!/usr/bin/env python3import os.pathdef getModuleName():    print("Current module:".ljust(30), os.path.abspath(__file__))getModuleName()

Adding the above to the module should make it possible to get the location and name of the module in scope at runtime.

Mittwoch, 30. März 2011

PyMOL 003: Synchronizing Atoms in PyMOL

1. Show both structures as lines
2. Show the rank of the atoms.
3. Follow the backbone ranks of both files until they loose synchronization.
4. Adjust one to the other, from now on always adjust this one to the other. Only one of the files is changed.
The way to do it is: atom with rank b in structure B corresponds to atom with rank a in structure A. Move the line corresponding to b to the line corresponding to a.

PyMOL 002: Description of the Program

When starting the work with PyMOL, it might seem odd that there is no such thing like an 'undo' button. But I believe this only seems odd because the user has expectations towards the program which it never intended to meet in the first place. Its not a program to use as one would use Word or any other Editor. In fact, I believe its intended to be used in the way one uses a black board. One quickly fills it up with notes, and then erases it to start over again with the next part of what one wants to write down, like in a lecture. One does not want to keep the black board in the way one wrote on it. If something is required to be recalled (e.g. because one wants to be able to present something at a meeting without having to search for all kinds of files) one can prepare a PyMOL session file.
Also, PyMOL is not a modeling program (even though its modeling capabilities are already quite impressive). Instead, its a viewer and an analysing tool which is extensible. And this is the most important part about it I believe. It is extremely friendly to the user who wants to extend it by his or her own functionality. All that is required is some knowledge about Python. The PyMOL API is quite introspective, so every function documents itself and this is really makes the extension work convenient.

GAMESS 001: Files

A short introduction into the files obtained from running GAMESS calculations.
Which file containes what, where to find coordinates from optimization jobs and how to efficiently transfer them to new input files.
There is a tool called DATAGAM which can fetch various $GROUP content from GAMESS files. It's not exactly clear to me how it works, but by issuing the following command, at least I was able to transfer the equilibrium geometry to a new file. mzh @ ~/software/DATAGAM$ datagam -G 4-2-a-1-1-rm1--rm1.log
This is optimize run
Equilibrium geometry (with unique and all coordinates) will be saved to file OPTMZ

GAMESS 001: Files

A short introduction into the files obtained from running GAMESS calculations.
Which file containes what, where to find coordinates from optimization jobs and how to efficiently transfer them to new input files.

Sonntag, 27. März 2011

MathML

Testing MathML Input

Samstag, 26. März 2011

Schey 001: Bereichsintegrale

Ich arbeite gerade an der Theorie zu Bereichs- und Flächenintegralen. Diese ist für die Behandlung der Elektrostatik erforderlich.
Schey macht sich viel Mühe bei der Behandlung von Bereichsintegralen. Wenn ich das soweit richtig verstehe, wird die Fläche S über die integriert wird, auf eine Ebene projeziert. Dann wird über diese Fläche integriert, wobei der Integrand mit dem Wert der Funktion auf der S Fläche multipliziert wird. Das Skalarprodukt aus dem Einheitsnormalvektor auf S mit dem Einheitsvektor in z-Richtung an der Stelle (x,y) liefert die Beziehung zwischen S und der Projektion R. Am Wochenende muss ich dann mal das Kapitel im Zachmann gründlich durchackern. Find das Thema schon ziemlich interessant.

Sonntag, 20. März 2011

PyMOL 001: Introduction to Indexing

PyMOL is one of the best protein working tools available. There are many useful scripts available and it is extremely powerful, when used correctly. The built-in Python shell makes it essentially a real-time programming environment. The user support is a class of its own. Even more so when compared to e.g. the AutoDock support, which is essentially not existing. This is even more regrettable, since some of AutoDocks features are really unique.
One internal characteristics I would like to know more details about is, what the three labels Rank, ID and Index exactly mean and how they are related to the information contained in a PDB file. Work in progress.

Donnerstag, 17. März 2011

Shell 003: Data Handling

The computation of a transition state (TS) can take a significant amount of time.
For a given system, the TS was first located in a subset of the system and then reinserted into the full system. Then the full system was reoptimized, but unfortunately the TS is no longer confirmed by a frequency calculation.
My guess is that the environment forces the TS into a local minimum. So the idea is not to let the TS readjust to the environment, but only the environment to the TS.
How to include this approach in the file naming?

On another aspect. The following is a situation which I encounter many times. I compute some structure which is part of a reaction. This structure now needs to be processed by different methods. Either as a starting point for a new method which leads to a new geometry, or a method which gives information about the quality of the structure as it is right now (its gradient, its hessian). For the files which arise from this structure, how do I indicate that they are in this "parent-child" relation?

Mittwoch, 16. März 2011

Hydrogens 001

I would like to start a discussion on what methods are available to add hydrogens to protein structures.
This is probably something a lot of people require since its crucial for molecular modeling.
I have encountered several difficulties so far:
• Not all residues of a given type have the same pKa and therefore protonation state. How to tell the program so?
• Ionizable residues can be protonated at different positions (Nd or Ne in histidine).
I will check out the various options available and report on my findings.

The people on the PyMOL Mailing list have provided me with the following options for adding hydrogens:

http://kinemage.biochem.duke.edu/software/reduce.php
It optimizes the histidine flips. It is a published algorithm, rather than the unsophisticated one that pymol uses, which is not really doing any optimization.

2) NAMD2

4) Chimera (UCSF, CA, USA, http://www.cgl.ucsf.edu/chimera/). It is free for academics.
The HIS example you mentioned is explicitly treated in Chimera. It shows you all HIS in your protein and you decide which one will be protonated.

5) PROPKA

6) PyMOL

7) OpenBabel

8) AutoDock

9) PDB2PQR. It can complete missing side chain atoms. Gaps in the backbone can not be fixed, apparently. Also, carbonyl groups terminating a gap and peptide nitrogens on the other terminal are not protonated and therefore open shell.

10) WHAT IF

Dienstag, 15. März 2011

Anderson, J. M., Ex. 2.4

We are asked for the Fourier Expansion of

$f(x) = x-x^2$

on the interval

$[-\pi:\pi].$

What I'm asking myself is, what happens to the expansion coefficients

$c_m = \frac{1}{\pi}\left<\cos mx | f\right>$

and

$d_m = \frac{1}{\pi}\left<\sin mx | f\right>$

, since the function is not symmetric. Is it an even function? Is it an odd function? To me it seems an even function around x=0.5. I guess this shift will have to be included into the integration boundaries.
It seems as if Anderson has a typing mistake in the example for expanding f(x)=x into a Fourier series. Thanks to mYthos for pointing this out to me.

Another point of interest. The solutions in the book are

x-x^2= - \sum_{n { } even} \frac{4}{\pi n^3} \sin nx = \\ - \sum_{n even} \frac{4}{n^2} \cos + \sum_{n odd} \frac{4\pi-4}{\pi n^2}\cos n x + \left( \pi - \frac{2*\pi^2}{3}\right)" align="middle" alt="$x-x^2= - \sum_{n { } even} \frac{4}{\pi n^3} \sin nx = - \sum_{n even} \frac{4}{n^2} \cos + \sum_{n odd} \frac{4\pi-4}{\pi n^2}\cos n x + \left( \pi - \frac{2*\pi^2}{3}\right)$" title="[latex]x-x^2= - \sum_{n { } even} \frac{4}{\pi n^3} \sin nx = - \sum_{n even} \frac{4}{n^2} \cos + \sum_{n odd} \frac{4\pi-4}{\pi n^2}\cos n x + \left( \pi - \frac{2*\pi^2}{3}\right)

Now, plotting this for the series expanded to N=100 together with the function returns the following image.

Keine Ahnung, ob das jetzt gut oder schlecht ist. Ein Eintrag auf MatheBoard wurde geschaltet.
Offenbar war da ein Problem. c0 muss noch durch zwei geteilt werden. Ich dachte, dass sei bereits in der Lösung enthalten. Dadurch ergibt sich folgender Term

$F := N \rightarrow -\sum_{n=1}^N \frac{4}{(2n)^2} \cdot \cos (2nx) + \\ { } \sum_{n=1}^N \frac{4\pi - 4}{\pi (2n-1)^2} \cos ((2n-1)x) + \frac{\pi - (2\pi^2/3)}{2}$

Weiterhin bleibt zu vermerken, die Fourierreihe ist eine vollständige Menge orthonormaler Funktionen.

Shell 002: allsh

Good to know. A shell command can be issued for all running shells at once.
http://72.14.189.113/howto/shell/allsh/

Freitag, 11. März 2011

Time Line

Testing if I can get the Time Line widget to run. I need to document my stuff better.

The code is here.
Need to synchronize the timelines.

Donnerstag, 10. März 2011

Books I am working on

I am working on reading through these books:
1. Mathematics for Quantum Chemistry: Jay Martin Anderson
2. div, grad, curl and all that: H. M. Schey
I find them both very exciting. I need to get more into the theory both on QM related mathematics and on vector calculus. They contain exercises and solutions. So far I can recommend them both strongly. Most people would probably say Anderson is a bit dated but I think it's still perfectly recommendable.
Best passage from Schey so far:
"Gauss' law is

$\iint_S \textbf{E} \cdot \hat{\textbf{n}} \mbox{ dS} = \frac{q}{\epsilon_0}.$

If you don't understand this equation, don't panic."
Isn't this just wonderful? All people coming from a German education background will know why I am posting this.

Shell 001: How to mv a big number of files efficiently

Suppose a directory contains ten files of the following structure:

1scf-001.mop
1scf-002.mop
1scf-003.mop
1scf-004.mop
1scf-005.mop
1scf-006.mop
1scf-007.mop
1scf-008.mop
1scf-009.mop
1scf-010.mop

The question is, how can the files be changed such that both '1scf' and 'mop' are changed to 'mutant' and 'inp' on one command?

Various Checks

Who figured out that

$E=mc^2?$

The good thing now is that

$\LaTeX$

is available in the blog.
Einstein most famous equation is \$E=mc^2\$.Newtons derived the equaiton \$s=ut+\sfrac{1}{2}at^2\$

Einstein most famous equation is $E=mc^2$.
Newtons derived the equaiton $s=ut+\sfrac{1}{2}at^2$

Latex formating together with regular text inside 'pre' elements is still not working.

Check out this tutorial on inline mathematical notation.
http://watchmath.com/vlog/?p=438

Trying MathML from Maple:

${f}:=\left({x},{N}\right)\to \sum _{{m}={1}}^{{N}}\phantom{\rule[-0.0ex]{5.0}{0.0ex}}{\mathrm{cm}}{\mathrm{cos}}\left({m}{x}\right)+\sum _{{m}={1}}^{{N}}\phantom{\rule[-0.0ex]{5.0}{0.0ex}}{\mathrm{dm}}{\mathrm{sin}}\left({m}{x}\right)$

Maple Latex Export

$\mbox{}+1/2\,{\it cm}\,\cos \left( x \right) +1/2\,{\frac {{\it cm}\, \left( \sin \left( x \righ t) \right) ^{2}}{\cos \left( x \right) -1}} +1/2\,{\frac {{\it dm}\,\sin \left( x \right) \cos \ left( \left( N+1 \right) x \right) }{\cos \left( x \right) -1}}-1/2\,{\it dm}\,\sin \left( \le ft( N+1 \right) x \right)$