NB. Mie theory total scattering effective cross-section Q for spheres NB. of radius "a" (physical cross-section is pi*a^2*Q). NB. Left argument is complex dielectric constant of sphere at lambda. NB. In this routine, the complex part should be *negative*. NB. Right argument is dimensionless ratio x = 2*pi*a/lambda NB. Usage: (complex die.) Q x --> Q_a, Q_s, Q_e (where Q_a = absorption NB. Q_b = scattering, Q_e = extinction: Q_e = Q_a + Q_s ) Q=: dyad define if. y < 0.01 do. NB. Q for x < 0.01 z=. (x-1)%(x+2) NB. x is complex dielectric constant q1=. ((y^4)%0.375)*Re z*z b=. Im -z*((x*x)+(27*x)+38)%(11.25+7.5*x) q2=. y*(Im _4*z)+(b*y^2) q2,q1,(q1+q2) else. NB. Q for x >= 0.01 yy=. y * r=. %:x NB. r is complex refractive index. z2=. 0j_1*z1=.(sin y)+0j1*cos y j=. n=. >./20,<. 1+1.5*y*|r se=. ss=. an=. k=. 0 whilst. 1 < j=. <:j do. a=. j%yy an=. (a-%(a+0{an)),an end. a1=.(sin (Re r)*y)*(cos (Re r)*y) a2=.(sinh (-Im r)*y)*(cosh (-Im r)*y) a3=.((sin (Re r)*y)^2)+((sinh (-Im r)*y)^2) a0=.(a1+0j1*a2)%a3 a1=.(-%yy)+(%((%yy)-a0)) an=. an*(a1%0{an) whilst. (k 1e_14) do. zn=. (-z2)+(z1%y)*(<: 2*k=. >:k) c=. ((<:k){an%r)+k%y a=. (c*Re zn)-Re z1 a=. a%((c*zn)-z1) c=. (k%y)+r*((<:k){an) b=. (c*Re zn)-Re z1 b=. b%((c*zn)-z1) se=. se+pse=.(pp=. >: 2*k)*Re(a+b) ss=. ss+pss=. pp*((a*+a)+(b*+b)) pt=. |pss%pp z2=. z1 z1=. zn end. (2%y^2)*((se-ss),ss,se) end. ) NB. Example: NB. 2j_0.04 Q 3 NB. 0.178433 2.44696 2.62539