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.

Montag, 11. Juli 2011

Web 001: Setting up Apache and Running phpinfo() on Mac OS X

Ok, so you just want that phpinfo() running within two minutes on your local Mac because you want to develop your website from your $HOME/Sites directory. Easy. Here's the out-of-the-box solution to that (its done on Mac OS 10.6, PHP and Apache are from the default installation).
  1. cp /etc/apache/http.conf /etc/apache/back_http.conf # No backup, no mercy.
  2. sudo vi /etc/apache/http.conf
  3. You need to change two lines: Locate "DocumentRoot" and set the path behind it to '/Users/yourUserHomeDirectory/Sites'. Then locate the <Directory "/Library/WebServer/Documents"> line and change the path to the one you entered above.
  4. Remove the '#' sign infront of the line starting with "LoadModule php5_module"
  5. Save the file and exit.
That should be it. Now just restart Apache by issuing
sudo /sbin/apachectl restart

You can use the two following scripts as a default template. Copy the text and place them two files within the ~/Sites directory.
The index.html file:
 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/D
TD/xhtml1-transitional.dtd">
<html>
<head>
<title>Index Testing PHP</title>
</head>
<body>
<br /><br />
/Users/yourUserHomeDirectory/Sites/index.html
<form method="POST" action="phpinfo.php">
<input type="submit">
</form>
</body>
</html>
Then enter the following into a file called phpinfo.php and place it in the ~/Sites directory as well.
<?php phpinfo(); ?>
Set permissions for phpinfo.php to 755 in order to be executable by Apache. Now enter http://localhost/~yourUserHomeDirectory/ into a browser. This will display a minimal page showing the path you entered above and a button. Hit the button and the phpinfo.php script will execute. This should be it.
In case you have trouble getting it running, feel free to leave a comment.

Freitag, 8. Juli 2011

Schey 002: Surface Integral

In Maple:

> 2*Pi*a^2*int(r*(a^2-r^2)^(-1/2),r=0..a) assuming a>0;
3
2 Pi a

>


Schey, Ex. II.5,b.

Donnerstag, 7. Juli 2011

Shell 007: Zero Padding

Zero padding is useful when naming files and everything should be nicely aligned when listed.
This can be done by using

for i in 000{1..9) 10
do
echo $i
done