Collaboration and Sharing with 
Mathematica Online

Kelvin Mischo
Certified Mathematica Trainer

Typical Workflow to Share Projects

Deployment for Broad Audience

Embedded mouse-driven applications into existing web content

Web forms to access Wolfram Language™ programs

Notebook format (text, formulas, graphics, calculations) with mouse-driven applications

Share Notebooks with Specified Groups

Editable Wolfram Notebook™ for other Mathematica Online™ users (or for author on guest machine)

Designated specific viewers and collaborators (courseware, research team)

Model Building in (Mathematica^®)

Start by importing a file, either local machine or by specifying a URL.

logo=Import["https://www.wolfram.com/development-platform/images/wolf-logo.png"]

Blur is one of the many image processing functions built into the Wolfram Language.

Blur[logo,20]

Manipulate builds a model and is useful with most of the thousands of built-in functions.

Manipulate[Blur[logo,i],{i,1,10}]

New Technology to Create Deployment on the Web

Start with Manipulate; add an option to embed the value of the variable logo.

Manipulate[Blur[logo,i],{i,1,10},SaveDefinitions->True]

Single command CloudDeploy to post on Wolfram servers and enable web-based calculations.

CloudDeploy[
Manipulate[Blur[logo,i],{i,1,10},SaveDefinitions->True],
Permissions->"Public"
]

Models on Any Modern Browser

TabView[{
"Course Management System"->,
"Mobile (iPhone)"->,
"Tablet (iPad)"->
}]

Web Forms to Expand Deployment

Instead of working with one predefined image, a form can be used to upload any image and run the same calculation.

