Chadia Affane Aji (Tuskegee University), Lauretta Garrett (Tuskegee University), & Saad Biaz (Auburn University)
Alabama Journal of Mathematics, Volume 37 (2013)
Abstract. Powerful computers and mathematics programming languages, such as MATLAB© and Scilab™, offer opportunities to build a clear understanding of the key concepts of mathematics, science, and engineering. MATLAB© is a powerful computing and graphing tool widely used in academia and industry. Many college students, however, will not need or be able to afford MATLAB© to enhance their learning of mathematics. Scilab™ is a free open-source alternative to MATLAB© that allows students to experience a mathematics programming language and some of the opportunity for learning that such software provides. It allows interested teachers to introduce students to mathematics concepts through experiential learning that can build their mathematical confidence, creativity, and ability to communicate mathematically. In this paper, we will demonstrate some of the basic features of Scilab™ software and its educational use as an introductory mathematical programming language in college calculus.
Today’s college instructors are preparing students for a world that is rapidly changing. All students will need to be innovators and develop new skills at any time if they are to survive in a world in which all jobs that are routine will eventually disappear (Wagner, 2011). In addition to the need to train future innovators, college instructors must also work on a very tight time frame compared to the
Mathematics technology is most beneficial to students when its use is aligned with the ultimate educational goal of future professional and personal success (Fitzsimons, 2005). Professional use may include the application of mathematics to non-mathematical objectives. Mathematical programming languages may be particularly pertinent to such objectives in that they promote the ability to think creatively, logically and
Mathematical Programming Languages
Mathematical programming languages (MPLs) offer students the opportunity to move beyond the software that is customarily used in secondary mathematics education. MPLs require students to have an understanding of the logical flow of mathematical ideas and to translate that logical flow to a language other than standard mathematical notation. They also must have sufficient mathematical understanding to know whether or not that communication has been successful.
MPLs can help students make connections with mathematical ideas and recognize their own thinking processes (Stevens et al, 2008). Working through programming challenges can build student confidence and help them learn that failure provides an opportunity to try something new. Programming experiences can also help students increase in creativity and in their ability to communicate mathematical ideas verbally (Stevens et al, 2008). One MPL commonly used in higher education and industry is MATLAB©(Mathworks, 2012), a high-level programmable mathematics software language that can perform computationally intensive tasks, including symbolic calculations. The name MATLAB©
Scilab™
Scilab™ (Scilab, 2011) is a free open-source mathematics software powerful enough to provide MPL functionality that supports both research and teaching. Although one of its main uses is for matrix computations, it also includes powerful 2D and 3D graphing capability. It is widely applicable in the classroom, accessible to students with limited mathematics technology experience or as an easily learned open-source supplement for those who have experience with MATLAB©. Scilab™’s easy accessibility and open-source nature make it a valuable tool for introducing students to the use of

