From d0c870377cc4e0388a343a6297f7ec5fa54adf16 Mon Sep 17 00:00:00 2001 From: Ian Jauslin Date: Mon, 13 May 2019 22:20:51 -0400 Subject: As presented at MSU on 2019-05-02 --- figs/contour.fig/Makefile | 30 ++++++++++++++ figs/contour.fig/contour.py | 82 +++++++++++++++++++++++++++++++++++++++ figs/contour.fig/contour.tikz.tex | 34 ++++++++++++++++ 3 files changed, 146 insertions(+) create mode 100644 figs/contour.fig/Makefile create mode 100644 figs/contour.fig/contour.py create mode 100644 figs/contour.fig/contour.tikz.tex (limited to 'figs/contour.fig') diff --git a/figs/contour.fig/Makefile b/figs/contour.fig/Makefile new file mode 100644 index 0000000..bade7d0 --- /dev/null +++ b/figs/contour.fig/Makefile @@ -0,0 +1,30 @@ +PROJECTNAME=contour + +PDFS=$(addsuffix .pdf, $(PROJECTNAME)) + +all: $(PDFS) + +$(PDFS): poles.tikz.tex + pdflatex -jobname $(basename $@) -file-line-error $(patsubst %.pdf, %.tikz.tex, $@) + +poles.tikz.tex: + python3 contour.py > poles.tikz.tex + +install: $(PDFS) + cp $^ $(INSTALLDIR)/ + +$(LIBS): + ln -fs libs/$@ ./ + +clean-libs: + rm -f $(LIBS) + +clean-aux: + rm -f $(addsuffix .aux, $(PROJECTNAME)) + rm -f $(addsuffix .log, $(PROJECTNAME)) + rm -f poles.tikz.tex + +clean-tex: + rm -f $(PDFS) + +clean: clean-libs clean-aux clean-tex diff --git a/figs/contour.fig/contour.py b/figs/contour.fig/contour.py new file mode 100644 index 0000000..102df86 --- /dev/null +++ b/figs/contour.fig/contour.py @@ -0,0 +1,82 @@ +#!/usr/bin/env python3 + +import cmath +import math +import scipy.special as sp +from scipy import optimize as op +import random +import sys + +# number of roots +nr_roots=4 + +# size of plot +plotsize_x=3 +plotsize_y=3 +# rescale plot (so roots are not too close together) +plotsize_scale_x=1 +plotsize_scale_y=6 + +# numerical values +hbar=6.58e-16 # eV.s +m=9.11e-31 # kg +Vn=9 # eV +En=20e9 # V/m + +V=1 +E=En*hbar/(Vn**1.5*m**0.5)*math.sqrt(1.60e-19) + +# sqrt with branch cut along iR_+ +def sqrt_p(x): + r,p=cmath.polar(x) + if(pplotsize_y): + return(False) + for x in roots: + if(abs(root-x)<1e-12): + return(False) + return(True) + +# find roots +roots=[] +while len(roots)