CloudDeploy[
FormPage["imageFile"->"PNG", Blur[#imageFile, 10]&], 
Permissions->"Public"
]

Second form input mirrors the original slider to vary the amount of blur applied to the image.

CloudDeploy[
FormPage[{"imageFile"->"PNG", "blur"->"Number"}, Blur[#imageFile, #blur]&], 
Permissions->"Public"
]

Web Form Deployments Are Flexible

This technology is broader than image processing; can upload a spreadsheet instead for graphical visualization.

CloudDeploy[
FormFunction["file"->"CSV",Histogram[Part[#file,All,2], {0,20,1}, ChartStyle->47]&,
AppearanceRules-><|"Title"->"Histogram", "Description"->"Upload a CSV file of (x, y) pairs"|>],
Permissions->"Public"
]

Deployment with Real-World (Wolfram Language) Program

Typical Notebook Workflow

From Wolfram Blog (Shadi Ashnai)

Import or drag and drop an image.

rbc1=;

Image processing to prepare image for segmentation analysis.

b=FillingTransform[ColorNegate[Binarize[rbc1]]]

High-level functions to count unique regions in the image and visualize.

distT=DistanceTransform[b,Padding->0];
marker=MaxDetect[ImageAdjust[distT],0.02];
w=WatershedComponents[GradientFilter[b,3],marker,Method->"Rainfall"];
Colorize[w]

Graphically visualize results.

cells=SelectComponents[w,"Count",500<#<3000&];
measures=ComponentMeasurements[cells,{"Centroid","EquivalentDiskRadius","Label"}];
Show[rbc1,Graphics[{Blue,Circle@@#&/@(measures[[All,2,1;;2]]),MapThread[Text,{measures[[All,2,3]],measures[[All,2,1]]}]}]]

Charting for alternate visualization of the results.

Histogram[ComponentMeasurements[cells,"Count"][[All,2]],35,AxesLabel->{"pixels"},PlotLabel->"Histogram of cells' pixel counts",ChartStyle->47]

Deployment with Real-World (Wolfram Language) Program

Same Program in Deployed Web Application

Largely a copy-paste of preceding inputs with FormFunction and CloudDeploy.

CloudDeploy[
FormFunction[{{"rbc","PNG Image"}->"PNG",{"bCount","Number of Bins for Histogram (Pixels)"}->"Integer"},(b=FillingTransform[ColorNegate[Binarize[#rbc]]];
distT=DistanceTransform[b,Padding->0];
marker=MaxDetect[ImageAdjust[distT],0.02];
w=WatershedComponents[GradientFilter[b,3],marker,Method->"Rainfall"];
cells=SelectComponents[w,"Count",500<#<3000&];
measures=ComponentMeasurements[cells,{"Centroid","EquivalentDiskRadius","Label"}];
GraphicsColumn[{Show[#rbc,Graphics[{Blue,Thick,Circle@@#&/@(measures[[All,2,1;;2]]),MapThread[Style[Text[#1,#2],16,Bold]&,{measures[[All,2,3]],measures[[All,2,1]]}]}], ImageSize->400],
Histogram[ComponentMeasurements[cells,"Count"][[All,2]],#bCount,AxesLabel->{"pixels"},PlotLabel->"Histogram of cells' pixel counts",ImageSize->400,ChartStyle->47]
}])&, "CloudCDF"],
Permissions->"Public"
]

CloudObject[(HyperlinkURL["https://www.wolframcloud.com/objects/e8c68b2f-c53b-4319-ae45-0b0b79022982", https://www.wolframcloud.com/objects/e8c68b2f-c53b-4319-ae45-0b0b79022982])]

Create an Instant API for Deployment

Creating an API is a very similar workflow to creating a web form.

CloudDeploy[APIFunction[{"x"->"Integer"},#x^2&]]

Invoke the API function with “?x=5” at the end of the URL.

SystemOpen["https://www.wolframcloud.com/objects/949f0756-5e2f-4b18-b60b-24df649f0d5a?x=5"]

APIs can also be created complete with embeddable code for various languages.

EmbedCode[APIFunction[{"x"->"Integer"},#x^2&],"Java"]

List of languages where the Wolfram Language can create embeddable code for an API.

$EmbedCodeEnvironments

Deploying Full Notebooks

Finished Example

Mathematica Online can publish a notebook—can add text, titles, graphics, calculations and video to a deployment (mouse-driven model).

• Example of computational essay as deployed notebook

Migration from Local File to Web Based

Local installation of Mathematica and Mathematica Online are nicely integrated—easy to move a local notebook into the cloud.

The file is then shared with Mathematica Online, which includes a Publish drop-down menu to publish a notebook.

The published notebook can be accessed by anyone with mouse-driven calculations. Mathematica Online users can use “Open In” to make a copy to change inputs and further explore.

Collaboration with Full Notebooks

Mathematica Online users can easily Share with each other, either by creating different parts of the same notebook or sending copies of notebooks.

For frequent collaboration or collaboration with a larger number of Mathematica Online users, a group can be established to speed up the process of collaboration.

group=CreatePermissionsGroup["KelvinCollab",{"kelvinm@wolfram.com", "kelvin_mischo@wolfram.com"}]

PermissionsGroup["https://www.wolframcloud.com/objects/kelvinm/PermissionsGroup/KelvinCollab"]

Grant access to the permissions group: all members edit the same notebook (given “Write” permission).

SetOptions[
CloudObject["https://mathematica.wolframcloud.com/objects/kelvinm/Optical_Illusion_StudentProject.nb"],
Permissions->PermissionsGroup["KelvinCollab"]->{"Read", "Write"}]

Grant access to the permissions group: recipients are unable to edit the source notebook, but will receive their own copy.

SetOptions[
CloudObject["https://mathematica.wolframcloud.com/objects/kelvinm/BlurLogo.nb"],
Permissions->PermissionsGroup["KelvinCollab"]->{"Read"},
AutoCopy->True]

The first approach is nice for teams working on the same project; the latter is nice for an instructor assigning a Mathematica project.

Collaboration with Full Notebooks

There are several options to notify another Mathematica Online user about a shared notebook.

CloudShare[
CloudObject["https://mathematica.wolframcloud.com/objects/kelvinm/Optical_Illusion_StudentProject.nb"],
"kelvin_mischo@wolfram.com"]

Collaboration with Full Notebooks

?SendMail

Conclusion

Local notebooks are very useful; new browser-based workflows are a valuable complement for deployments and web-centric collaboration.

Inquire whether your organization supports Mathematica Online:

Kelvin Mischo
kelvinm@wolfram.com