11.07.2015 Views

webMathematica™ Wolfram - Wolfram Research

webMathematica™ Wolfram - Wolfram Research

webMathematica™ Wolfram - Wolfram Research

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

102 webMathematica User GuideNumber of smoothing terms: dataSmooth = MovingAverage[data, term];MSPShow[ListPlot[{data, dataSmooth}, Joined -> {False, True}, ImageSize-> 600]]In this example, an msp:evaluate tag loads the dataset Data/DataFile1.dat using the Importcommand. This will search for the data file on the Mathematica $Path and will find the Datadirectory inside the MSPScripts directory, which by default is located in webMathematica/WEB-INF. It is worth looking inside your webMathematica web application and confirming thatyou can locate the data file. The example then computes a moving average and plots the originaland the smoothed data. This is all placed inside a form element so that it is possible tomodify the number of terms.One weakness of this example is that the data has to be loaded from the data file for everycomputation. It would be better to save the data somehow. In addition, it might be useful toallow the data to be uploaded from the client. These will be explored in the sections that follow.Uploading Data: Upload.jspIf you installed webMathematica as described above, you should be able to connect to thisexample via http://localhost:8080/webMathematica/Examples/Data/Upload.html. (You mayhave some other URL for accessing your server.)This example allows the user to enter a function to be integrated. The result is thenformatted by the typesetting system and saved as an image. The source for thispage is webMathematica/Examples/Data/Upload.html and webMathematica/Examples/Data/Upload.jsp. The contents of Upload.html are shown below.Uploading Data

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!