74
Xnumbers Tutorial
4
Polynomial System of 2
nd
degree......................................................................................................91
Bivariate Polynomial.........................................................................................................................92
Orthogonal Polynomials evaluation..................................................................................................97
Weight of Orhogonal Polynomials.....................................................................................................99
Zeros of Orthogonal Polynomials......................................................................................................99
Coefficients of Orthogonal Polynomials..........................................................................................100
Complex Arithmetic and Functions......................................................................................101
How to insert a complex number....................................................................................................101
Complex Addition............................................................................................................................102
Complex Subtraction......................................................................................................................102
Complex Multiplication....................................................................................................................102
Complex Division............................................................................................................................102
Polar Conversion............................................................................................................................103
Rectangular Conversion.................................................................................................................103
Complex absolute...........................................................................................................................103
Complex power...............................................................................................................................104
Complex Roots...............................................................................................................................104
Complex Log...................................................................................................................................105
Complex Exp..................................................................................................................................105
Complex inverse.............................................................................................................................105
Complex negative...........................................................................................................................105
Complex conjugate.........................................................................................................................105
Complex Sin...................................................................................................................................106
Complex Cos..................................................................................................................................106
Complex Tangent...........................................................................................................................106
Complex ArcCos.............................................................................................................................106
Complex ArcSin..............................................................................................................................106
Complex ArcTan.............................................................................................................................106
Complex Hyperbolic Sine................................................................................................................106
Complex Hyperbolic Cosine............................................................................................................107
Complex Hyperbolic Tan.................................................................................................................107
Complex Inverse Hyperbolic Cos....................................................................................................107
Complex Inverse Hyperbolic Sin.....................................................................................................107
Complex Inverse Hyperbolic Tan....................................................................................................107
Complex digamma..........................................................................................................................107
Complex Exponential Integral.........................................................................................................107
Complex Error Function..................................................................................................................108
Complex Complementary Error Function........................................................................................108
Complex Gamma Function.............................................................................................................108
Complex Logarithm Gamma Function............................................................................................108
Complex Zeta Function...................................................................................................................108
Complex Quadratic Equation..........................................................................................................109
Number Theory....................................................................................................................110
Maximum Common Divisor.............................................................................................................110
Minimum Common Multiple............................................................................................................110
Rational Fraction approximation.....................................................................................................111
Continued Fraction.........................................................................................................................112
Continued Fraction of Square Root................................................................................................113
Check Prime...................................................................................................................................113
Next Prime......................................................................................................................................113
Modular Addition.............................................................................................................................114
Modular Subtraction........................................................................................................................114
Modular Multiplication.....................................................................................................................114
Modular Division.............................................................................................................................114
Modular Power................................................................................................................................114
Perfect Square................................................................................................................................116
Check odd/even..............................................................................................................................116
Check Integer.................................................................................................................................116
Macro - Factorize............................................................................................................................117
Batch Factorization with Msieve.....................................................................................................118
Factorization function......................................................................................................................120
Macro - Prime Numbers Generator.................................................................................................121
Prime Test......................................................................................................................................121
Diophantine Equation.....................................................................................................................123
Brouncker-Pell Equation.................................................................................................................124
Euler's Totient function...................................................................................................................125
Integer relation................................................................................................................................126
Macro Integer Relation Finder........................................................................................................130
Linear Algebra Functions.....................................................................................................133
Matrix Addition................................................................................................................................133
How to C#: Basic SDK Concept of XDoc.PDF for .NET load, combine, and split PDF file(s), and add, create, insert, delete, re-order XDoc.PDF for .NET supports editing PDF document metadata, like Title
delete metadata from pdf; pdf xmp metadata viewer
77
Xnumbers Tutorial
5
Matrix Subtraction...........................................................................................................................133
Matrix Multiplication........................................................................................................................133
Matrix Inverse.................................................................................................................................133
Matrix Determinant.........................................................................................................................133
Matrix Modulus...............................................................................................................................134
Scalar Product................................................................................................................................134
Similarity Transform........................................................................................................................134
Matrix Power...................................................................................................................................134
Matrix LU decomposition................................................................................................................135
Matrix LL
T
decomposition...............................................................................................................135
Vector Product................................................................................................................................136
Solve Linear Equation System........................................................................................................136
Square Delta Extrapolation.............................................................................................................137
Macro for Multiprecision Matrix Operations.....................................................................................139
Integrals & Series.................................................................................................................141
Discrete Fourier Transform.............................................................................................................141
Discrete Fourier Inverse Transform................................................................................................143
Discrete Fourier Spectrum..............................................................................................................144
Inverse Discrete Fourier Spectrum.................................................................................................144
2D Discrete Fourier Transform.......................................................................................................145
2D Inverse Discrete Fourier Transform...........................................................................................145
Macro DFT (Discrete Fourier Transform)........................................................................................146
Macro Sampler...............................................................................................................................149
Integral function..............................................................................................................................151
Zeros of integral function................................................................................................................154
Function Integration (Romberg method).........................................................................................155
Function Integration (Double Exponential method).........................................................................156
Function Integration (mixed method)..............................................................................................158
Complex Function Integration (Romberg method)..........................................................................160
Data Integration (Newton-Cotes)....................................................................................................161
Function Integration (Newton-Cotes)..............................................................................................163
Integration: symbolic and numeric approaches...............................................................................165
Integration of oscillating functions (Filon formulas).........................................................................166
Integration of oscillating functions (Fourier transform)....................................................................168
Infinite Integration of oscillating functions.......................................................................................169
Double Integral...............................................................................................................................172
Macro for Double Integration..........................................................................................................172
Macro for Triple Integration.............................................................................................................175
Double integration function.............................................................................................................178
Infinite integral................................................................................................................................181
Double Data integration..................................................................................................................183
Series Evaluation............................................................................................................................186
Series acceleration with
∆
^2...........................................................................................................187
Complex Series Evaluation.............................................................................................................188
Double Series.................................................................................................................................189
Trigonometric series.......................................................................................................................190
Trigonometric double serie.............................................................................................................192
Discrete Convolution.......................................................................................................................193
Interpolation..........................................................................................................................195
Polynomial interpolation..................................................................................................................195
Interpolation schemas.....................................................................................................................197
Interpolation with continued fraction...............................................................................................199
Interpolation with Cubic Spline........................................................................................................201
Cubic Spline 2nd derivatives...........................................................................................................201
Cubic Spline Coefficients................................................................................................................203
2D Mesh Interpolation.....................................................................................................................204
Macro Mesh Fill..............................................................................................................................205
Differential Equations...........................................................................................................211
ODE Runge-Kutta 4........................................................................................................................211
ODE Multi-Steps.............................................................................................................................215
Multi-step coefficents tables............................................................................................................216
Predictor- Corrector........................................................................................................................218
PECE algorithm of 2
nd
order...........................................................................................................218
ODE Predictor-Corrector 4..............................................................................................................221
ODE Implicit Predictor-Corrector....................................................................................................223
Differential Systems........................................................................................................................226
OD Linear System..........................................................................................................................226
High order linear ODE.....................................................................................................................227
ODE for integral function solving....................................................................................................230
67
Xnumbers Tutorial
6
Macro ODE Solver..........................................................................................................................232
Macro ODE - Slope Grid.................................................................................................................233
Nonlinear Equations.............................................................................................................235
Bisection.........................................................................................................................................235
Secant.............................................................................................................................................236
Derivatives............................................................................................................................239
First Derivative................................................................................................................................239
Second Derivative...........................................................................................................................240
Gradient..........................................................................................................................................240
Jacobian matrix...............................................................................................................................241
Hessian matrix................................................................................................................................241
Non-linear equation solving with derivatives...................................................................................243
Conversions.........................................................................................................................245
Decibel............................................................................................................................................245
Base conversion.............................................................................................................................245
Multiprecision Base Conversion......................................................................................................246
Log Relative Error...........................................................................................................................247
Special Functions.................................................................................................................249
Error Function Erf(x)......................................................................................................................249
Exponential integral Ei(x)................................................................................................................249
Exponential integral En(x)...............................................................................................................249
Euler-Mascheroni Constant
γ
.........................................................................................................250
Gamma function
Γ
(x)......................................................................................................................250
Log Gamma function......................................................................................................................251
Gamma quotient.............................................................................................................................251
Gamma F-factor..............................................................................................................................252
Digamma function...........................................................................................................................252
Beta function...................................................................................................................................252
Incomplete Gamma function...........................................................................................................253
Incomplete Beta function................................................................................................................253
Combinations function....................................................................................................................253
Bessel functions of integer order...................................................................................................254
Cosine Integral Ci(x).......................................................................................................................254
Sine Integral Si(x)...........................................................................................................................254
Fresnel sine Integral.......................................................................................................................255
Fresnel cosine Integral....................................................................................................................255
Fibonacci numbers.........................................................................................................................255
Hypergeometric function.................................................................................................................256
Zeta function
ζ
(s)...........................................................................................................................256
Airy functions..................................................................................................................................257
Elliptic Integrals...............................................................................................................................257
Kummer confluent hypergeometric functions..................................................................................258
Integral of sine-cosine power..........................................................................................................259
Spherical Bessel functions of integer order.....................................................................................260
Formulas Evaluation.............................................................................................................261
Multiprecision Expression Evaluation.............................................................................................261
Complex Expression Evaluation.....................................................................................................265
Multiprecision Excel Formula Evaluation........................................................................................266
Math expression strings..................................................................................................................268
List of basic functions and operators..............................................................................................271
Function Optimization...........................................................................................................274
Macros for optimization on site.......................................................................................................274
Example 1 - Rosenbrock's parabolic valley....................................................................................276
Example 2 - Constrained minimization...........................................................................................277
Example 3 - Nonlinear Regression with Absolute Sum...................................................................279
Example 4 - Optimization of Integral function.................................................................................280
How to call Xnumbers functions from VBA.........................................................................281
References & Resources.......................................................................................................284
Analytical index......................................................................................................................287
3
Xnumbers Tutorial
7
WHITE PAGE
22
Xnumbers Tutorial
8
About this tutorial
About this Tutorial
This document is the reference guide for all functions
and macros contained in the Xnumbers addin. It is a
printable version of the help-on-line, with a larger
collection of examples.
XNUMBERS.XLA
is an Excel addin containing useful functions for numerical
calculus in standard and multiprecision floating point arithmetic up to 200
significant digits.
The main purpose of this document is to be a reference guide for the functions of this package,
showing how to work with multiprecision arithmetic in Excel. The most part of the material
contained in this document comes from the Xnumbers help-on-line. You may print it in order to
have a handle paper manual. Of course it speaks about math and numerical calculus but this is
not a math book. You rarely find here theorems and demonstrations. You can find, on the
contrary, many explaining examples.
Special thanks to everyone that have kindly collaborated.
Leonardo Volpi
Chapter
1
59
Xnumbers Tutorial
9
Array functions
What is an array-function?
A function that returns multiple values is called "array-function". Xnumbers contains many of
these functions. Each function returning a matrix or a vector is an array functions. Function
performing matrix operations such as inversion, multiplication, sum, etc. are examples of array-
functions. Also complex numbers are arrays of two cells. On the contrary, in the real domain,
the logarithm, the exponential, the trigonometric functions, etc. are scalar functions because
they return only one value.
In a worksheet, an array-function always returns a (n x m) rectangular range
of cells. To enter it, you must select this range, enter the function as usually
and and give the keys sequence CTRL+SHIFT+ENTER. Keep down both
keys CTRL and SHIFT (do not care the order) and then press ENTER.
How to insert an array function
The following example explains, step-by-step, how to insert an array-function
The System Solution
Assume to have to solve a 3x3 linear system. The solution is a vector of 3 values.
Ax = b
Where:
The function SYSLIN returns the vector solution x, that is an (3 x 1) array.
To see the three values you must select
before the area where you want to insert
these values.
Now insert the function either from menu or
by the icon
Select the area of the matrix A "A5:C7" and
the constant vector b "E5:E7"
ª
=
1 3 3 4
1 2 2 2
1 1 1 1
A
=
3
2
4
b
Documents you may be interested
Documents you may be interested