Basic examples will help students to see the functionality of Scilab™ and how it differs from other technological resources often used in college calculus. Because it is a programming language, it encourages students to consider mathematical concepts in terms of the logical flow of those concepts. Among the programming ideas found in Scilab™ that beginning college mathematics students may not have been exposed to is the “for-end” loop.
The basic “for-end” loop has the form:
for k = m:s:n set of commands end
Where k is the loop index variable, m is the value of k in the first pass, s is the increment
Scilab™ code entered in the command window:
-->for k=1:3:10 -->x=k.^2 -->end
Scilab™ output:
x = 1. x = 16. x = 49. x = 100.
Scilab™ can also be used to create and save valuable MPL programs. A simple example demonstrating the consideration of mathematical concepts is the decision as to whether or not a given scalar variable is positive, negative or zero. The mathematics involved in that decision is embedded in the Scilab™ program below, in which a function is defined using an “if-else-end” loop. The “if-else-end” loop tells the software to examine the number the function is evaluating and display an appropriate message if that number is positive, negative, or zero. The task is “Write a function that displays one message if a scalar variable is positive, one message if it is negative, and
Scilab™ code defining a function:
function isposnegzero(x) if x>0 disp('The number is positive') elseif x<0 disp('The number is negative') else disp('The number is 0') end endfunction
Scilab™ use of the defined function:
-->isposnegzero(5) The number is positive -->isposnegzero(-17.5) The number is negative -->isposnegzero(0) The number is 0
Note that the Scilab™ code entered above incorporates the understanding that zero is neither positive nor negative. We have defined a function and shown how that function can then be used in Scilab™. Students may also wish to try additional function definitions after trying the example above.
Although other open source MPLs are available, Scilab™ appears to be the most compatible with MATLAB©. It is also thought to be at least as problem free as other alternatives, takes up less disk space than some of the other options, and is easier than they are to work with at the outset (Heikell, 2011). Many of its
Using Scilab™ in College Calculus
In examining the effect of technology on the development of mathematical concepts, Heid and Blume (2008) noted that technology can promote the development of initial concepts that lead to more sophisticated concepts and improved understandings. Scilab™'s lack of algebraic power may be an educational advantage in that it forces students who are grappling with the initial concepts of calculus to carefully consider numerical ideas and solve problems in different ways. It can allow them to examine particular mathematical ideas, such as the intermediate value theorem, more closely by forcing them to consider numerical solutions rather than algebraic solutions. Such use is in line with the idea of developing a conceptual understanding of initial ideas that may later lead to a deeper understanding of more sophisticated ideas. Scilab™'s lower functionality may also be an advantage in that it limits the learning focus of beginning MPL students during their indoctrination to the syntax and logic of programming.
Introductory Activities
When students first open the Scilab™ console, they might need to use the "help" command to see how a built-in function can be utilized. For instance, by entering "help" after the prompt followed by the name of the built-in function, basic help on the requested function is then displayed as seen in Figure 2.

For the usage of any function by category, type "help" after the prompt and execute to access the general help menu. Simply clicking on the question mark on the Scilab™ console will also provide access to the help menu.
Beginning activities for students can be designed to help them become more quickly familiar with the program's functions. Students might work through the following examples and build on them as they wish. As an example of a first task, consider the following problem.
Of the elements of the following set, which has the minimum value?
$latex
\[ \{5, sin(-2), 71/2, log(5), |-1|, sin(p)\} \]
This problem incorporates a review of pre-calculus symbols and ideas that students may wish to access for their calculus work. Once students have considered what the solution might be, they can then use Scilab™ to find the actual solution. The
-->a = min(5, sin(-2), sqrt(7), log10(5), abs(-1), sin(%pi)) a = - 0.9092974
The solution of a system of three equations in three unknowns can be used for multiple purposes. It allows students to review the importance of matrix operations and their helpfulness in solving such systems. It also can introduce students to the idea of right division, and allow them to consider different ways to use the software to solve the same problem. The following problem will serve as an example.
Solve the following system of equations using matrix techniques.
\[4x - 2y + 6z = 8 \\
2x + 8y + 2z = 4\\
6x + 10y + 3z = 0 \\ \]
Instructors may wish to ask students to consider what matrices and operations will help them solve this system before they enter that information into Scilab™. One possible solution, which uses right division, is shown below. Students may also enter the alternative "x = inv(A)*b" and execute to find the solution. Instructors may wish to discuss the relationship between the two methods of solution.
-->A = [4 -2 6; 2 8 2; 6 10 3]; b=[8;4;0];x=A\b x = - 1.804878 0.2926829 2.6341463
In addition to numerical work as has been shown above, Scilab™ offers opportunities for graphical examinations. Some of the graphical approaches available through technology are not available otherwise and examining such representations may contribute to students� improved visual reasoning (Heid & Blume, 2008). We will now look at some of the graphical opportunities Scilab™ provides.
Graphing
Many different types of graphs can be produced with Scilab™, including x-y plots ("plot"), contour plots ("contour"), 3D plots ("surf" or "plot3d"), histograms ("histplot"), and bar charts ("bar"). Figure 3 shows a set of commands that will graph two plots on one x-y plane and the graphing window that results when these commands are executed. Note that the x-values are entered first then the functions are defined. Such a command structure requires the student to consider the domain segment and scale that will provide the best graphical information. Following this, the plot command is given and it includes code defining the format of the graph (for example, "- - r" to indicate a dashed red line). Titles, axis labels, and legend complete the instructions.
The code for graphing:
x=0:%pi/20:2*%pi; y1=sin(2*x); y2=2*cos(2*x); plot(x,y1,'o-',x,y2,'--r'), title('The function y=sin(2x) and its derivative on the same plot'), xlabel('x'), ylabel('y'), legend(['sin(2*x)';'2*cos(2*x)'])
Executing this code after saving it in the Scilab™ editor produces the following graph.

