MateOnLine: web application to use mathematica locally

A web application has been developed using the Microsoft .NET technology, which allows to use the Mathematica software from any personal computer connected to Internet. 
 
It is not necessary to have the Mathematica software in the own computer, therefore the requirements ale limited to have a web browser. 
 
All the power of a high level package for numerical and symbolic calculation can be used with no need to spend great amounts of money in individual licenses. 
 
This allows students to use this software from their houses, by means of a simple interface, in any subject or project with mathematical calculations, even to attend virtual laboratories.


Evolution of Education towards e-Learning
The education in general and higher education in particular have presented important changes in the last years as far as the use of new tools in order to improve the quality of education and to induce the meaningful learning.This has been due to the technological innovations, especially in the areas of the Telematics or Computer Science, arising e-Learning like a new model of learning based on Internet and the electronic applications.
Internet is a tool that can be used in any field of Education, both in university and school or in the business world, where it represents a fast and effective alternative for the qualification and training necessities before investing in a certain project of a company.Using e-Learning as education system some of the main problems of the traditional education can be solved, like the overcrowding of the classes in universities, the difficulties to have available time of businessmen and businesswomen, the synchronization of agendas, the problems of attendance and trips, etc.
On the other hand, the .NET technologies allow the development of multitude of applications that can be used to complement and/or to replace the traditional education.
For example, the Web Services are applications that reside in a web server, being possible to call to its procedures of a remote way and therefore to take advantage of the information interchanged through the Network.This way, all the possibilities that the new Information and Communication Technologies (ICTs) offer can be obtained, since it is not necessary that the services are in the computer of the client or user of the application.

Advantages and Disadvantages of e-Learning
With the progress of telematic infrastructures, the access to broadband Internet with a low cost, the construction of centres of computers by the institutions, and in summon with the effort to approach the technological advances to all the citizens, the advantages of the electronic education increase considerably.
In order to participate in a curriculum of e-Learning, any place with a connected computer to Internet is enough, avoiding the unnecessary displacements of the users.In addition, the direct delivery of the courses can reduce the dead times that imply a low productivity and aids to eliminate the costs of the trips.In this way, the investment of the company or of the university is reduced.
The schedules are very flexible, and the studies can be made of a customized way, adapting to the different particular necessities of each user, both of instructors and of students.The participants no longer need to be all in the same place and at the same time, since the information is registered and stored in order that each user can consult it when there is time to do it.
The contents of a curriculum of e-Learning are of a high quality with a low price and can continuously be updated of a simple way.In addition, these remain always available, being able to make a consultation or having the possibility at any time of repeating a certain part of the curriculum.This way, the learning rate is individual, so that each student advances based on his merits.At the same time, the active participation and the collaborative work are promoted by means of the opinion forums, discussion groups, videoconferences or by sending emails.
In spite of the multiple advantages that the e-learning presents, there are also some problems that have prevented the integration of the technologies of e-learning.For example, although the introduction of Internet in the Basque Country can be considered quite wide, it is not installed yet in the totality of the homes of the students of the University of the Basque Country (UPV/EHU).Therefore, some students can not accede to these applications from their homes, and the access from the computer-rooms of the university or from other centres of Internet, like cybercafés, is restricted to certain schedules.
This reality implies that all the potential of the developed tools could not be used by all students yet, although it is obvious that it would allow a substantial improvement in their learning process.In addition, although it can be strange, students do not usually consider Internet like a tool that they can use for their study, since traditionally they have used the Network for the leisure and the interchange of emails, and not to complete their learning.To incorporate these tools for their habitual use is another way to use all the possibilities and to integrate in better conditions in the new "Information Society" that is developing little by little.
In the university scope, some subjects require the dominion of determined software that normally represents a very high cost for the economic capacities of the students.Besides, this use of software saturates the laboratories and computer-rooms of the university campus or induces the installation of copies without license at student's home.The problem can be solved if students could accede in a remote way, especially from the computers that they have at their homes, to a server of applications installed in the university, with its respective licenses, and with no need to have software in the computer of the students.

