// Fractions of electrons experiencing n order of scattering Nn/N0 as a function of relative sample thickness t/Lambda

// Unless named starting with GlobalSino, EM, My, Self, the function commands are defined
//by Gatan DM, please see at link: http://www.globalsino.com/EM/page2597.html

 

TagGroup GlobalSino, EMItems
GlobalSino = DLGCreateDialog( "Enter your numbers", EMItems )
TagGroup MyNumber1, MyNumber2, MyNumber3
EMItems.DLGAddElement( DLGCreateRealField( "Order of scattering  :", MyNumber1, 1, 8, 3 ) )      
EMItems.DLGAddElement( DLGCreateRealField( "t/lambda :", MyNumber2, 3, 8, 5 ) )      
EMItems.DLGAddElement( DLGCreateRealField( "StepSize of t/lambda :", MyNumber3, 0.05, 8, 5 ) )      

if ( !Alloc( UIframe ).Init( GlobalSino ).Pose() ) exit (0)

number n = MyNumber1.DLGGetValue()
number tLambda = MyNumber2.DLGGetValue()
number MyStepSize = MyNumber3.DLGGetValue()

number NnN0, t, Myn

t = 1
Myn = 1

for(t=1; t<=n; t++) Myn = Myn*(t);

number EMt

for(EMt=1; EMt<=tLambda/MyStepSize; EMt++)

{
NnN0 = ((EMt*MyStepSize)**n)*exp(-EMt*MyStepSize)/(Myn)
result (EMt*MyStepSize + "\t" + NnN0 + "\n")
}