When referring to previously-stored answers in the ANSWER menu, recursive notation can be used in which the index i refers to the current calculation number, i-1 refers to the previous, i-2 to the answer of two calculations ago, and so forth. This notation allows recursive values to be calculated quickly. For example, to calculate the factorials between 1 and 30, the following two formulas could be entered and stored:
The DATA SETS menu allows sets of data points to be created, edited and deleted. Points are entered in ordered pair (x,y) format on a data entry screen, as shown at right. If more than 20 data points exist in a data set, scroll through the set as necessary using the forward (>>) and backward (<<) buttons. The Insert button allows a new data point to be inserted between existing points. To delete a data point, simply clear its x and y values. Use the Done button to save a set of data points and return to the main graph module screen. There is no limit (other than available computer RAM) to the number of data sets that can be created. Like functions, data sets are plotted on the graph, and can be toggled between hidden and displayed status using the DATA SETS menu.
Once a data set has been created, various types of curves can be fit to the data set using a least-squares algorithm to determine the curve of best fit. Available curve types are listed in the REGRESSION menu, and include linear, parabolic, square root, inverse, inverse square, exponential and logarithmic. When fitting a set of data points with a curve, each curve parameter can be constrained to a specific value, or else calculated by the least-squares regression algorithm. Generally, a parameter constraint is applied when the logic of a particular experiment requires that the best-fitting trendline pass through a particular point or have a particular asymptote. For instance, shown at left is a small set of data that seem to lie along a parabola, y=a(x-b)2+c. The first curve is a parabolic regression using no constraints. The second curve invokes the constraints of both b=0 and c=0, so that the parabola is confined to have its vertex at the origin. If the data had been measured for a ball rolling down an inclined plane, for which the known position of the ball was y=0 meters at a time of x=0 seconds, then only the second of these two curves would make logical sense.
Some types of best-fitting curves are more difficult to calculate than others. In simple cases, SVGcalc can determine a best-fitting curve analytically, but in other cases it must use methods of numerical approximation. The numerical approach, unfortunately, contains the potential pitfall that the regression algorithm can occasionally find the wrong solution to the regression formulas! Such cases are fairly self-evident, because the best-fit curve returned by the algorithm makes no sense. In these situations, the regression algorithm requires some intelligent help regarding the domain vicinity in which the fit parameter solution (always parameter b) will be found. Providing an intelligent starting point is called "seeding" the algorithm. For this purpose, the parameter constraint dialog box accepts a variable called bseed which instructs the regression algorithm where to start in its numerical search for parameter b. Shown at left is a small set of data that might describe repeated vertical bounces of a ball, for instance. Each has been fit with an exponential curve, y=a*ebx+c, with constraints of a=100 and c=0. In the first case, which was conducted without seeding, the algorithm returned a senseless function that nearly aligns with the x and y axes. In the second case, in which bseed=-0.2 was provided to the algorithm, the proper best-fit curve was returned.
SVGcalc graphs are interactive. Clicking on a plotted function reveals a menu of options. Functions can be traced, revealing their (x,y) ordered pair values, or the color or line style of a function can be changed. Likewise, clicking on a data point allows changes to the color or symbol of the data set. Double clicking the graph background displays options for creating text labels, changing background color or resizing the graph window (zoom in by a factor of 2, zoom out by a factor of 2, zoom in or out by a variable factor, and zoom to a new selected window). Once a text label has been added to a graph, clicking on it allows changes to its location, color or size. Text labels can also be unattached to the graph (they will not be affected by changes to the graph window) or attached to the graph (they will remain at fixed coordinate locations, moving as the graph window changes). Clicking on the outer graph boundary displays graph and axis title options. When changing the color of a graph element, colors can be specified using color names (SVG supports 147 color names) or RGB triplet notation (red, green and blue hues numerically specified in the range of 0-255).


Differentiation is the mathematical process by which the slope of a function is determined. As shown at right, the slope of a function is the same as the slope of a line segment that is tangent to the function, or that parallels the function and touches it at only one point. Numerical differentiation proceeds by finding the slope of a line segment that joins two nearby points on the function, and then bringing these two points closer and closer together until they converge at the single point of interest. To differentiate a function, enter the function equation in the f(x)= field, enter the domain value for which the slope is desired in the x= field, and push the = button. If the function equation contains trigonometric expressions, they will be evaluated according to the angle mode (degree or radian) displayed on the face of the calculator.
Integration is the mathematical process by which the area under a function is determined. As shown at right, numerical integration proceeds by breaking a total area under the curve of a function into small increments, approximating the area of each increment using a geometric figure, and adding these together. In the midpoint method of numerical integration, rectangles are constructed at regular intervals along the function domain. In the trapezoid method, trapezoid-shaped increments are used rather than rectangles. In all types of numerical integration, the greater the number of increments used, the more closely the result will approximate the exact value of an integral (that is, the exact area underneath the function curve). To integrate a function, enter the function equation in the f(x)= field, enter the extremities of the domain region in the Lower bound and Upper bound fields, enter the number of calculation intervals to be used in the Increments field, and push the = button.
|
Name: nPr(n,r) Program code: return fact(n)/fact(n-r); |
Name: nCr(n,r) Program code: return fact(n)/(fact(n-r)*fact(r)); |
|
Name: quadRoot(A,B,C) Program code: var rootPos=(-B+sqrt(B*B-4*A*C))/(2*A); var rootNeg=(-B-sqrt(B*B-4*A*C))/(2*A); alert("The quadratic equation has solutions x="+rootPos+" and x="+rootNeg); return rootPos; |
|
Name: mean() Program code: var sum=0, n=0, done=false, next_val; while(!done){ next_val=prompt("Enter value ('d' when done):"); if(next_val=="d"){done=true} else{n++; sum+=parseFloat(next_val)}}; return sum/n; |