ece 103 engineering programming chapter 55 c math library herbert g. mayer, psu cs status 6/4/2014...
TRANSCRIPT
ECE 103 Engineering ProgrammingChapter 55
C Math Library
Herbert G. Mayer, PSU CSStatus 6/4/2014
Initial content copied verbatim fromECE 103 material developed by
Professor Phillip Wong @ PSU ECE
Syllabus Beyond <math.h> GNU Scientific Library
3
Beyond <math.h>
The C90 Standard Library contains only elementary math functions:
sin atan2 log10 ldexp
cos sinh pow frexp
tan cosh sqrt modf
asin tanh ceil fmod
acos exp floor
atan log fabs
4
C99 expands the number of built-in math functions:
More macros and constants are defined.
Complex numbers, operators, functions are supported.
acosh scalbln llround fdim
asinh cbrt rint fmax
atanh hypot lrint fmin
exp2 erf llrint fma
expm1 erfc nearbyint
ilogb tgamma remainder
log1p lgamma remquo
log2 trunc copysign
logb round NAN
scalbn lround nextafter
5
Even more comprehensive math abilities can be added to C by using commercial or free libraries.
From Wikipedia article: List of numerical libraries
GNU Scientific Library - popular, free numerical analysis library implemented in C.
GNU Multi-Precision Library - for doing arbitrary precision arithmetic.
IMSL Numerical Libraries - cross-platform libraries containing a comprehensive set of mathematical and statistical functions.
LabWindows/CVI - libraries for analysis of measurement data, signal generation, windowing, filter functions, signal processing, linear algebra, array and complex operations, curve fitting and statistics.
NAG - collection of numerical analysis routines which can be called from user applications running on a wide variety of hardware platforms.
Alternative: Numerical Recipes (book with source code, also online version, not free)
http://www.nr.com
6
GNU Scientific LibraryFree to use: License = GPL
Homepage: http://www.gnu.org/software/gsl
Complex Numbers Chebyshev Approximation Random Distributions
Special Functions Discrete Hankel Transforms Histograms
Permutations Minimization Monte Carlo Integration
BLAS Support Physical Constants Differential Equations
Eigensystems Wavelets Numerical Differentiation
Quadrature Roots of Polynomials Series Acceleration
Quasi-Random Sequences Vectors and Matrices Root-Finding
Statistics Sorting Least-Squares Fitting
N-Tuples Linear Algebra IEEE Floating-Point
Simulated Annealing Fast Fourier Transforms Basis splines
Interpolation Random Numbers