# Creating an API or Widget based on a Mathematica notebook

I'm trying to create a matrix calculator and graph tools for our website and was wondering if there is a way to create Wolfram API or Widgets based on a Mathematica notebook.

-
Take a look at webMathematica. – Szabolcs Mar 22 '13 at 0:46
Wolfram|Alpha lets you develop widgets. But you'd have to define them using the Wolfram|Alpha "language"... – cormullion Mar 22 '13 at 12:33
To create a CDF that is embedded into a web page you could use (Mma version 9) the File / CDF Export / Web Embeddable... menu item. The online documentation is here. – Stephen Luttrell Mar 22 '13 at 19:01
probably with the future online.wolfram.com – P. Fonseca Mar 28 '13 at 7:58

webMathematica is one option, but I think CDF would be the easiest way to do this. Check out http://education.wolfram.com/ and http://demonstrations.wolfram.com/ for examples. For instructions see this similar question on stackexchange How can I embed a Manipulate (or other interactive graphics) in my website using CDF?

-

Making a matrix calculator with the FreeCDF options will be very challenging, since data input via fields such as InputField apparently are not allowed. The following code works with PlayerPro (the enterprise edition)

Clear[r1, r2, r3];
Manipulate[Column[{
InputField[Dynamic[r1], String],
InputField[Dynamic[r2], String],
InputField[Dynamic[r3], String],
Row[{
Dynamic@
function@(ToExpression /@ StringSplit[#, " "] & /@ {r1, r2,
r3}) }]
}], {{function, Transpose}, {Transpose, Inverse, Det}},
Initialization :> (r1 := "1 2 3"; r2 := "4 2 2"; r3 := "5 1 7";)]


The input fields want space separated values and there is no error checking. With the FreeCDF you will not be able to change the default values in the InputField. If you have some restrictions on your matrix, then you could substitute input fields for sliders, which would be allowed in the FreeCDF version. The interface would get very cumbersome for large matrices, however.

-