{ Crystal Diode Response 03-MAY-12. We integrate exp(a*sin(x)) numerically so as to obtain the rectification response of a crystal diode. This is a Pascal source code file. } program p; const dt=0.001; pi=3.141592654; a_scale=1.1; a_min=0.0001; a_max=10.000000; vT=0.0271; {this is kT/q for T=310K} fsd=10; fsr=1; var i:integer; integral:real; a,y,t:real; begin a:=a_min; while a<=a_max do begin integral:=0; t:=0; while t<=1.0 do begin integral:=integral+exp(a*sin(2*pi*t)/vT)*dt; t:=t+dt; end; y:=vT*ln(integral); writeln(a:fsr:fsd,' ',y:fsr:fsd); a:=a_scale*a; end; end.