Skip to content

Instantly share code, notes, and snippets.

View krantikal's full-sized avatar

krantikal

View GitHub Profile
@krantikal
krantikal / otlfmt.otl
Last active March 31, 2021 04:47
[Notetab Outline files] OTL files are outline files which can be opened in notetab. #structure #format #text
//vim:syntax=Notetab
// Line breaks shown are necessary
= V4 Outline MultiLine NoSorting TabWidth=30
H="Basics"
#f0011, Alternate import
import Tkinter as tW
root=tW.Tk()
root.mainloop()
@krantikal
krantikal / ATocLatMath.md
Last active April 2, 2021 05:44
[LaTeX Math Issues] Tackle issues that come up while writing #format #math #QP

Index

  • flushleft_and_normal_equations.tex : Flushleft and normal equations goes together, as is the norm in textbook solutions
  • flushleft_and_normal_equations.tex : Flushleft and normal equations goes together, using mathtools
  • msword_math Tips on using Microsoft word for typesetting Question papers with math content
  • overset_underset_cases.tex : Using if in definitions of piecewise funcs, writing over and under symbols, operators and math expressions
  • tensor_typing.tex : Sample code for typing tensors using the tensor package. Second line shows that the \tensor command will automatically place the indices in shifted positions without the need for using math-spaces.
  • tex commands list at tutorialspoint
@krantikal
krantikal / astropy_constants_01.py
Last active March 31, 2021 04:30
[Declared Constants and Unit Conversion] in #astropy and other #scicmp dialects. Not just for #astrophysics
from astropy.constants import c, m_e
m = m_e
E = m * c**2
E_MeV=E.to('MeV')
print 'E in MeV=',E_MeV
@krantikal
krantikal / hello.c
Created March 31, 2021 04:43
[Hello Programs] #coding #intro
void main(int argc, char *argv[]) {
puts( "Hello World from processor");
}
@krantikal
krantikal / MatlabLiveScripting.md
Last active March 31, 2021 11:43
[Matlab Live Scripts] Notes on how to construct and deploy a #live #script

Annotation : How to work with live scripts:

  1. Home Tab, New: Live Script (.mlx extension)
  2. Live Editor / View Tab becomes active
  3. Save the Live Script
  4. Create a text-zone at the top by pressing Ctrl+E (or RC: Convert between code and text). With the live editor tab active you can click in the buttons (1) Equation via its LaTeX code(2) Hyperlink (3) Image to import them in the script. You can also do standard formatting. It is possible to create a bullet / numbered list from the "Text Style" toolbox (to the right hand side of the live editor ribbon). Code can be included within text-zones; use the big "M" (monospaced) button.
  5. Press a Ctrl+E again to insert code; Ctrl+Enter to exec. Note that the right-most end of the live editor ribbon contains more detailed "Run" Options.
  6. Create new sections (which can be run individually) if needed, to include answers to several problems. Placing the clear all command at the top of each sections can eliminate some confusion.
  7. The View tab can be used t
@krantikal
krantikal / rvel.m
Created March 31, 2021 11:41
[Relativistic velocity addition] #demo #sample Matlab #script file used in #astrophysics #coursework
% Script : rvel.m
% Graph demonstrating the velocity addition formula
% Easily convertible to a Live Script
% Create basic plot
beta=0:0.02:1;
rv1=2*beta;
rv2=rv1./(1+beta.*beta);
rvel_limit=ones(size(beta));
Traces=plot(beta,rv1,beta,rv2,beta,rvel_limit);
@krantikal
krantikal / myplus.m
Last active September 9, 2022 03:06
[Matlab Custom function] #demo #sample Matlab function file for #astrophyics #coursework
function y = myplus( x,y )
%myplus returns the sum minus the product of the two input variables.
y = x+y - x.*y;
end
@krantikal
krantikal / animdata.plt
Created March 31, 2021 17:29
[Gnuplot Animation] Creating #animation in our favorite #plotting system
# output gif is must
set terminal gif animate delay 100
set output 'output.gif'
stats 'data.dat' nooutput
set xrange [-0.5:1.5]
set yrange [-0.5:5.5]
#do for [i=1:int(STATS_blocks)] {
# plot 'data.dat' index (i-1) with circles
@krantikal
krantikal / multiwin.plt
Last active April 2, 2021 04:51
[Gnuplot Effects] Docked Multi-window #plotting #housekeeping
# Docked Gnuplot windows
# Plots share space with code window
# If there are more than one plot, they will be stacked
set term win docked
plot sin(x)
set term win 2 docked
plot sin(x)+cos(x)
@krantikal
krantikal / socbib.tex
Created April 2, 2021 05:09
[LaTeX Refs] #housekeeping
LaTeX Bibliography
Dear Socratis,
See \cite{verma} and \cite{poschel}....
........
\begin{thebibliography}{100} %Assuming maximum 100 entries not more
\bibitem{poschel} \textbf{Pöschel, Thorsten, and Schwager, Thomas. \textit{"Molecular Dynamics". Computational Granular Dynamics: Models and Algorithms.}} Springer-Verlag Berlin Heidelberg (2005)
\bibitem{verma} \textbf{Verma, H C. \textit{"Rotational Mechanics". Concepts of Physics [Part 1].}} Bharati Bhawan (P \& D) (2012).
\end{thebibliography}