Mathematical functions

From JSXGraph Wiki
Revision as of 21:04, 18 January 2013 by Michael (talk | contribs)

Jump to: navigation, search

Functions of the JavaScript Object Math

The following functions are part of every JavaScript virtual machine:

  • Math.abs;
  • Math.acos;
  • Math.asin;
  • Math.atan;
  • Math.ceil;
  • Math.cos;
  • Math.exp;
  • Math.floor;
  • Math.log;
  • Math.max;
  • Math.min;
  • Math.random;
  • Math.sin;
  • Math.sqrt;
  • Math.tan;

JSXGraph expands the set of available mathematical functions. These functions are part of the JXG.Math namespace which itself contains several namespaces like JXG.Math.Numerics and JXG.Math.Geometry.

  • JXG.Math.Geometry.angle(A, B, C): for Point objects A, B, C. (A: name string, id string or object pointer)
  • JXG.Math.Geometry.rad(A, B, C)
  • JXG.Math.Geometry.distance(arr1, arr2): Euclidean distane between two vectors
  • JXG.Math.pow(a, b): [math]a^b[/math] for floating point value of b. Math.pow is defined for integer values of b', only.
  • JXG.Math.cosh(x)
  • JXG.Math.sinh(x)
  • JXG.Math.Numerics.D(f): Numerically computed derivative of the function f, returns a function.
  • JXG.Math.Numerics.I(interval,f): Numerically computed v alue integral of the function f in the given interval.
  • JXG.Math.Numerics.root(f,x): root of the function f. Uses Newton method with start value x.
  • JXG.Math.factorial(n): computes [math]n! = n\cdot(n-1)\cdots2\cdot 1[/math].
  • JXG.Math.Numerics.lagrangePolynomial(p): returns a function which describes the Lagrange polynomial through the points in the array p.
  • JXG.Math.Numerics.neville(p): returns the parent array which describes the polynomial curve through the points in the array p.