Friday, June 2, 2017

Installed python 3.6

Just installed Python 3.6 from this website using Method 2 (sudo add-apt-repository ppa:jonathonf/python-3.6).

Python: lists and tuples

Saturday, May 27, 2017

Thursday, May 25, 2017

Hund's rule

The equation for H_int as given in a writeup by Andersen and Gastiasoro is as follows:



The the U' contribution from the 2nd and 3rd terms on the right can be collected into a single summation involving sigma and sigma_tilda as the spin indices being summed over. In the third term above on the right (the U'-J term) , the J contribution can be written as a summation over both sigma and sigma_tilda minus a term where sigma comes with sigma_bar. These two steps are shown on the top left in the following figure. Then, go to "I" on the bottom left. This is a repetition of top left along with the result for S_mu \dot S_nu shown in the rest of the picture.





Tuesday, May 23, 2017

A python issue when equating two variables

Nx = 10
Ny = 10
xarr = np.linspace(-2.0,2.0,Nx+1)
yarr = np.linspace(-2.0,2.0,Ny+1)
xmesh,ymesh = np.meshgrid(xarr,yarr)
r_square = xmesh*xmesh+ymesh*ymesh
r_square_capped = r_square
r_square_capped[r_square
The last command changes BOTH r_square_capped and r_square

BUT not so the following:

>>> a=1.0
>>> b=a
>>> b=2.0
>>> a
1.0

#############
#############

following works:

>>> r_square = xmesh*xmesh+ymesh*ymesh
>>> r_square_capped=r_square.copy()
>>> r_square_capped[r_square

Sunday, May 21, 2017

Colors, matplotlib and an intro to plotly

http://pbpython.com/effective-matplotlib.html

https://plot.ly/python/animations/

https://github.com/zkbt/zachopy/blob/master/color.py

http://stackoverflow.com/questions/40581878/gradient-with-spectral-lines

http://hsugawa.blogspot.de/2010/01/matplotlib-colormap-for-visible.html

Monday, May 15, 2017

Installing and running the ipython notebook

First I installed ipython notebook from synaptic. It was also showing ipython3 notebook. saw here (https://askubuntu.com/questions/336313/what-is-the-difference-between-ipython-and-ipython3) that ipython3 notebook is for the python3 version. Since I have python2.7 or so, I installed ipython notebook.

Next from this (https://www.safaribooksonline.com/blog/2013/12/12/start-ipython-notebook/) site I tried to learn the basics of ipython. Everything worked fine till I reached the part where exporting the file is done with the nbconvert option.
To begin with, nbconvert was saying that I need Pygments
("ImportError: No module named pygments.formatters")

so did following:

sudo apt install python-pip

pip install Pygments

After installing Pygments, nbconvert was still giving me problems. This time it said the following:
"PandocMissing: Pandoc wasn't found"

So I did the following:

pip install pandoc

But the pandoc error persisted. From the internet I learnt that the pandoc here cannot be got from pip, since it is developed by Haskell.
i.e. I needed pandoc from the Haskell version - so this I got from Synaptic

Then nbconvert worked....but it still gave me the following error message:
"UserWarning: Node.js 0.9.12 or later wasn't found.
Nbconvert will try to use Pandoc instead."

I saw on stackoverflow that nodejs has to be installed (http://stackoverflow.com/questions/28489135/trouble-downloading-ipython-notebook-as-html)

Saw nodejs on synaptic.

I have installed nodejs from synaptic.

And now it worked without problem!!!

##############################################

At the end also did the following:

pip install --upgrade pip

since it gave me the following warning:
"You are using pip version 8.1.1, however version 9.0.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command."

##########################

Check out hte following links:

https://www.safaribooksonline.com/blog/2013/12/12/start-ipython-notebook/
http://www.randalolson.com/2012/05/12/a-short-demo-on-how-to-use-ipython-notebook-as-a-research-notebook/