# Pragmatic Mathematical Service

The pessimist complains about the wind; the optimist expects it to change; the realist adjusts the sails.

## Latest Release

## Introduction

These are the handful of Javascript functions—over 500 to be a bit more
exact plus over 180 mathematical and physical constants—that accumulated
over the years. Most of them came into existence while in need to do
calculations that would be to complicated and partly even impossible to do
*per pedes* with the single help of pen&paper and a sliding rule. That
shall not be an excuse for the unholy mess but at least an explanation.

It is not a single monolithic library but separate functions to grab what you need and throw the rest into a corner where the sun rarely shines.

## Future plans

About 100 functions still sit on the workbench and await their insertion. The most frequent hindrance is an unknown license associated with a dead email address. These functions would need a complete reimplementation. Another, much smaller part is simply illegible but in such a way that a complete reimplementation would be simpler than a cleanup. A very small part is just too computing intensive to be useful in a Javascript implementation and will most probably published at the very end.

The short term plan is a port of the rest of the statistical tests of Octave;
~~the Bessel and Weber functions from the C-Lib (~~
`libmath`

) which
are very urgent but my implementation gives wrong answers sometimes.

The long term plan is to implement the rest of the workbench cover (hopefully
done at the end of 2008/start of 2009 if I live that long) and leave it there
and add nothing more but bugfixes. And paid-for features of course. And
functions I like to see in that packet but do not know that yet. And algorithms
people want who send me an extraordinary *and* tasty cooking recipe.
And …

The file Frontend should be the same as the one of the
same name in the packet but it is not guaranteed. Please download the package at
the download
page by exchanging "http" with "https" at the front of the URL. For example
"http:download.sourceforge.net/..." should be changed to
"http**s**:download.sourceforge.net/...". The SSL certificate of Sourceforge
is attached to the name "sourceforge.net", you (hopefully) may get a warning that
"downloads.sourceforge.net" does not belong to the certificate.

## License

The whole package is licensed GPL but most of the individual functions are also under a license which is legally equivalent to the old X-license. See the FAQ for a list and the license.

## Caveat

Javascript is an interpreted language, only partially standardized and interpreted by many different interpreters. It is therefore not guaranteed that the code will be interpreted and translated into machine code correctly and do what it has been told to do. Furthermore: not all functions are thoroughly tested and some algorithms might be of sovereign impreciseness or are even plain wrong. Most of the functions lack input sanitizing, too.

## Short Overview

The functions can be sorted loosely into the following groups. See the documentation or the source for the details

### Array

Several prototypes for the Array object. From `push()`

and `pop()`

(lacking in some older IEs), `forEach()`

and
others introduced by Mozilla/Firefox, some functions to walk over the entries
and do something with them to ports of some functions from John Walkers
"ent"(e.g. `monteCarloPi()`

)

### Distributions

Several functions regarding several discrete and continuous distributions. I ported most of them from Octave (octave/2.1.35/m/statistics/distributions/*) to replace my own writ with something elegant and legible.

### Electric

Only one function yet: to calculate the capacitance of a cylinder capacitor, a coax cable.

### Geometry

The obligatory calculations with triangles of different kind on the plane and on the sphere. Some calculations for gardeners to build regular polygons. Several helpers to get volume and area of cones, spheres, toruses, and circles and parts of them, a plane Lamé curve and volume of a rotational Lamé curve.

### Heat

The functions ripped out of a form to calculate a heat store (for solar energy in this case, but it is universal). The full form.

### Interests

Basic interest calculation. Not very interesting.

### Math

Besides several helpers and constants it offers a function to factor an integer
(shamelessly stolen from GNU's `factor`

), greatest common divisor,
least common multiple, gamma–, beta–, error function, digamma,
Pochhammer (raising factorial), factorial, Bernoulli numbers, Chebychev
(integers only), factorial, double factorial, hyper factorial, Bessel, Weber,
Rieman's and Hurzitz' Zeta and much more.

### Matrix

Basic Matrix operations for small complex matrices (up to 10x10, depending on the power
of the machine), addition, multiplication, determinant, transform, adjoint and
inverse. These work with arrays and are implemented as prototypes of the
~~Array~~ Matrix object. Some matrix decompositions including the Eigen-
and Singular-Value-decompositions for real matrices are included which allow
basic linear algebra for smaller matrices (up to about 100x100 depending on your
patience and the machines power and memory).

### Mean

Several means to get means like arithmetic–, geometric–, harmonic–, power mean, mode and median.

### Miscellaneous

A function that proves empirically (so no real proof in the mathematical sense) that the very next element of every arithmetical series given numerical (in a comma separated row like in many so called "Intelligence Tests") is 42.

"1,2,3,4,5,6, what is the next number? Yes, Christoph!"

"42!"

"Oh no, it's obviously 7, isn't it?"

"No, it isn't, it's obviously 42! With some simple matrix operation you can
easily see that the generating formula is simply
0.0486 x^{6} -
1.0208 x^{5} +
8.5069 x^{4} -
35.7291 x^{3} +
78.9 x^{2} -
84.75x + 35. If you replace x with 7 what do you get? Hu? 42, yes!"

"Smart-arse!"

### Physics

Mechanic (Newtonian and relativistic) and more.

### Plotting

Some functions to do very basic plotting, including two examples to test them. There are several very elaborated plotting libraries for Javascript which should be used instead for anything more than the most basic.

### Sets

Includes what you need. Not more, but also not less.

### Statistical tests

Statistical tests like student's test, Fisher exact (2x2), chi^{2} or ANOVA.
Descriptive functions like variance, standard deviation and more.
See also "Distributions".

## Contact

It seems as if my Sourceforge email address (and a lot of others, too) had been
used as a `From`

address in SPAM and is thus listed in some of the
more stupid blacklists. Please use the email address listed in the AUTHOR file
in the download package instead. If you don't want to download the package you
can guess what the capital X in czurniedenXgmx.de means.