95,06,13,23,44
Javascript support the following math functions
[[
Math.E 2.718281828459045091 Euler's constant
Math.LN2 0.6931471805599452862 Natural log of 2
Math.LN10 2.302585092994045901 Natural log of 10
Math.LOG2E 1.442695040888963387 Log base-2 of E
Math.LOG10E 0.4342944819032518167 Log base-10 of E
Math.PI 3.141592653589793116 PI
Math.SQRT1_2 0.7071067811865475 Square root of 0.5
Math.SQRT2 1.414213562373095145 Square root of 2
Math.random() method takes no parameters
Math.abs(val) Absolute value of val
Math.acos(val) Arc cosine (in radians) of val
Math.asin(val) Arc sine (in radians) of val
Math.atan(val) Arc tangent (in radians) of val
Math.atan2(val1, val2) Angle of polar coordinates
Math.ceil(val) Next integer greater than or equal
Math.cos(val) Cosine of val
Math.exp(val) Euler's constant to the power of val
Math.floor(val) Next integer less than or equal to
Math.log(val) Natural logarithm (base e) of val
Math.max(val1, val2) The greater of val1 or val2
Math.min(val1, val2) The lesser of val1 or val2
Math.pow(val1, val2) Val1 to the val2 power
Math.random() Random number between 0 and 1
Math.round(val) N+1 when val >= n.5; otherwise N
Math.sin(val) Sine (in radians) of val
Math.sqrt(val) Square root of val
Math.tan(val) Tangent (in radians) of val
]]
for
hyperbolic cosine, use
0.5*(Math.exp(x)+Math.exp(-x))
hyperbolic sine, use
0.5*(Math.exp(x)-Math.exp(-x))
2006-06-14-08-11 start
This program is received on 2006-06-12
2006-06-12-19-38
http://webdeveloper.earthweb.com/repository/javascripts/2006/05/835871/Graph.htm
2006-06-12-19-41
http://webdeveloper.earthweb.com/repository/javascripts/2006/05/835871/JavascriptGraph.js
This program plot mathematics functions.
It has limitation, this program plot only
y = f(x) type equation. A vertical straight
line can intersect with curve at one point
only. It can not plot a whole circle, it
does plot upper or lower half circle.
Freeman receive this program and begin to
learn Javascript graph function. Today
I do not understand graph code. But I
improved a little bit at non-graph
section. They are
1. Allow Math.exp() and Math.max() to work.
Original program replace 'x' in 'f(x)'
with numerical value 0.2 for example.
'Math.exp(x)' become 'Math.e0.2p(0.2)'
which cause error.
Improved code please see '9506131823'
2. Add ten equations, allow user get easy
trial.
3. Rearrange page appearance, let graph
get most display area. Draw back is
that open/close code in Netscape get
trouble. Not open !
You can use this program
http://freeman2.com/graph01e.htm in MSIE
If you want to use Netscape, please goto
original author's page at
http://webdeveloper.earthweb.com/repository/javascripts/2006/05/835871/Graph.htm
If you like to keep the curve you plot.
Press and hold control-key, then press
'prt scr' key. Next open Paint.exe and
paste the screen picture to Paint. Select
the curve and copy or cut.
Freeman 2006-06-14-08-32
First time Upload 2006-06-14-17-25
JavaScript program list
http://freeman2.com/jsindex2.htm
Great Circle page (JavaScript program)
http://freeman2.com/jscircle.htm
Small Circle page (JavaScript program)
http://freeman2.com/jscircl2.htm
You specify city Longitude/Latitude value.
Circle program output the circle equation
in spherical coordinate which pass the
cities you specified. Circle locus printed.
|