State-of-the-Art
In a very next future, Internet and the .NET technologies as educative tools are going to have a fundamental role with the university joining the European Higher Education Area (EHEA), putting the objectives fixed to the Declaration of Bologna into practice and the later evolution to the European Credit Transfer System (ECTS).
First of all, the traditional classes with chalkboard will be more interesting and with a higher participation of students, being able to use the web services to carry out this task.Secondly, with the new system of European credits, 25% of the necessary time to pass a subject will have to be non-presential, so the students will have to dedicate these hours to make laboratories, practices or works (even homework), where Internet and web applications play a fundamental role.
Some of these applications have already been put in practice.In fact, the University of the Basque Country has a Virtual Campus to offer non-presential learning to its pupils.From their homes, students can accede to different services of the Campus, to receive customized attention, to speak with their classmates, with the teaching staff, to accede to the different services available, and to feel like a part of a university community in a wide sense.
Other universities are being added to this initiative to form the G9 Group of universities of Spain that among other projects makes one joint offer of subjects of free config-  uration that are distributed through telematic systems, in agreement with the projects of use and operation of the Information and Communication Technologies of each one of the offering universities.
Other web applications that have already been developed are the virtual practices that are made in certain degrees.Since the time arranged to make the practices in the laboratory of the university is limited, all the necessary operations could be made by means of a web service, as if the student were physically making the practice.The results would be processed later by the computer, indicating if the gathered data are correct and they fit to the phenomenon that is tried to solve.
Another type of applications, like webMathematica, allows running mathematical operations implemented in the web page itself, being able to make exercises and to visualize directly the results from the browser.The disadvantage of this tool is that the student itself is forced to follow the time marked by the web page, and therefore it cannot be offered to the student the possibility of solving the problems by himself, making his own decisions and choosing among the different ways that lead towards the final answer.

Mathematica and the .NET Technologies
Mathematica is a mathematical software package developed by Wolfram Research, that integrates in a same product a motor of numerical and symbolic calculation and a publisher of graphs with a programming language, besides to include a documentation system and to offer advanced connectivity with other applications.Its great versatility, together with its simplicity and calculation power, allows it to be very useful in different mathematical applications of the university and the industry.
On the other hand, the .NET platform is a new technology for the development of applications in general, that not necessarily must be for Windows, and which covers all the aspects that affect such applications, from a Common Language Runtime (CLR) to languages specifically designed to make a maximum profit of the characteristics of this platform.The primary goal of the .NET platform is to offer a service net that is executed on the CLR and that has been designed with any compatible language, like Visual BASIC, C++ and C #.In this way, the developed applications are multiplatform, since they do not depend on a specific machine as they have a common language runtime.
We have integrated Mathematica with the .NET technologies, so taking advantage of the characteristics of both it is possible to have all the flexibility and power of Mathematica through a simple commercial browser.As it has been commented, the Internet access availability is greater every day and to a more reasonable price for the citizens, and approaching the applications developed for Mathematica to the users of the "information highways" supposes an important added value, playing a very important role in the new methods of education, and without doubt with the .NET technology like the ideal companion in this task.
At the time of focusing the accomplishment of the project of integration of Mathematica and the .NET platform, it is necessary to consider if both technologies already consider each other effectively.This is, whether it is possible to access from one to the other, and vice versa.The reality is that, although as Mathematica as the .NET technologies have great acceptance nowadays, the efforts to combine both environments have been relatively modest and not very numerous.
In spite of it, in foresight of the imminent development of new applications on the matter, the team of Mathematica has been including in the last versions of its product the toolkit .NET/Link to integrate both technologies, although it is true that at the moment it is in the phase of development and it has not been debugged completely yet.

