Skip to main content

Posts

Installing Latex in mac

Installing latex in mac is very easy if you want to install the full mactex package. But the only  problem is it huge in size (~2GB). An alternative way to install the smaller mactex package. This will   not install some files which might be needed for your .tex file to compile. If you compile by pdflatex it will give some warning like this ! LaTeX Error: File `footmisc.sty' not found. Type X to quit or to proceed, or enter new name. (Default extension: sty) Then you should paste this command in terminal  sudo tlmgr install footmisc collection-fontsrecommended  Similarly if pdflatex complain about any other missing .sty file then install that just  using the above command. I couldn't install psboxit package in the way I described above. This is because psboxit is an absolute package and it is no longer available from the repository. To install this package i did this . cd /usr/local/texlive/2015basic/texmf-dist/tex/latex/  (In Fedora this path is
Recent posts

Installing Fedora on Macbook Air (early 2015 model)

1.create  a new partition for the linux os.It can be done in mac by going to Finder  -> Application ->Utilities -> disk utility.app .  Use this command to create a live usb stick from which fedora can be installed. "sudo dd if=path-of-the-Fedora-Image-file.iso of=path-of-the-usb-drive  bs=512k". Make sure the usb drive is formated with fat32. bs=512k is the safest rate and "diskutil list" command will give the path-of-the-usb-drive  (i.e., /dev/rdisk2 ) . dd will not give anyoutput until it completes the writing , so wait for some time (5-10min). Now shutdown  laptop and restart it while press the alt/option key. This will give the available boot options. click on fedora icon to start live session. During installation process delete the partition that you have created earlier and "reclaim the space". You should select automatic partiction process. 3. Things to do after installation Update the system via wired connection. This can be

General Matrix inversion by MKL in C++.

Here is a example of complex matrix inversion code by using MKL. #include #include #define MKL_Complex16 std:: complex < double > #include "mkl.h" using namespace std; void inverse( complex < double >* A, int N) {     int *IPIV = new int [N+ 1 ];     int LWORK = N*N;     complex < double > *WORK = new complex < double >[LWORK];     int INFO;    zgetrf_(&N,&N,A,&N,IPIV,&INFO);    zgetri_(&N,A,&N,IPIV,WORK,&LWORK,&INFO);     delete IPIV;     delete WORK; } int main() {     int n= 2 ;     complex < double > * A = new complex < double > [n*n];    A[ 0 ]= complex < double >( 1. , 2. );    A[ 1 ]= complex < double >( 3. , 4. );    A[ 2 ]= complex < double >( 5. , 6. );    A[ 3 ]= complex < double >( 7. , 8. );    inverse(A,n);     for ( int i= 0 ;i< 4 ;i++)        cout<     return 0 ; } Output is: (-0.5,0.4375) (0.25,-0.18

pm3d map of gnuplot in matplotlib

In gnuplot pm3d map plot a 3d data into a surface with color as value of "z". Lets say we have a data file something like this .. 0.00    0.00    0.00 0.00    1.00    0.00 0.00    2.00    0.00 0.00    3.00    1.9358 0.00    4.00    3.618 0.00    5.00    5.17 0.00    6.00    6.93 0.00    7.00    8.82 0.00    8.00    10.692 1.00    0.00    0.00 1.00    1.00    0.00 1.00    2.00    0.00 1.00    3.00    2.1318 .... ... In gnuplot prompt we will do something like this . set pm3d map; set dgrid  20,20 sp "data.dat" u 1:2:3    and this will produce a figure something like a figure as shown above. One  of the big disadvantage of gnuplot in my opinion is not able to manipulate data. Specifically if you look at the way interpolation is done. There is very little you can do with you data. Here i will give you a simple example how to plot a 3d data (3 column data or x,y,z ) in python name with the help of matplotlib/numpy/scipy. One has to first mak

Lecture notes on Condensed Matter Theory

Though there is lot of good text books on condensed matter physics. But there are many good lecture note available by various people. Here i will list some of them . These are mainly on the subject of strongly correlated eletrons. 1.  "Quantum Magnetism Approaches to Strongly Correlated Electrons"  by Assa Auerbach     ( http://arxiv.org/abs/cond-mat/9801294v1   ) 2. "Theory of Superconductivity" by N. B. Kopnin      ( https://ltl.tkk.fi/wiki/images/8/8f/TheorySC10.pdf ) 3. "SISSA Lecture notes on Numerical methods for strongly correlated electrons" by Sandro Sorella and Federico Becca      ( http://people.sissa.it/~sorella/Simulazioni.pdf ) 4. "Quantum Theory of Condensed Matter" by John Chalker       ( http://www-thphys.physics.ox.ac.uk/people/JohnChalker/qtcm/lecture-notes.pdf ) 5. "Quantum Condensed Matter Physics - Lecture Notes" by Chetan Nayak      ( http://www.physics.ucla.edu/~nayak/many_body.pdf )

Filling between curves with color gradient or cmap in Matplotlib

I was trying to plot fill_between () in matplotlib with color gradient or any cmap defined in pyplot.  After googleing a lot i couldn't find any solution.  An alternative method is to use imshow() . I have created this example :  import numpy as np import matplotlib.pyplot as plt from matplotlib.path import Path from matplotlib.patches import PathPatch xx=np.arange(0,10,0.01) yy=xx*np.exp(-xx) path = Path(np.array([xx,yy]).transpose()) patch = PathPatch(path, facecolor='none') plt.gca().add_patch(patch) im = plt.imshow(xx.reshape(yy.size,1),  cmap=plt.cm.Reds,interpolation="bicubic",                 origin='lower',extent=[0,10,-0.0,0.40],aspect="auto", clip_path=patch, clip_on=True) #im.set_clip_path(patch) plt.savefig("out.png") Source: Matplotlib Example  http://matplotlib.org/examples/pylab_examples/image_clip_path.html  

Matplotlib Colormap

Matplotlib Colormap This a small tutorial for making custom color map for matplotlib . You can also check the documentary page here .  One simple way to make  the colormap is using the available colours.  Here is a simple example .   import matplotlib.pyplot as plt from matplotlib import colors import numpy as np zvals = np.random.rand(10, 10) #cmap=colors.LinearSegmentedColormap.from_list("mycolor",['white', 'red','green','black']) cmap=colors.LinearSegmentedColormap.from_list("mycolor",['white','black']) img = plt.imshow(zvals, interpolation='nearest', origin='lower',cmap=cmap)