Return to the he3lib page...

Math

See also the source file: he3_math.f.

Library functions

math_ele(x)
math_elk(y)
Complete elliptic integrals E(x) and K(x)
loop_bz(rloop,r,z)
loop_br(rloop,r,z)
Magnetic field of a current loop with 1 A current, Bz, Br [G], as a function of radial and axial coordinates [cm].

Following functions have only fortran interface.

Integration. Use he3_math.fh include file. Examples are in test_int folder.

real*8 math_dint(func,xmin,xmax,nx)
complex*16 math_cint(func,xmin,xmax,nx)
Simple integration of real*8 and complex*16 functions (Gauss 2pt).
real*8 math_dint2d(func,xmin,xmax,nx,ymin,ymax,ny)
complex*16 math_cint2d(func,xmin,xmax,nx,ymin,ymax,ny)
Integration of 2D real*8 and complex*16 functions.
real*8 math_dint_gk(func, xmin, xmax, nx, aerr) Integrate real*8 function using Gauss-7pk+Kronrod-13pt.
real*8 math_dint_gka(func,xmin, xmax, aerr_lim, rerr_lim) Adaptive integration.
real*8 math_dint2d_gk(func,xmin,xmax,nx,ymin,ymax,ny,aerr) Integrate 2D real*8 function using Gauss-7pk+Kronrod-13pt.

Integrate Dirac delta-function: $\int f_1(r) \delta(f_2(r))\ dr$ in 2D and 3D space. [J.Comp.Phys. 207, 28 (2005)].
real*8 math_dint2d_delta(f1,f2, xmin,xmax,nx, ymin,ymax,ny)
real*8 math_dint3d_delta(f1,f2, xmin,xmax,nx, ymin,ymax,ny, zmin,zmax,nz)

Solve quadratic and cubic equations. Roots are sorted. [Ind.Eng.Chem.Res. 53(6), 2529 (2014)]
subroutine solve_cubic(A3,A2,A1,A0, x1,x2,x3)
subroutine solve_quadr(A2,A1,A0, x1,x2)