-
Notifications
You must be signed in to change notification settings - Fork 27
Expand file tree
/
Copy pathmath.html
More file actions
87 lines (84 loc) · 4.39 KB
/
Copy pathmath.html
File metadata and controls
87 lines (84 loc) · 4.39 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"><!-- InstanceBegin template="/Templates/template.dwt" codeOutsideHTMLIsLocked="false" -->
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<!-- InstanceBeginEditable name="doctitle" -->
<title>math functions</title>
<!-- InstanceEndEditable -->
<!-- InstanceBeginEditable name="head" -->
<link href="VisualRef.css" rel="stylesheet" type="text/css" />
<!-- InstanceEndEditable -->
<link href="VisualRef.css" rel="stylesheet" type="text/css" />
</head>
<body>
<table width="230" height="30" border="0">
<tr>
<td width="66"><a name="top" id="top"></a><a href="index.html"><strong>Home</strong></a></td>
<td width="154"><span class="Normal"><a href="primitives.html"><strong>Pictures</strong></a> of 3D objects</span></td>
</tr>
</table>
<table width="438" height="30" border="0">
<tr>
<td width="151"><select id="menu1" onchange="jumpMenu(this)">
</select></td>
<td width="163"><select id="menu2" onchange="jumpMenu(this)">
</select></td>
<td width="110"><select id="menu3" onchange="jumpMenu(this)">
</select></td>
</tr>
</table>
<table width="454" border="0" cellpadding="0" cellspacing="0">
<!--DWLayoutDefaultTable-->
<tr>
<td width="454" rowspan="2" valign="top"><!-- InstanceBeginEditable name="content" -->
<h1 class="Heading-1"> <font color="#0000A0">Math Functions</font></h1>
<p class="Normal">The following math functions are provided:</p>
<p class="program">abs(x)<br />
sqrt(x)<br />
sin(x)<br />
cos(x)<br />
tan(x)<br />
asin(x) # arc sine<br />
acos(x) # arc cosine<br />
atan(x) # arc tangent<br />
atan2(y,x) # angle whose tangent is y/x<br />
exp(x) # e to the x<br />
log(x) # natural log, base e<br />
# log(x)/log(10) gives log base 10<br />
pow(x,y) # x to the power y<br />
pi # 3.14159.... <br />
ceil(x) # round up to nearest integer<br />
floor(x) # round down to nearest integer<br />
round(x) # round to nearest integer <br />
max(x,y,z) # the largest of x,y,z<br />
min(x,y,z) # the smallest of x,y,z<br />
random() # pseudorandom number 0 to 1<br />
factorial(x) # x! = x*(x-1)*(x-2)....(1)<br />
combin(x,y) # x!/(y!*(x-y)!)<br />
max(a,b,c,..) # maximum of these<br />
min(a,b,c,..) # minimum of these</p>
<p class="Normal">Many of the quantities above are simplified forms of the JavaScript functions Math.abs(x), Math.sqrt(x), etc. <strong><a href="factorial.html">Here are details</a></strong> of the factorial and combin functions.</p>
<p class="Normal">There are functions for converting between degrees and
radians, where there are 2*pi radians in 360 degrees: </p>
<p class="program">radians(360) # equal to 2*pi<br />
degrees(2*pi) # equal to 360</p>
<p class="Normal">See JavaScript documentation on the <strong><a href="http://www.w3schools.com/jsref/jsref_obj_date.asp" target="_blank">Date</a></strong> object which provides methods for determining the current day etc. </p>
<p class="Normal">Here is a way to determine elapsed time in seconds, with microsecond accuracy, using the clock() function that is also available in the standard Python "time" module. The displayed text is approximately 1.5:</p>
<p class="program">t1 = clock()<br />
sleep(1.5,wait)<br />
t2 = clock()<br />
print(t2-t1)</p>
<p class="Normal">JavaScript:</p>
<p class="program">var t1 = clock()<br />
sleep(1.5,wait)<br />
var t2 = clock()<br />
print(t2-t1)</p>
<p class="Normal"></p>
<p class="Normal">There is also a function msclock() which gives the time in milliseconds instead of seconds.</p>
<!-- InstanceEndEditable --></td>
</tr>
</table>
<p><a href="#top"><strong>Top of page</strong></a></p>
</body>
<script type="text/javascript" language="javascript" src="navigation.js"></script>
<!-- InstanceEnd --></html>