New Application
In this paper we present an application that has been designed to consider all the possibilities of the toolkit .NET/Link, to be able in a future to add new functionalities, taking advantage of the improvements introduced in the later versions of the toolkit.The final mission is to accede to Mathematica through a remote server, so that commands can be run from the browser, as if the user were using Mathematica locally.
In addition, this application allows the access from a web browser to a remote server, in which Mathematica is installed with its corresponding license; it also allows to interact with Mathematica and to show the results; it has the simplest and intuitive interface, user friendly and at the same time easy to use; it offers the possibility of representing graphs and images in the same way that Mathematica would make; it keeps a file with all the introduced commands and generates the corresponding Word document with the results and images; it offers the chance of introducing matrices with a simple and visual way, independently of the number of rows and columns; it opens a dialogue box to download the Word document, if the user requires it at some moment of the execution; it establishes a link to the page that contains all the official documents of Mathematica, with aid for all its commands; it has a basic tutorial about the main functions of Mathematica; it has also a user manual and a fast guide of the developed application, explaining clearly its operation.

Proposed Solution
The developed application, denominated MateOnLine, has been programmed in C#, since it is a language that is specially designed for the .NET technology.On the other hand, Microsoft Visual Studio .NET 2003 has been used like development environment, because it supports almost any programming language, and of course because it is compatible with the new C#.In this way, several web forms have been developed and lodged in a server of the University of the Basque Country.
In addition, Macromedia Dreamweaver MX has been used as the tool to design the web page that contains the application, so each user can connect from his browser to accede to all the utilities that MateOnLine offers.In Fig. 3.1 the architecture of the propose solution is shown: the Mathematica software with their corresponding licenses is installed in the server of the UPV/EHU, while the client computers accede to MateOnLine through the web page that contains the application, lodged in the server.
When acceding to the page of MateOnLine from a browser it is made first a connection with the web server of the UPV/EHU, where Mathematica is installed.The user introduces by keyboard the commands to run in the server, which gives back an answer to the browser of the client computer, showing the results obtained in the screen of the user.The connection with the server remains established until the client decides to leave the session (logout).Then, the resources assigned to the user are released.

The Mathematica Toolkit .NET/Link
As already commented in the introduction, the new versions of Mathematica (5.0 and later ones) incorporate the toolkit .NET/Link, which allows the use of the .NET technologies from Mathematica and vice versa and the execution of commands of Mathematica from an application designed in any language of the .NET platform, using it like motor of computational calculation.
The toolkit .NET/Link can also be downloaded from the official web page of Wolfram, in the direction http://www.wolfram.com/solutions/mathlink/netlink.It is very advisable to visit this page every certain time in order to verify if a new version of .NET/Link is available, since at the moment it is in phase of development and it has not been debugged yet completely.For the accomplishment of the present project version 1.2.1 has been used.
.NET/Link consists of an only reference, Wolfram.NETLink.dll,which is to be added to the Visual Studio project being used to have access to the classes that allow to interacting with Mathematica.Among them, the most important is the MathKernel class, which provides a high level interface to run Mathematica.

Application Interface
The first step in the project execution has been to check that, through a simple dynamic application and using the ASP.NET technology, it is possible to interact with Mathematica and show then the obtained results.It has been accomplished later the process of designing an elegant user interface, as simple and intuitive as possible.
In order to it, the page to visualize in the browser has been divided in three differentiated parts: 1. Menu with connections to the different sections, in the upper part.2. Environment of execution of the application, in the left part.3. Space of consultation, in the right part, in order to show the application help, the documentation of Mathematica, etc.
On the other hand, when the application is not running, it has been decided to occupy all the available space by the main page, hiding the part reserved to the environment of MateOnLine.In this way navigation is more comfortable when consulting the manual of the application, the documentation or the recommended links.In Fig. 3.3 it can be observed the aspect of the MateOnLine web page and its differences with Fig. 3.2.
The environment of MateOnLine, in the left part of Fig. 3.2, uses the .NET technology.Here, the connection with the remote server is made, all the requests take place and all the answers are received.Considering its importance for the correct operation of the application, in the following sections the functions of the developed forms will be detailed.

