Posts

  • Calc eigenvalues, eigenvectors, and evolution of Hamiltonian

  • Matlab code % Calc eigenvalues and eigenvectors, evolution of Hamiltonian % define symbols syms Omega1 Omega2 t % Hamiltonian in matrix form H = zeros(4,'sym'); H(1,1) = Omega1; H(2,3) = Omega1; H(3,2) = Omega1; H(3,4) = Omega2; H(4,3) = Omega2; % disp('Hamiltonian in matrix form'); disp(H) % solve eigenvalues and eigenstates [V,D] = eig(H); % for idx = 1:length(diag(D)) disp("Eigenvalue:"); disp(D(idx, idx)); disp("Eigenstate:") disp(V(:,idx)); end % evolution % initial state psi0 = [0;0;1;0]; % state at time t psi_t = expm(-1i*H*t)*psi0; % disp("State at time t") disp(psi_t) Read more
  • LaTeX 环境配置(updated)

  • Updated: 2023-09-22 12:00:00 LaTeX 环境配置 MiKTeX(LaTeX编译) + WinEdit(LaTeX文本编辑) + SumatraPDF(PDF阅读) 1. MiKTeX (LaTeX编译环境,130M+) MiKTeX ps:安装过程如提示是否询问安装缺失package,选自动安装的选项即可,这样在日后编译LaTeX文件过程,只要有联网,就会自动安装缺失package. 如果选择一次安装好所有的packages,可以选择 TeX Live (LaTeX Packages 很全,安装包也很大,~5G+) texlive.iso 2. WinEdt (LaTeX文本源文件编写工具) 2.1 WinEdt 10.3 (64-bit) WinEdt 10.3 (64-bit) Key Name:Cracker TeCHiScy Code:1130140925535334280 2.2 WinEdt 11.0 (64-bit) (with its own PDF Viewer) WinEdt 11.0 (64-bit) 3. SumatraPDF (PDF阅读,可反向索引) SumatraPDF 4. jabref(bib文献管理工具) jabref 5. LaTeX环境配置(LyX) 5.1 安装包准备 TeXLive 下载地址: TeXLive LyX 下载地址: LyX 5.2 安装 先安装TeX编译环境TeXLive 再安装 LyX(可参考Installing TeXLive for Windows) Read more
  • How to add spyder on ubuntu

  • Spyder app (icon) is not initialized on application desktop after Anaconda/conda is installed, which means one has to start the program in the terminal. Unfortunately, Spyder would be closed if the terminal is interrupted accidentally. Indeed, Spyder can be started by the command with the help of nohup nohup spyder &. As a result, the app will not be disturbed even if the terminal is closed. The following will give a method to create a shortcut icon for spyder on application desktop. Press Ctrl+Alt+T open a terminal and input the following command. cd /usr/share/applications/ sudo gedit spyder4.desktop # depend on... Read more
  • Learning notes of WSL

  • Windows Subsystem for Linux (WSL) allows users to run a Linux terminal environment, install packages from the Ubuntu archive, and run Linux applications and workflows on Windows 10. Ref: WSL in ubuntu wiki issue 1: chmod WSL (Bash) doesn’t work To fix this, you need to edit /etc/wsl.conf. and put below config in. [automount] enabled = true options = "metadata" Ref: Automatically Configuring WSL Chmod/Chown WSL Improvements Read more
  • Calc precise result of \(n\)th power of two

  • Matlab code % calc the precise result of 2^167. clear all; clear; N = 167; result_len = floor(log10(2^N))+1; % calc the digit of the result result = zeros(1, result_len); % create a blank matrix to store the result result(1) = 1; % 2^0 initialized result str_result = cell(1,N); % create N string cell to store the result of every step last = 1; % initialized the digit of the result fid =fopen('result.txt','w'); % create a file (result.txt) to print the result fprintf(fid,['## result of 2^', num2str(N),'\n']); % for idx = 1:N % multiply by 2 in every step result =... Read more