Mathematical functions: Difference between revisions

From JSXGraph Wiki
No edit summary
No edit summary
 
(7 intermediate revisions by 2 users not shown)
Line 17: Line 17:
* ''Math.tan'';
* ''Math.tan'';


JSXGraph expands the set of available mathematical functions. To keep the JavaScript implementations clean, the new mathematical functions are part of the JSXGraph board.
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. Here is an excerpt of what can be found in JSXGraph, for a full list please consult our reference: http://jsxgraph.uni-bayreuth.de/docs/
That means, initially a board has to be created, for example with the command
 
<source lang="javascript">
* ''JXG.Math.Geometry.angle(A, B, C)'': for Point objects A, B, C. (A: name string, id string or object pointer)
board = JXG.JSXGraph.initBoard('box', {originX: 250, originY: 250, unitX: 40, unitY: 40});
* ''JXG.Math.Geometry.rad(A, B, C)''
</source>
* ''JXG.Math.Geometry.distance(arr1, arr2)'': Euclidean distane between two vectors
Then, the object ''board'' contains the following additional mathematical functions:
* ''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.
* ''board.angle(A, B, C)'': for Point objects A, B, C. (A: name string, id string or object pointer)
* ''JXG.Math.cosh(x)''
* ''board.rad(A, B, C)''
* ''JXG.Math.sinh(x)''
* ''board.distance(arr1, arr2)'': Euclidean distane between two vectors
* ''JXG.Math.Numerics.D(f)'': Numerically computed derivative of the function ''f'', returns a function.
* ''board.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.Numerics.I(interval,f)'': Numerically computed v alue integral of the function ''f'' in the given interval.
* ''board.round(x, n)'': returns string with fixed point representation of ''x''. May be replaced by string.tofixed(n).
* ''JXG.Math.Numerics.root(f,x)'': root of the function f. Uses Newton method with start value ''x''.
* ''board.cosh(x)''
* ''JXG.Math.factorial(n)'': computes <math>n! = n\cdot(n-1)\cdots2\cdot 1</math>.
* ''board.sinh(x)''
* ''JXG.Math.Numerics.lagrangePolynomial(p)'': returns a function which describes the Lagrange polynomial through the points in the array ''p''.
* ''board.D(f)'': Numerically computed derivative of the function ''f'', returns a function.
* ''JXG.Math.Numerics.Neville(p)'': returns the parent array which describes the polynomial curve through the points in the array ''p''.
* ''board.I(interval,f)'': Numerically computed v alue integral of the function ''f'' in the given interval.
* ''board.root(f,x)'': root of the function f. Uses Newton method with start value ''x''.

Latest revision as of 19:07, 18 January 2013

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. Here is an excerpt of what can be found in JSXGraph, for a full list please consult our reference: http://jsxgraph.uni-bayreuth.de/docs/

  • 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]\displaystyle{ 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]\displaystyle{ 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.