Development of the Application with Visual Studio .NET
The developed application is made up of a set of web forms, installed in a server of the UPV/EHU, so that the user can accede to each one of them in a remote way from any browser.In Table 3.1 the description of the functions made by each one of the developed forms is included.
The form Open.aspx serves to initialize the application and to make the connection with the server, while Close.aspxserves to close the application and to release the assigned resources.The form Main.aspx is the main one, since it contains all the necessary elements to interact with MateOnLine and to show the results.Results.aspx and Graphics.aspxare image forms and serve to represent the generated graphs by Mathematica, whereas History.aspxserves to show the historical file and to allow the downloading the Word document.Finally, the forms Comment.aspx,Matrix.aspx and Matrix2.aspx are used to introduce commentaries and matrices, respectively.

Visualizing Graphs and Results through MateOnLine
In order to show the graphs generated by Mathematica, it has been necessary to define Graphics.aspxlike an image type form, and later in the Page_Load function, which is executed when the page is loaded, the necessary lines of code to show the graphs of the last operation are included.
In a similar way, in order to show the result of an operation with the TraditionalForm format, which creates an image using mathematical symbols instead of characters, Results.aspx has been defined like an image type form, and later in the Page_Load function, the corresponding lines of code to show the result of the last operation performed with the desired format are included.
One of the possibilities that MateOnLine offers is the chance of keeping a file with all the operations performed, along with the results obtained and, in case of being required, with the graphs and/or error messages generated by Mathematica.To do so, a text document containing all the information that is desired to store is created in runtime, and

Main.aspx
Main form of the application.

Results.aspx
Form to show the results in a graphic way.

Graphics.aspx
Form to show the generated graphs.

History.aspx
Form to show the historical file.

Comment.aspx
Form to introduce commentaries in the historical file.

Matrix.aspx
Form to introduce matrices in a visual way.

Matrix2.aspx
Form to save the introduced matrix.

Close.aspx
Form to close the application.later data will be added when the user requires it.In the web server of the UPV/EHU the text processor Microsoft Word has been installed, so the necessary orders to carry out the different tasks in the server can be generated from the application.All the information of the session has been saved in the server, therefore, on the same way that this session can be overturned to Word to be able to generate a text document, it might be used for its visualization with MathReader.Up to the moment this possibility has not been created because MathReader is a visualization program and the results might not be edited, in order to create a final report.
In order to interact with Word from an application developed with Visual Studio .NET, it is necessary to add the corresponding reference, Microsoft Word 10.0 Object Library, which contains several classes with all the necessary properties and methods to create a new document, to modify it with a certain format and save the changes made, offering a great amount of possibilities: • to define the Word document and the application; • to create and to save a new Word document; • to open a Word document; • to configurate the formats of font and paragraph to be used; • to add information at the end of the document; • to add an image to the Word document; • to close the Word document saving the changes.
It has been chosen the option to create a Microsoft Word document, as it is a very extended application among the computer users and due to its multiple options, although a Mathematica Notebook could have also been generated, followed by its visualization with the MathReader program (viewer for notebook documents created with Mathematica).

