""" 概要: ファンデルパウ法の補正係数を計算し、プロットするスクリプトです。 詳細説明: vdp_factor関数を用いてファンデルパウ補正係数fを計算し、抵抗比rに対する依存性をmatplotlibを用いてグラフ化します。 関連リンク: vdPauw_usage """ import numpy as np import matplotlib.pyplot as plt from scipy.optimize import brentq def vdp_factor(r): """ 概要: ファンデルパウ補正係数を計算します。 詳細説明: 入力された抵抗比 r = Rab,cd / Rad,bc に対して、exp(-x*r) + exp(-x) = 1 を満たす x を求め、 補正係数 f = 2 * ln(2) / (x * (r + 1)) を計算して返します。 引数: :param r: 抵抗比 Rab,cd / Rad,bc を指定します。 :type r: float 戻り値: :returns: 計算されたファンデルパウ補正係数 f を返します。 :rtype: float """ # exp(-x*r)+exp(-x)=1 を解く func = lambda x: np.exp(-x*r) + np.exp(-x) - 1 x = brentq(func, 1e-10, 100) # x = pi*R_AD,BC/Rs, Rs = pi/ln(2)*(R_AB,CD+R_AD,BC)/2*f # よって f = 2*ln(2) / (x*(r+1)) f = 2 * np.log(2) / (x * (r + 1)) return f # 対数スケールで広く調べる r_values = np.logspace(-2, 2, 500) f_values = np.array([vdp_factor(r) for r in r_values]) plt.figure(figsize=(8,6)) plt.semilogx(r_values, f_values, lw=2) plt.xlabel(r"$R_{AB,CD}/R_{AD,BC}$", fontsize=14) plt.ylabel("Correction factor f", fontsize=14) plt.title("van der Pauw Correction Factor", fontsize=16) plt.grid(True, which="both", alpha=0.3) plt.ylim(0, 1.05) plt.tight_layout() plt.show()