pythonプログラミングを始める前に Getting Started with python 本講義では、pythonは必須ではありませんが、 アルゴリズムの理解と今後の研究に役に立ちますので、 余裕のある人は試してみてください。 python is not a requirement for this class, but it will help your understanding about the algorisms to be learned and also assist your future research. |
pythonのインストール方法 Install python |
28/05/2019 9:31 created |
共通して使うpythonプログラム: Common python programs:
|
||
講義予定日 |
講義内容 |
講義資料 |
掲載履歴 |
June 11, 2024 | コンピュータの基礎 Fundamental of computer 誤差 Sources of errors |
20240612ComputerAndErorrSouorces.zip |
June 12, 14:13 updated June 11, 8:24 updated June 07, 9:23 uploaded |
python programs: Level **: Convert base of given integer Program: download base.py (Source code) Algorisms / Python modules: sys to get start-up variables Usage: python base.py value(integer) base_source base_target ex: python base.py 101101 2 10 Convert 1011012 to base 10. Output: to display 1st step: Convert value to base 10 2nd step: Convert the base 10 value to base_target What you learn: while, if, % (residual), ** (power), print and format Level *: Roundoff error from summing up small
values (compare different precisions): Level *: Roundoff error from summing up small
values: |
June 14, 2024 June 18, 2024 |
数値微分 Numerical differentiation 数値積分 Numerical integration |
20240614DifferentialIntegration2.zip |
June 14, 13:07 uploaded June 14, 8:45 updated June 13, 11:48 uploaded |
python programs: Numerical differentiation Level *: Effect of x mesh h on numerical differentiation using two-point forward difference method: It compares the differentiation errors for different x mesh h for two-point forward difference method, df / dx ~ (f(x+h) - f(x)) / h. Program: download diff_h.py (Source code) Algorisms / Python modules: none Usage: python diff_h.py Output: to display and diff_h.csv. What you learn: function definition
Level *: Effect of different approximations on numerical
differentiation:
Level *: Effect of different approximations on numerical
differentiation with random noise data:
Level ***: Richardson extrapolation differentiation: |
|||
python programs: Numerical integration
Level ***: Numerical integration by Gauss-Legendre
formula:
Level ***: Numerical integration by Romberg formula:
Level ****: Numerical integration by variable
conversion type formula: I.M.T. formula:
Level ****: Numerical integration by variable
conversion type formula: Double Exponential function formula:
Level **: Effect of different h and approximations on numerical
integration
Level **: Calculate Debye function
Level **: Calculate electron density in metal
based on the free electron model |
June 18, 2024 |
微分方程式 Differential equation 分子動力学法 Molecular dynamics |
20240618Diffeq2.zip |
June 18, 10:26 updated June 18, 7:06 updated June 17, 9:07 uploaded |
python programs: Solve a first-order differential equation
Simpson formula:
Three-stage third-order Runge-Kutta formula:
Four-stage fourth-order Runge-Kutta formula:
|
|||
python programs: Solve a second-order differential equation
Heun formula:
Verlet formula:
|
|||
python programs: Solve simultaneous second-order differential equations
(連立2次微分方程式)
Verlet formula: |
|||
June 21, 2024 |
補間 Interpolation 平滑化 Smoothing 線形最小二乗法 Liner least-squres method 方程式の解 Numerical solutions of equations |
20240621InterporlateSmoothing.zip |
June 23, 9:32 updated June 20, 12:23 updated June 20, 12:23 uploaded |
python programs: Smoothing, Convolution Level ***: Simple moving average and polynomial fit method: Program: download smoothing.py (Source code) Input file(s): xrd.csv Usage: python smoothing.py Output: to display, smoothing-*.csv, and graph Visualization: integrated. Or download plotcsv1.py and run, e.g., 'python plotcsv1.py smoothing-simple-3.csv'. Level ***: Convolution with Gauss function: Level *****: Convolution/Deconvolution with Gauss function: |
|||
python programs: linear LSQ Level ***: Least-squares fitting for polynomial: Fit n-th order polynomial to scattered data by linear LSQ. Program: download lsq-polynomial.py (Source code) Algorisms / Python modules: Linear LSQ for polynomial Usage: python lsq-polynomial.py norder Ex: python lsq-polynomial.py 3 Fit to y = c0 + c1x + c2x2 + c3x3 Output: to display, lsq-polynomial.csv, and graph Visualization: integrated What you learn: numpy.linalg.inv to get inverse matrix and solve simultaneous linear equations Level ***: Least-squares fitting for general functions: Fit sin + cos function to scattered data by linear LSQ. Program: download lsq-general.py (Source code) Algorisms / Python modules: Linear LSQ for sin / cos functions Usage: python lsq-general.py nfunc Ex: python lsq-geneal.py 3 Fit to y = c0 + c1sin(x) + c2cos(x) Output: to display, lsq-general.csv, and graph Visualization: implemented in the python script What you learn: numpy.linalg.inv to get inverse matrix and solve simultaneous linear equation |
|||
June 27, 2024 |
方程式の数値解法 Numerical solution of equation 最適化 (非線形最小二乗法) Optimization (Nonlinear LSQ) |
June 27, 9:25 updated June 25, 12:51 updated June 24, 10:40 updated June 23, 10:23 uploaded |
|
python programs: Solution of equation Level **: Self-consistent method: An example to solve a simple equation, x = 0.5(-x3 + x2 - 2) by self-consistent manner. Program: download equation-selfconsistent.py (Source code) Usage: python equation-selfconsistent.py Output: to display. Visualization: What you learn:
Level **: Self-consistent method:
Level ***: Newton-Raphson method:
Bisection method:
Brent's method: Level ***: Calculation of EF for
semiconductor by bisection method Level ***:
金属のEFの温度依存性 Level ****: 半導体の統計物性の温度依存性 Level *****: Solve multi-values equation:
Calculate energy band diagram and wave functions by Kronig-Penney model |
|||
|
|||
python programs: Nonlinear optimization One parameter Newton-Raphson method: Minimize a target function with one parameter by Newton-Raphson method. Download optimize-newton-raphson1d.py, and run 'python optimize-newton-raphson1d.py'. Output: to display. Usage: python optimize-steepdescent1d.py xini Visualization: implemented in the python script What you learn:
Two parameters Newton-Raphson method with
graphical visualization of convergence process:
Two parameters Steepest Descent method with
graphical visualization of convergence process:
Two parameters Steepest Descent &
Conjugate Gradient methods +
Line Search methods
|
|||
python programs: Nonlinear optimization using scipy.optimize Optimization using the scipy.optimization module. Download peakfit-scipy-minimize.py and tklib.py, and run 'python peakfit-scipy-minimize.py'. Output: to display and csv files, initial.csv, final.csv, and convergence.csv Visualization: implemented in the python script What you learn: scipy.optimize, matplotlib, csv |
June 28, 2024 |
フーリエ変換 Fourier transform 行列 Matrix 応用 Applications |
20240628FT_Matrix3.zip | June 28, 10:42 updated June 28, 8:24 updated June 27, 10:09 uploaded |
python programs: Fourier transformation (FT) Fourier transformation by efficient discrete FT (DFT), simple FT (DFT2), and numpy FFT: Compare execution time for different FT algorisms Download dft.py, and run 'python dft.py'. Output: to display Visualization: What you learn: time, numpy ndarray, numpy fft |
|||
python programs: Matrix Matrix operations using numpy/scipy.linalg: Download matrix.py, and run 'python matrix.py'. Output: to display Visualization: What you learn: numpy.linalg, scipy.linalg |
|||
python programs: applications (Under construction)
結晶構造関係プログラム
|
|
2018/6/12 | コンピュータの原理 | 20180611SlideDay1Ver1.pdf | 2018/6/11 10:57 公開 |
2018/6/16 | 数値微分・積分、常微分方程式 | 20180614slideday2ver1.pdf | 2018/6/14 14:16 公開 |
2018/6/19 | 常微分方程式、分子動力学法、補間、平滑化 | 20180619slideday3ver2.pdf | 2018/6/18 12:00 公開 2018/6/19 12:31 Ver.2 |
2018/6/22 | 平滑化、線形最小自乗、最適化、方程式の数値解 | 20180620slideday4ver1.pdf | 2018/6/20 17:05 公開 |
2018/6/26 | 非線形最小自乗、Fourier変換 (Monte Carlo法、行列は省く) | 20180626slideday5ver2.pdf | 2018/6/25 公開 2018/6/26 11:07 Ver.2 |