To Allow the Compatibility with all the Browsers
One of the requirements of the developed application is that it is able to be run as much in Windows as in Linux operating systems, as well as it is compatible with most of available browsers.Once verified that MateOnLine is multiplatform (independent of the computer in which it is executed) some errors in the visualization of the interface were observed, that although they were not fundamental for the execution, they offered a deficient image when it was acceded to the application from a browser which was not Microsoft Internet Explorer.
In order to solve the problem of compatibility among browsers, it has been necessary to include a fragment of code in the file Web.config, which contains information about the configuration of the developed project.The necessary lines can be found in the page of Rob Eberhardt (http://slingfive.com/pages/code/browserCaps/).In this way, a compatible application with all the modern browsers has been obtained: Mozilla Firefox, Netscape 6 and higher, Safari, Opera, Konqueror...

Additional Functions Using Javascript
The language Javascript allows making a series of useful tasks in the client machine, releasing the server from part of the work.In addition, it also serves to add some HTML language lacking functionalities.
Diverse Javascript functions have been used in the Matrix.aspxform to generate a page containing the number of necessary cells to introduce a matrix in a visual way and to send the information to the Matrix2.aspxform using the GET method.

Application Requirements
The requirements of the developed application can be divided into two parts, one corresponding to the clients, relative to the users who connect themselves to MateOnLine through Internet, and the other one corresponding to the server, which is in charge of offering services to these users.

Client Platform
The developed web application is multiplatform, that is to say, it can be executed independently of the machine and the software of the user.Therefore, the only necessary requirement for the client platform is to have a computer with connection to Internet, with an installed browser.
In this way, it is irrelevant the available operating system, as it is possible to use the different versions of Windows as well as the different distributions from Linux.On the other hand, the browsers to be used to visualize the web page can be very diverse: Microsoft Explorer 5.0 or higher Mozilla Firefox 1.0 or higher Netscape 7.0 or higher Konqueror Opera Safari ... Regarding the speed of the connection to Internet, a solution based on a modem of 56 Kbps would be enough, since the information traffic involves only the request of an operation and its answer with the results, remaining all the computation tasks in the server.

Recommended Requirements
MateOnLine has been designed to be supported by most of the available platforms and operating systems, independently of the browser used.However, there are recommended minimum requirements to use the application: PC: Microprocessor Pentium or AMD at 350 Mhz or higher Memory: 64 MB RAM or higher Operating system: Windows 98/2000/Me/XP Linux Installed browser: Microsoft Explorer 5.0 or higher Mozilla Firefox 1.0 or higher Netscape 7.0 or higher Others: Konqueror, Opera, Safari, etc. Connection to Internet: modem of 56 Kbps or higher However, the only essential requirement to accede to the application is to have a computer with connection to Internet and an installed browser.

Server Platform
The server platform requires a series of software components.First, it is necessary the installation of a web server, which is going to receive requests of clients through HTTP protocol and interact with Mathematica to give back the results obtained in web page format.The chosen solution is the installation of Internet Information Server (IIS) on a Microsoft Windows XP Professional operating system.The IIS is not included in the default installation of Windows, and therefore it is necessary to use the function to add components of Windows.
On the other hand, it is necessary the installation of Mathematica 5.0 (or higher), using the CD-ROM provided by Wolfram.The University of the Basque Country has a number of valid licenses during a determined period, generally a year, so it is essential to make the corresponding update once the time of validity has expired.
Another necessary element is the installation of the text processor Microsoft Word XP or similar, since it is the tool used to generate the historical file of the actions performed during a session of MateOnLine.It is very important to configurate the necessary permissions correctly so that a remote user can run the application.

Basic Operations with MateOnLine
In order to begin using the application from the welcome screen, the link corresponding to MateOnLine is clicked (Fig. 4.1), in the beginning page or in the menu of the upper part of the window, obtaining the aspect of Fig. 4.2.
Next, it is recommended to show the Fast Guide clicking the Help button, in order to visualize the basic help of the application, as it is observed in Fig. 4.3.
In order to execute an operation, the corresponding command is introduced in the entrance text box, and the "Obtain result" button is clicked, as it is shown in Fig. 4.4.The When calculating Sin[Pi/4 ], it is observed that the result is visualized in text mode, obtaining the chain of characters "1/Sqrt[2]".Although the result is correct, it is more advisable to select the option "Graphics mode" to show the result using mathematical symbols (Fig. 4.5).It obtains the result of dividing 20 by 17, with 5 decimals of precision.

Prime[10ˆ9]
It obtains the billionth prime number.

Sqrt[169]
It calculates the square root of 169.

Introduction of Matrices
The introduction of matrices in a program as Mathematica is a quite troublesome process if there is no tool included facilitating the task, especially when working with matrices of considerable dimensions.MateOnLine has a special page to insert matrices in a visual way, which is acceded clicking the button "Create matrix", as in Fig. 4.6.
After introducing the number of rows and columns, and after clicking the button "Insert matrix" (Fig. 4.7), a new window is generated, with as many squares as elements has the matrix to be introduced, as in Fig. 4.8.
Once filled up all the fields the "Send" button is clicked to save the introduced matrix, finalizing the process when clicking the button "Insert matrix", of the toolbar (Fig. 4.9).

Use of the Historical File of the Application
As already commented previously, MateOnLine allows the generation of a Word document that contains the history of all the introduced commands, with the obtained results and their corresponding graphs.It is also possible to introduce comments, clicking the button "Write comment", as in Fig. 4.10.
The comment desired to be added to the file is introduced in the corresponding text box and the button "Accept" is clicked (Fig. 4.11).Next, the application informs in a new page of the present state of the file.A similar process is followed when we want to add the used commands and/or their results.To do so, the corresponding boxes are selected and the "Add to the file" button is clicked, as in Fig. 4.12.
When a certain operation implies the representation of a graph, the application hides the fields of messages and comments, and the default image is replaced by the graph generated by Mathematica (Fig. 4.13).
It is possible to include to the historical file these figures generated by Mathematica, as well as the results in graphics mode, like images to be inserted in the Word document.If it is desired to visualize the present appearance of the file, the button "See" is clicked, obtaining the view of the generated document (Fig. 4.14).
Mathematica has a great amount of commands to represent curves and surfaces, and it is be able to generate graphs as much in two as in three dimensions, as it has been seen in the previous examples.

Operating with Algebraic Expressions
When operating with algebraic expressions, Mathematica provides the exact result, if it is possible to obtain it, although the software does not worry to reduce the expression to the minimum.It is possible to be observed in .that the initial expression agrees with the obtained one when deriving the result from its indefinite integral, although it is difficult to realize it.In a similar way, when solving a definite integral it is obtained the exact solution, instead of an approximate result .
Mathematica has also an ample group of sentences that allow solving equations.In Fig. 4.23 it is shown the necessary command to obtain the exact roots of a polynomic equation.

To Close the Session of the Application
When a user has finished using MateOnLine and wishes to download the file that contains the history of all the performed actions, clicks the "Download file" button, which opens a dialogue box to choose the location where he wishes to save the document (Fig. 4.24).
In order to close the session and to logout of the remote server, the button "Close session" is clicked, releasing the assigned resources and returning to the initial screen of MateOnLine, as in Fig. 4.25.

Conclusions
It has been developed a web application using the .NET technologies, which allows the remote access to Mathematica from any browser.Mathematica is installed in the server but not in the client computers, but the users can use Mathematica locally.When we used the toolkit .NET/Link, some errors of the initial versions were reported to Wolfram Research and allowed their correction in the later versions.
On the other hand, an application interface as simple and intuitive as possible has been designed, user friendly, representing graphics and images the same way Mathematica would make, offering the possibility of introducing matrices in a visual way, etc.
It has also been verified that the only necessary requirement to accede to the developed application, which is compatible with the different existing operating systems and browsers, is to have a computer with connection to Internet.
During the execution of MateOnLine, it is generated a Word document that contains the history of all the introduced commands, including also the obtained results and the corresponding images, allowing the downloading the file when the user requires it.
Finally, a very complete set of help materials has been included in the web site of MateOnLine, which includes: -links to web pages of interest and/or with utilities; -tutorial of initiation to Mathematica; -link to the official page of Wolfram Research, which contains all the documentation available about the functions of Mathematica; -MateOnLine user manual, with details of all the operation of the developed application; -fast guide with basic help of the application.

Fig. 4
Fig. 4.7.Selection of the number of rows and columns.

Fig. 4
Fig. 4.9.Insertion of the matrix in the input range.

Fig. 4
Fig. 4.11.Insertion of a comment in the file.

Fig. 4 .
Fig. 4.14.Visualization of the document that contains the historical file.

Table 4 . 1
Basic examples of operations with MateOnLine