Note that the x-axis and y-axis are not centered at the origin. This can be done by including the following commands in the code.
a=gca(); a.x_location = "origin"; a.y_location = "origin";

A topic well suited to the use of technology that can be investigated using both the numerical and graphical features of Scilab™ is the Intermediate Value Theorem. In the following example, students have been asked to use the Intermediate Value Theorem to show that the function \(f(x)=cos(x)−xf(x)=cos(x)−x\) has a zero in the interval (0,1). With Scilab™ commands, they first define the function as follows
-->function y=myfun(x) --> y=cos(x)-x -->endfunction
Then they evaluate the function at the endpoints of the given interval, as seen here.
-->y1=myfun(0) y1 = 1. -->y2=myfun(1) y2 = - 0.4596977
Since y1=1, that is f(0) = 1 > 0 and y2=-0.46, that is f(1) = -0.46 < 0, then by the Intermediate Value Theorem, there is a number c in (0, 1) such that f(c)= 0. Using technology in this way places the focus on the concept, and that concept is not overshadowed by errors in the execution of numerical operations.
Students may also investigate the Intermediate Value Theorem by graphing the function and comparing the numerical and graphical work. The graph is seen in Figure 5 below. The Scilab™ commands to graph this function in the interval [-1, 2] are
-->x=-1:0.1:2; plot(x,cos(x)-x),

As students continue through the semester, not only can they learn to use both graphs and numerical techniques and compare the two, they can also continue to learn the features of the software. Note that here the function argument is entered directly into the plot command. Note also that the position of the x
-->myfun(0.7) ans = 0.0648422
Key Calculus Topics
As the semester progresses and students gain facility with Scilab™ they can increasingly be given the responsibility of suggesting uses for the software regarding the investigation of Calculus topics. At
function y=myfct(x) //create a function y = sin(x)/x endfunction x=[-0.5;-0.3;-0.2;-0.1;-0.05;-0.01]; //take values close to 0 from the left xx = -x; //take values close to 0 from the right y=zeros(length(x),1); yy=zeros(length(x),1); for i=1:length(x) //the values of f(x) y(i)=myfct(x(i)) yy(i)=myfct(xx(i)) end printf('x f(x)'),printf('\n %g %f',x,y) //print the output printf('\n\nx f(x)'),printf('\n %g %f',xx,yy)
Note that this work introduces students to the use of
x f(x) -0.5 0.958851 -0.3 0.985067 -0.2 0.993347 -0.1 0.998334 -0.05 0.999583 -0.01 0.999983 x f(x) 0.5 0.958851 0.3 0.985067 0.2 0.993347 0.1 0.998334 0.05 0.999583 0.01 0.999983
Students will be able to see from the Scilab™ output that the values of the function seem to approach 1 as x approaches 0 either from the left or from the right. This can also be illustrated by the graph of the function seen in Figure 6.

