Difference between revisions of "Mathematical functions"

From JSXGraph Wiki
Jump to navigationJump to search
(New page: ==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...)
 
Line 16: Line 16:
 
* Math.sqrt;
 
* Math.sqrt;
 
* 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.
 +
That means, initially a board has to be created, for example with the command
 +
<source lang="javascript">
 +
board = JXG.JSXGraph.initBoard('box', {originX: 250, originY: 250, unitX: 40, unitY: 40});
 +
</source>
 +
Then, the object ''board'' contains the following additional mathematical functions:
 +
* board.angle(A, B, C)
 +
* board.rad(A, B, C)
 +
* board.distance(arr1, arr2)
 +
* board.pow(a, b)
 +
* board.round(x, n)
 +
* board.cosh(x)
 +
* board.sinh(x)
 +
* board.D(f)
 +
* board.I(interval,f)
 +
* board.root(f,x)

Revision as of 14:03, 25 January 2009

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. To keep the JavaScript implementations clean, the new mathematical functions are part of the JSXGraph board. That means, initially a board has to be created, for example with the command

board = JXG.JSXGraph.initBoard('box', {originX: 250, originY: 250, unitX: 40, unitY: 40});

Then, the object board contains the following additional mathematical functions:

  • board.angle(A, B, C)
  • board.rad(A, B, C)
  • board.distance(arr1, arr2)
  • board.pow(a, b)
  • board.round(x, n)
  • board.cosh(x)
  • board.sinh(x)
  • board.D(f)
  • board.I(interval,f)
  • board.root(f,x)