Debian Codegraph @

dojox/calc/Readme.txt

raw
1 Dojo Toolkit Graphing Calculator Project Readme
2 Author: Jason Hays
3 Trac ID: jason_hays22
4
5 Contents:
6 Expressions
7 Variables, Functions, and uninitializing variables
8 toFrac in GraphPro
9 Numbers and bases
10 Graphing equations
11 Substitutes for hard to type characters
12 Making Functions
13 Decimal points, commas, and semicolons in different languages
14 Important mathematical functions
15
16
17
18 ---------------Expressions----------------
19 The calculator has the ability to simplify a valid expression.
20 With Augmented Mathematical Syntax, users are allowed to use nonstandard operators in their expressions. Those operators include ^, !, and radical.
21
22 ^ is used for exponentiation.
23 It is a binary operator, which means it needs a number on both the left and right side (like multiplication and division)
24 2^5 is an example of valid use of ^, and represents two to the power of five.
25
26 ! is used for factorial.
27 It supports numbers that are not whole numbers through the use of the gamma function. It uses the number on its left side. Both 2! and 2.6! are examples of valid input in America. (2,6! is valid in some nations)
28
29 radicals can be used for either square root or various other roots.
30 to use it as a square root sign, there should only be a number on its right. If you put a number on the left as well, then it will use that number as the root.
31
32 To evaluate an expression, type in a valid expression, such as 2*(10+5), into the input box. If you are using GraphPro, then it is the smaller text box.
33 After you have chosen an expression, press Enter on either your keyboard or on the lower right of the calculator.
34 If it did not evaluate, make sure you correctly closed your parentheses.
35 In the Standard calculator, the answer will appear in the input box, in GraphPro, the answer will appear in the larger text box above.
36 On the keyboard, you can navigate through your previous inputs with the up and down arrow keys.
37
38 If you enter an operator when the textbox is empty or highlighted (like *) then Ans* should appear. That means the answer you got before will be multiplied by whatever you input next.
39 So try Ans*3. Whenever you start the calculator, Ans is set to zero.
40
41
42 --------------Variables, Functions, and uninitializing variables----------------
43 A variable is basically something that stores a value. If you saw Ans in the previous example, you've also seen a variable.
44 If you want to store your own number somewhere, you'll need to use the = operator.
45
46 Valid variable and function names include cannot start with numbers, do not include spaces, but can start with the alphabet (a-z or A-Z) and can have numbers within the names "var1" is a valid name
47
48 Input "myVar = 2" into the textbox and press "Enter." You've just saved a variable. Now if you ever type myVar into an expression, 2 will appear (unless you change it to something else).
49 Variables are best used to store Ans. Ans is overridden whenever you evaluate an expression, so it is good to store the value of Ans somewhere else before it is overridden.
50
51 If you want a variable (like myVar) to become empty, or undefined, you just need to set it equal to undefined.
52 Now try "myVar = undefined" Now myVar is no longer defined.
53
54 Functions are very useful for finding answers and gathering data.
55 You can use functions by inputting their name and their arguments.
56 For this example, I'll be using the functions named "sqrt" and "pow"
57
58 sqrt is a function with one argument. That argument has a name too, its name is 'x.' x is a very common name amongst built in functions
59 So, let's run a function. Input "sqrt" then input a left parenthesis (all arguments of a function go within parentheses). Now type a value for x, like 2.
60 Now close the parentheses with the right parenthesis. If you used 2, you should have "sqrt(2)" in the text box. If you press enter, you should get the square root of 2 back from the calculator.
61
62 Now for "pow" it has two arguments 'x' and 'y'
63 Type in "pow(" and pick a value for 'x' (I am picking 2 again)
64 but now, you need to separate the value you gave x with a list separator. Depending on your location, it is either a comma or a semicolon. I'm in America, and I use commas.
65 by this point, I have "pow(2,"
66 Now we need a value for 'y' (I'm using 3). Put a ')' and now I have 'pow(2,3)'
67 Press Enter, and, following my example, you should get 8
68
69 In this calculator, there are several ways to input arguments.
70 You've already seen the first way, just input numbers in a specific order based on the names.
71
72 The second way is with an arbitrary order, and storage.
73 With 'pow' I can input "pow(y=3, x=2)" and get the exact answer as before. x and y will retain their assigned values, so you will need to set them to undefined it you want to try the next way.
74
75 The third way is to let the calculator ask you for the values. Input "pow()" If the values have been assigned globally, then it will use those values, but otherwise, it will ask for values of x and y. They will not be stored globally this way.
76
77 I'll go ahead and mention that because of the way the calculator parses, underscores should not be used to name a variable like _#_ (where # is an integer of any length)
78
79 ---------------toFrac()----------------
80 toFrac is a function that takes one parameter, x, and converts it to a fraction for you. It is only in GraphPro, not the Standard mode.
81 It will try to simplify pi, square roots, and rational numbers where the denominator is less than a set bound (100 right now).
82 Immediately after the calculator starts, toFrac may seen slow, but it just needs to finish loading when the calculator starts. After that, it will respond without delay.
83 For an example, input "toFrac(.5)" or (,5 for some). It will return "1/2"
84 For a more complicated example, input "toFrac(atan(1))" to get back "pi/4" (atan is also known as "arc tangent" or "inverse tangent")
85
86 --------------Numbers and bases----------------
87 This calculator supports multiple bases, and not only that, but non integer versions of multiple bases.
88 What is a base? Well, the numbers you know and love are base 10. That means that you count to all of the numbers up until 10 before you move on to add to the tenths place.
89 So, what about base 2? All of the numbers up until 2 are 0 and 1. If you want to type a base 2 number into the calculator, simply input "0b" (meaning base 2) followed by some number of 1's and 0's. 0b101 is 5 in base 10
90
91 Hexadecimal is 0x, and octal is 0o, but i won't go into too much detail on those here.
92 If you want an arbitrary integer base, type the number in the correct base, insert '#' and put the radix on the end. ".1#3" is the same as 1/3 in base 10
93 Because there is not yet cause for it, you cannot have a base that is not a whole number.
94
95 --------------Graphing Equations----------------
96 First thing is first, in GraphPro only, the "Graph" button in the top left corner opens the Graph Window
97 So, now you should see a single text box adjacent to "y="
98 Type the right side of the equation using 'x' as the independent variable.
99 "sin(x)" for example. To Graph it, make sure the checkbox to the left of the equation is selected, and press the Draw Selected button.
100 You can change the color in the color tab. By default, it is black. Under window options, you can change the window size and x/y boundaries
101
102 Let's add a second function. Go to the Add Function button, select the mode you want, and press Create. Another input box will appear.
103 If you selected x= as the Mode, then y is the independent variable for the line (an example is "x=sin(y)").
104 If you want to erase, check the checkboxes you want to erase, and press "Erase Selected"
105 And similarly, Delete Selected will delete the chosen functions
106
107 "Close" will terminate the Graph Window completely
108
109 ---------------Substitutes for hard to type characters---------------
110 Some characters are not simple to add in for keyboard users, so there are substitutes that are much easier to add into the text box.
111
112 pi or PI can be used in place of the special character for it.
113 For epsilon, eps or E can be used.
114 radical has replacement functions. sqrt(x) or pow(x,y) can be used instead.
115
116 --------------Making Functions-----------------
117 My favorite part. Before we start, I'll mention that Augmented Mathematical Syntax is allowed in the Function Generator (yay).
118 Ok, now the bad news: to prevent some security issues, keywords new and delete are forbidden.
119 Sorry, it is a math calculator, not a game container; not that that would be so bad, but it is to keep it from being used for some evil purposes.
120
121 Ok, onto function making. Most JavaScript arithmetic is supported here, but, some syntax was overlapping mathematical syntax, so ++Variable no longer increases the contents of Variable because of ++1, but Variable++ does increase it (same deal with --)
122 Strings have incredibly limited support. Objects have near zero support
123 So, let's make a Function:
124 Press the "Func" button. A Function Window should pop up.
125 Enter a name into the "functionName" box. (it must follow the name guidelines in the variables section) I'm putting myFunc
126 Enter the variables you want into the arguments box (I'll put "x,y" so I have two arguments x and y)
127 Now enter the giant text box.
128 Type "return " and then the expression you want to give to the calculator. I'm putting "return x*2 + y/2"
129 Then press Save. Now your function should appear in the functionName list and you can call it in the Calculator.
130
131 If you want to Delete a function you made, select it in the function Name list, and then press Delete.
132 If you altered a previously saved function (and haven't saved over the old one) you can reset the text back to its original state with the Reset button.
133 Clear will empty out all of the text boxes in the Function Window
134 Close terminates the Function Window
135
136 ---------------Decimal points, commas, and semicolons in different languages----------------
137 In America, 3.5 is three and one half. Comma is used to separate function parameters and list members.
138
139 In some nations, 3,5 is three and one half. In lists, ;'s are used to separate its members.
140 So, when you evaluate expressions, 3,5 will be valid, but in the function generator, some ambiguous texts prevent me from allowing the conversion of that format to JavaScript. So I cannot parse it in the Function Generator.
141 And here is my example:
142 var i = 3,5;
143 b = 2;
144 I cannot discern whether the semicolon between i and b are list separators or the JavaScript character for end the line. b could be intended as a global variable, and i is a local variable, but I don't know that. So language conversion isn't supported in Function Making.
145
146 --------------Important mathematical Functions---------------
147 Here is a list of functions you may find useful and their variable arguments:
148
149 sqrt(x) returns the square root of x
150 x is in radians for all trig functions
151 sin(x) returns the sine of x
152 asin(x) returns the arc sine of x
153 cos(x) returns the cosine of x
154 acos(x) returns the arc cosine of x
155 tan(x) returns the tangent of x
156 atan(x) returns the arc tangent of x
157
158 atan2(y, x) returns the arc tangent of y and x
159 Round(x) returns the rounded integer form of x
160 Int(x) Cuts off the decimal digits of x
161 Ceil(x) If x has decimal digits, get the next highest integer
162
163 ln(x) return the natural log of x
164 log(x) return log base 10 of x
165 pow(x, y) return x to the power of y
166
167 permutations(n, r) get the permutations for n choose r
168 P(n, r) see permutations
169 combinations(n, r) get the combinations for n choose r
170 C(n, r) see combinations
171
172 toRadix(number, baseOut) convert a number to a different base (baseOut)
173 toBin(number) convert number to a binary number
174 toOct(number) convert number to an octal number
175 toHex(number) convert number to a hexadecimal number