The Scilab™ commands for the above graph (Figure 6) are:
//Graphing X=-1.5:0.1:-0.01; XX=0.01:0.1:1.5; //longer vectors for smooth graph Y=zeros(length(X),1); YY=zeros(length(XX),1); for i=1:length(X) //the values of f(x) Y(i)=myfct(X(i)) YY(i)=myfct(XX(i)) end plot(X,Y,'r',XX,YY,'b')
Such technology work can help students to see numerically and graphically why we conclude that the limit of the function \(f(x)=sin(x)/x\) as \(x\) approaches 0 is 1, building
Once students have developed an understanding of the ideas of limits and associated uses of the software, they will be prepared to use the software more independently to investigate the formal definition of the derivative of a function. This definition states that the derivative of the function \(f\) at the point \((a,f(a))\) is the slope of the tangent line to the graph of \(f\) at this point. More formally:
Definition: The tangent line to \(y=f(x)\) at the point \((a,f(a))\) is the line through \((a,f(a))\) whose slope is \(\lim_{h\rightarrow 0} \frac{f(a+h)-f(a)}{h} \). This slope is called the derivative of \(f\) at \(a\), denoted by: \(f'(a)= \lim_{h\rightarrow 0} \frac{f(a+h)-f(a)}{h}\).
A graphical discussion, with or without technology, can lead students to a visual understanding of the use of h in this definition that will prepare them for their Scilab™ work. The graphical discussion can help students see that h is approaching zero so that the calculation can approach the slope of a tangent line at one point on the curve. They can then apply this definition of derivative to find the derivative of a given function at one point on the curve using Scilab™'s numerical capabilities. Assume students are asked to find the derivative of \(f(x)=\sqrt{x}\) at 1 using the definition. They can then find the limit: \(f'(1)= \lim_{h \rightarrow 0} \frac{f(1+h)-f(1)}{h}\) numerically as done in the previous example. Documented Scilab™ commands for solving this problem are:
function y=myfun(x) //create a function y = sqrt(x) endfunction h=0.1:-0.01:0.01; hh=h'; //h becomes very very small dy1=zeros(length(h),1); for i=1:length(h) //the values of f(x) dy1(i)=(myfun(1+hh(i))-myfun(1))/hh(i) end printf('h (f(1+h)-f(1))/h'),printf('\n %g %f',hh,dy1) //print the output
The output of these commands is
h (f(1+h)-f(1))/h 0.1 0.488088 0.09 0.489229 0.08 0.490381 0.07 0.491543 0.06 0.492717 0.05 0.493902 0.04 0.495098 0.03 0.496305 0.02 0.497525 0.01 0.498756
If we make h very small (very close to 0), we get from Scilab™
h (f(1+h)-f(1))/h 0.01 0.498756 0.009 0.498880 0.008 0.499004 0.007 0.499128 0.006 0.499252 0.005 0.499377 0.004 0.499501 0.003 0.499626 0.002 0.499750 0.001 0.499875
Students will see from the Scilab™ output that if h gets very small then \(\frac{f(1+h)−f(1)}{h}\) gets closer and closer to 0.5. Hence, we found the limit numerically. That is \(f'(1)= \lim_{h \rightarrow 0} \frac{f(1+h)-f(1)}{h}= \frac{1}{2}\) .
Such technological exercises can help students to build a more connected conceptual understanding of the formal definition of limit, as they will have the numerical work to connect with the graphical explanations and discussions.
Scilab™'s numerical power includes the evaluation of definite integrals in two ways (Scilab™ does not symbolically solve indefinite integrals). For one way, we define a function then use the command "
-->function y = f1(x) --> y = cos(x) --> endfunction --> intg(0, %pi/2, f1) ans = 1.
The other way is by simply using the "integrate" command, as shown here.
-->A=integrate('cos(x)', 'x', 0, %pi/2) A = 1.
Such numerical uses of the software will facilitate learning best when the purpose of the instruction is not to teach the methods of
Beginning Programming
A focus on
The function \(f(x)=e^x\) can be represented in a Taylor series by \(\sum_{n=0}^\infty \frac{x^n}{n!}\). Write a program that evaluates \(f(x)=e^x\) for particular values of \(x\) using the Taylor series representation.
Such a task involves logical reasoning about the nature of an infinite series and the application of programming logic so that the series can be used to answer the question sufficiently. Depending upon how much instruction in Taylor Series has preceded this task, instructors may wish to allow students to begin thinking about how they might use the software and allow the issue of sufficient approximation to naturally arise as students wrestle with the problem. Once that issue arises, their questions may then be: How can I tell the software to stop the series calculation when the approximation is sufficiently close? How will I decide what "sufficiently close" means? This idea can lead beginning programmers into the type of thinking involved in programming logic. The mathematical ideas and the functionality of the "while-end", "if-then-else" functions of the software will then be conceptually connected to the mathematical idea of a Taylor Series expansion.
//Taylor series representation of e^x x=input('Enter x '); n=1;an=1;S=an; while abs(an)>=0.001 & n<=30 an = x^n/factorial(n); //Calculating the nth term S = S + an; //Adding the nth term to the sum n = n + 1; //Counting the number of passes end if n >= 30 disp('More than 30 terms are needed') else printf('exp(%g) = %f',x,S) printf('\nThe number of terms used is:\n n=%i',n44 ) end
This programmer solved the problem by determining that once the terms in the series are smaller than one ten-thousandth, later terms can be ignored and there will be sufficient accuracy. An additional consideration was the number of terms the programmer wanted the program to use. When more than 30 terms were needed for sufficient accuracy, the program was designed to stop the calculation and display the message that more than 30 terms were needed. Such mathematical decisions are examples of the type of thinking that arises through the introduction of MPLs to introductory calculus instruction. A student creating such a program needed some understanding of the nature of a Taylor Series expansion and its continued addition of more finely grained terms as providing an increasingly accurate representation of the function it depicts in order to make those decisions.
Conclusion
Scilab™ does have limitations. It does not perform symbolic manipulations, and its graphics component is weak compared to that of MATLAB©. Nevertheless, careful integration of Scilab™ into college calculus can provide students with a valuable resource for varied professional goals. It provides them with a powerful tool for the investigation of mathematical ideas using alternative representations that foster reasoning and sense-making. The activities introduced can follow a sequence of progressively more sophisticated ideas. Successful student programming that addresses such ideas can increase their confidence, creativity, and ability to communicate mathematically. Confidence, reasoning, and creative thinking are needed by those who would be the innovators of the future.
In addition to the inherent benefits regarding the study of the mathematics itself, the integration of an MPL such as Scilab™ can provide
Excellent resources are freely available to support instructors who wish to follow-up students' Scilab™ work with instruction in MATLAB©, for
References
- Cai, J. J., Smith, D. K., Xuhua, X., & Kwok-yung, Y. (2005). MBEToolbox: a Matlab toolbox for sequence data analysis in molecular biology and evolution. BMC Bioinformatics, 6, 64-68. doi:10.1186/1471-2105-6-64
- Fitzsimons, G. E. (2005). Technology mediated post-compulsory mathematics: An activity theory approach. International Journal of Mathematical Education in Science & Technology, 36(7), 769-777.
- Fuller, M. (2002). The role of mathematics learning centres in engineering education. European Journal of Engineering Education, 27(3), 241.
- Heid, M. K., & Blume, G. W. (2008). Algebra and function development. In M. K. Heid & G. W. Blume (Eds.), Research on technology and the teaching and learning of mathematics: Volume 1. Research Syntheses (Vol. 1, pp. 55-108). Charlotte, NC: Information Age Publishing.
- Heikell, J. (2011). Scilab for real dummies: Introducing an open-sources alternative to Matlab.HTML
- Mora, A., Galan, J. L., Aguilera, G., Fernandez, A., Merida, E., & Rodriguez, P. (2010). Scilab and Maxima Environment: Towards Free Software in Numerical Analysis. International Journal for Technology in Mathematics Education, 17(2), 75-80.
- Santos-Trigo, M. (2002). Students� use of mathematical representations in problem solving. Mathematics and Computer Education, 36(2), 101-114.
- Scilab Enterprises. (2011). Scilab (Version 5.3.3). Orsay Cedex, France: Scilab Enterprises.
- Skouras, A. S. (2006). Coordinating Formal and Informal Aspects of Mathematics in a Computer Based Learning Environment. International Journal of Mathematical Education in Science and Technology, 37(8), 947-964.
- Stevens, T., To, Y., Harris, G., & Dwyer, J. (2008). The LOGO project: Designing an effective continuing education program for teachers. Journal of Computers in Mathematics & Science Teaching, 27(2), 195-219.
- The Mathworks Inc. (2012). MATLAB Software (Version V7.14). Natick, Massachusetts: The Mathworks, Inc.
- Urroz, G. E. (2001). Comparison of Scilab syntax and functions to MATLAB. Civil and envrionmental engineering. infoClearinghouse.com. Utah State University.
- Urroz, G. E. (2002). Using MATLAB after learning SCILAB. Civil and envrionmental engineering. Utah State University. Website
- Wagner, T. (2011). Teaching, learning, and leading in the 21st century. Paper presented at the Learning and the Brain conference: Preparing 21st century minds: Using brain research to enhance cognitive skills for the future Boston, MA.