Developing and Deploying 
Solutions

Mathematica for the Workgroup

Tom Wickham-Jones
Director of Kernel Technology
Wolfram Research Inc.

Introduction

Workgroup

— Group of people in an organization

— People have different tasks or roles

— People have different skills

Examples: commercial enterprise or university

How to use  Mathematica technology in a Workgroup

Features of Mathematica

● Integrated technical computing system

● Combines many different areas of computatation

● Used for small and large scale operations

● Used for large scale computations

● System for visualization and electronic publishing

● Underlying engine used directly and in webMathematica

(not giving detailed list of Mathematica features)

Mathematica in an Organization

Solutions for Different Users

Different Wolfram Products

Mathematica

Main product, complete computing environment

Useful to develop Mathematica solutions

Needed to run Mathematica solutions

Supports notebook documents that can be shared

Calculation Center

An easy-to-use, palette-driven computing environment

Suitable for people who don't want to learn Mathematica

Supports notebook documents that can be shared

webMathematica

Mathematica delivered over the web to a browser

Good for people who want a custom environment

Don't need Mathematica installed everywhere

Mixes all sorts of different machines

gridMathematica

Version of Mathematica for clusters

Supports parallel computation

Publicon

Technical document system

Integrates with formats: HTML, XML, or LATEX

Workgroup Users: Builders

Good knowledge of Mathematica

Individual Analyst/Researcher

Single person, solving individual problems

Solutions are probably part of some math problem

Might use Mathematica for presentation

Might use Mathematica for documentation

Can share notebooks

Computation Developer

Transition from research to solution

Solving computation problems

Goal to produce computational tools

Modelling, theoretical and empirical

Statistical Analysis

Educator

Writing courseware, experiments etc...

Benefit from symbolic and numerical computation

Code development for specialized tools

Workgroup Users: Consumers

Low knowledge of Mathematica

Special needs
	— Customized functions
	— Graphical User Interface

Student

Uses courseware

Benefit from custom syntax etc...

May develop to higher knowledge of Mathematica

Engineer,  Trader etc...

Needs tools to solve problems

Not very interested in details

Benefit from automated reports

Custom interface (including web)

Steps for Development

The solution developer can take the following path

Code Development

Build on broad set of mathematical tools

Write Mathematica programs to solve problems

Increasing set of tools for debugging, profiling, etc...

Application Deployment

Main mechanism: Mathematica applications

Need to have Mathematica for all users

Application contains 
	— database configuration,  GUI specifications, 
	— documentation 
	— code

Web Deployment

Do not need all users to have Mathematica

Highly customized interface

No knowledge of Mathematica required

Features for Development

Mathematica also provides

Data I/O

— formatted data (including XML)
	— URL access
	— database access
	— web service access

Interface Customization

Notebook customization
	— syntax customization
	— active elements
	— look-and-feel customization

GUIKit
	—  toolkit for building complete applications

Integration with Legacy Tools

Integrate with other tools
	— C++/MathLink
	— J/Link
	— NET/Link
	— Others: Pyton, Perl, Fortran etc...

Report Generation

Mathematica Notebook Documents
	— build new documents with programs
	— viable form for electronic publishing

Convert to 
	— LATEX
	— PDF
	— HTML
	— XML

Code Development

Interactive nature of Mathematica good for prototyping

Large library of mathematical and technical computation
 (you don't have to develop your own algorithms)

Efficiency

Data structures
	— sparse matrices, packed arrays etc...

Advanced libraries
	— optimized for platforms by vendor

Advanced algorithms and techniques

Environment

Notebooks,  good to document work

Increasing code development tools (debugger etc...)

Mathematica Application

The way to deploy Mathematica solutions

File Structure

ApplicationRoot
	Kernel
		code.m
		init.m
	FrontEnd
		stylesheets, palettes
	Documentation
		English
			helpbrowser
		French
			helpbrowser
	GUI
		gui components
			
	DatabaseResources
		database connection	
	Java
		Java classes for GUI or 
		Database connection

Application Construction

This is how we do things...   
	e.g. DatabaseLink, GUIKit, WebServices, J/Link etc...

Code

Start by prototyping and develop tools

Convert to package

Documentation

All written as Mathematica notebook documents

Use AuthorTools to build HelpBrowser info and indexing

AuthorTools in the Help Browser.

Extra Resources

GUI, database etc...

Testing

Add test files to work with Mathematica Test Environment

(Good for unit testing)

Application Deployment

DatabaseLink

New in Mathematica 5.1 (fully bundled)
	— access to database management systems
	— important feature for workgroup operations

Usage

Mathematica 
	— downloads data 
	— computes
	— uploads result

Shares with other Database clients

Features

● Connectivity with standard SQL databases

● Network based operation

● Contains a lightweight database

● Command line and GUI Interfaces

● Access to data and metadata

● Mathematica applications can add database information.

● Batch support ⟹ efficiency

● Standard SQL data types 
	— numbers, strings, binary data, date and time

● Multiple connections and transactions
	— rollbacks and savepoints

● Support for Secure Socket Layer (SSL) communications

DatabaseLink Demo

First load the package

<< DatabaseLink`

This opens the GUI interface

DatabaseExplorer[];

DatabaseLink in the Help Browser

Custom Interface

GUIKit: New in 5.1 (fully bundled)
	— Toolkit for building/running graphical user interfaces

GUIKit in the Help Browser

Example: Equation Trekker

Tool for exploring solutions of differential equations

<<  NumericalMath`EquationTrekker`

EquationTrekker[x''[t]  +  
          x[t]  ==  α Cos[ω x[t]], 
      x, {t, -10, 10},  
      PlotRange -> {{-10, 10}, {-10, 10}}, 
      TrekParameters -> {α -> 3,  ω -> 
            1}]

Added Value

Add custom GUI tools to your application
	— widgets, wizards, helpers
	— complete applications

GUI useful for non-experts

Web Deployment: webMathematica

Mathematica in a web server

Features

Core	
	— Server based computation
	— Processes HTML Forms
	— HTML and XML language support
	— MathML and SVG support
	— Graphics and typeset output

Advanced
	— HTTP session support
	— File upload
	— JSP custom tag integration
	— Works with advanced clients (JavaScript, Applets etc...)

Benefits

— Don't need Mathematica on every machine
	— Code administered on server
	— Code is hidden from users
	— User input is tracked

webMathematica Technology

Details

Technology

Built on HTML with extra tags

<%@ taglib uri="/webMathematica-taglib" prefix="msp" %>
										standard jsp headers
<html>
	<head>								standard html tags
		<title>Hello World</title>
	</head>
	<body>
		<h1>Hello World</h1>
		<msp:allocateKernel>     		allocate a Mathematica kernel
			<h4>Date[]</h4>
			<msp:evaluate>
				Date::usage    			Mathematica compuation
			</msp:evaluate>

			<p>Its current value is:</p>
			<msp:evaluate>
				Date[]    				Mathematica compuation
			</msp:evaluate>
		</msp:allocateKernel>			free the Mathematica kernel
	</body>
</html>

— webMathematica examples

Deploying

Mathematica applications, database connections etc...  all work

Model 1
	— Use HTML dev. tools add special tags

Model 2
	— Use Notebooks and webMathematica Author

Summary

Calculating environment for multiple collaborating users

Fit with existing infrastructure 
	DatabaseLink, Web Services, Legacy Integration

Customize interface
	Frontend and GUIKit

Deploy as Mathematica application

Deploy with webMathematica