Author 
Message 
Dave (from the UK) science forum addict
Joined: 12 Jan 2006
Posts: 76

Posted: Sat May 20, 2006 9:07 pm Post subject:
Free web front end to Mathematica



I've written a simple web based front end to Mathematica. It allows you
to run basic Mathematica commands from any computer with a browser.
There are no graphics capabilities, so it is somewhat limited, but it is
usable. It needs a UNIX computer, with php suport in the web server.
You can limit the amound of RAM and time used in the computations. I've
set them to 60s and 60 Mb, but change as you want.
There are no safety mechanisms with this, so it is VERY unsafe.
It should only be used on a password protected web server and even then,
if more than one person has access, as it is potentially dangerous. I've
read and written files on the file system and I expect one could send
email via it too.
Given the above, I am not willing to provide a demo. here is a
*nonfunctional* demo.
http://www.althorne.org/mathinterface.php
If you want to use it, download the full version, which is functional.
This is stored on my web server as a .txt file, although it is php. So
you need to download it from
http://www.althorne.org/mathinterface.txt
and rename to mathinterface.php
The name mathinterface.txt is important. If you want to change it, you
must change a line in the file. It is about line 130.
Change
<Form action="mathinterface.php" method="post" >
to whatever you want to call the file.

Dave K MCSE.
MCSE = Minefield Consultant and Solitaire Expert.
Please note my email address changes periodically to avoid spam.
It is always of the form: monthyear@domain. Hitting reply will work
for a couple of months only. Later set it manually. 

Back to top 


Dave (from the UK) science forum addict
Joined: 12 Jan 2006
Posts: 76

Posted: Sat May 20, 2006 9:10 pm Post subject:
Re: Free web front end to Mathematica



Dave (from the UK) wrote:
Quote:  The name mathinterface.txt is important. If you want to change it, you
must change a line in the file. It is about line 130.
Change
Form action="mathinterface.php" method="post"
to whatever you want to call the file.

Correction. Once you download the text file, you must rename it to
mathinterface.php. If you prefer some other name, you will need to
alter the line which has mathinterface.php on it, around line 130

Dave K MCSE.
MCSE = Minefield Consultant and Solitaire Expert.
Please note my email address changes periodically to avoid spam.
It is always of the form: monthyear@domain. Hitting reply will work
for a couple of months only. Later set it manually. 

Back to top 


robert.dodier@gmail.com science forum beginner
Joined: 02 Oct 2005
Posts: 26

Posted: Sat May 20, 2006 9:35 pm Post subject:
Re: Free web front end to Mathematica



Dave (from the UK) wrote:
Quote:  I've written a simple web based front end to Mathematica.

Dave, if you're interested in that kind of stuff, take a look at
http://maxima.sourceforge.net/relatedprojects.shtml
which lists some web interfaces for Maxima.
There seems to be a lot of interest in web interfaces lately.
If nothing else, maybe you have some suggestions about how
such devices ought to work.
FWIW
Robert Dodier 

Back to top 


Dave (from the UK) science forum addict
Joined: 12 Jan 2006
Posts: 76

Posted: Sat May 20, 2006 9:59 pm Post subject:
Re: Free web front end to Mathematica



Robert Dodier wrote:
Quote:  Dave, if you're interested in that kind of stuff, take a look at
http://maxima.sourceforge.net/relatedprojects.shtml
which lists some web interfaces for Maxima.
There seems to be a lot of interest in web interfaces lately.
If nothing else, maybe you have some suggestions about how
such devices ought to work.
FWIW
Robert Dodier

Some of those look very nice, but seem to have only a subset of Maxima
commands available via the web.
Mine is very simple (only 140 lines long), but gives access to quite a
lot of Mathematica. However, I'm the first to admit it is not very
elegant !! It will win no prizes for looks.
webMathematica looks good, but needs a lot of setting up. I think if one
took off a lot of the protection with webMathematica, it would be
possible to get a lot of Mathematica functionality. There seems to be a
BIG security issue with a Mathematica interface. You can either
* Let the user do anything, and risk security issues.
* Make the system safe and have it very limited.
I had email contact with someone who was at one point developing a PDA
interface for Mathematica and he had the exact same issues. I'm sure the
same will happen with any program that has access to the shell and can
read/write files.
With webMathematica you can configure the balance between these.
My interface might well work with Maxima or any others. As long as it
can read from stdin and write to stdout, then it should work. The only
bits that are Mathematica specific is a wrapper of TimeConstrained &
MemoryConstrained, which means all expressions are evaluated subject to
some maximum amount of RAM and time. But apart from that, there are no
Mathematica specific things  everything just gets passed to
Mathematica. I had an earlier version using the 'bc' calculator.
Mine is useless unless you know Mathematica, since it just passes
whatever you type to Mathematica.

Dave K MCSE.
MCSE = Minefield Consultant and Solitaire Expert.
Please note my email address changes periodically to avoid spam.
It is always of the form: monthyear@domain. Hitting reply will work
for a couple of months only. Later set it manually. 

Back to top 


@(none) science forum beginner
Joined: 03 Mar 2006
Posts: 3

Posted: Sun May 21, 2006 6:39 am Post subject:
Re: Free web front end to Mathematica



Quote: 
* Let the user do anything, and risk security issues.
* Make the system safe and have it very limited.
I had email contact with someone who was at one point developing a PDA
interface for Mathematica and he had the exact same issues. I'm sure the
same will happen with any program that has access to the shell and can
read/write files.

You most probably need to make modifications to the kernel
for security. That's what we did for the web interface
of giac/xcas. There is a secure_run variable that is true
in a nontrusted environment and every file system call
is disabled if it is true. The web module calls a C backend
that can set this variable to true (or false only at the right
moment).
You can try the giac/xcas web interface at
http://wwwfourier.ujfgrenoble.fr/~branchar/cgibin/giac_online/giac.pl
(default language is french, you can select english at the top
right) 

Back to top 


Dave (from the UK) science forum addict
Joined: 12 Jan 2006
Posts: 76

Posted: Sun May 21, 2006 1:56 pm Post subject:
Re: Free web front end to Mathematica



none wrote:
Quote: 
* Let the user do anything, and risk security issues.
* Make the system safe and have it very limited.
I had email contact with someone who was at one point developing a PDA
interface for Mathematica and he had the exact same issues. I'm sure
the same will happen with any program that has access to the shell and
can read/write files.
You most probably need to make modifications to the kernel
for security.

That's not possible on a commercial program though, as I don't have the
source code.
WebMathematica has a list of allowed commands. Another option might be
to have a list of disallowed commands and filter those out. But it seems
hard to me. Take the ! operator. It can be used quite convenient to get
the factorial
In[1]:= 12!
Out[1]= 479001600
But it can also be used to run an arbitrary command:
In[2]:= ! cat /etc/passwd
root:x:0:0:SuperUser:/:/sbin/sh
daemon:x:1:1::/:
One could probably do it safely in something like a Zone on Solaris 10
or possibly in a chroot environment.
However, I personally have no intension of making a public access
Mathematica server. Apparently Wolfram don't approve of that anyway, as
the license for webMathemtica states. Also this page shows they objected
http://ai.eecs.umich.edu/people/dreeves/simplify/
I'm not really sure why Wolfram should object as long as the number of
simultaneous instances does not exceeded the number of licenses. If I
own a company and have 10 licenses, I can let 10 employees use it at the
same time. So what is the difference if I don't know the 10 people? I
suspect a court in Europe would say none. But as I say, that is not my
aim  I just want an interface I can use myself.
Quote:  That's what we did for the web interface
of giac/xcas. There is a secure_run variable that is true
in a nontrusted environment and every file system call
is disabled if it is true.

That is not an option on Mathematica as far as I know. And given
Wolfram's views on access via the web, I doubt they will add it.

Dave K MCSE.
MCSE = Minefield Consultant and Solitaire Expert.
Please note my email address changes periodically to avoid spam.
It is always of the form: monthyear@domain. Hitting reply will work
for a couple of months only. Later set it manually. 

Back to top 


Albert Reiner science forum beginner
Joined: 02 May 2005
Posts: 21

Posted: Sun May 21, 2006 2:24 pm Post subject:
Re: Free web front end to Mathematica



["Dave (from the UK)" <seemysignature@southminsterbranchline.org.uk>, Sun, 21 May 2006 14:56:19 +0100]:
Quote:  One could probably do it safely in something like a Zone on Solaris 10
or possibly in a chroot environment.

IIRC, you might also set up something via $Pre or some such variable:
I think you then have access to the InputForm, but no evaluation has
taken place yet. And the two uses of, e.g., ! certainly have
different InputForm.
Albert. 

Back to top 


axelclk@gmail.com science forum beginner
Joined: 22 May 2006
Posts: 1

Posted: Mon May 22, 2006 5:21 pm Post subject:
Re: Free web front end to Mathematica



Robert Dodier wrote:
Quote:  There seems to be a lot of interest in web interfaces lately.
If nothing else, maybe you have some suggestions about how
such devices ought to work.
I've also made some experiments with a math web interface which uses 
some rewritten open source Java libraries on the server:
http://www.matheclipse.org
I think such a web interface will only be useful if it's free
accessible over the net (like the google math service).
Of course there are a lot of problems making symbolic math calculations
"free available" and running secure on a web server (and I've also
solved these problems only partially in the demo ):
* calculations should only be allowed up to a defined recursion limit.
* calculations must be limited in the size of usable memory and CPU
time per thread/user.
* no system calls are allowed of course.
* every user must have it's "context for calculations" assoiated with a
HTTP session (i.e. if a user sets a value for a variable these action
should be "hidden" from every other user using the web interface in
parallel)
In my opinion such a sytem also needs some sort of caching to avoid a
lot of useless calculations with all the same input.
I.e. often users type in something like D[Sin[x],x] to get Cos[x]. In
my demo I therefore only allow assignments of values to variables which
start with a '$' character. (i.e. $x=42 ).
An input like D[Sin[x],x] (which contains no '$'identifier) will be
transformed in the first step to D[Sin[#1],#1]. If there's already such
an input in the cache the result will be returned by substituting the
slot #1 with the variable which is used in the original input
expression.
Does Maxima allow to create such a web system or do you go in an other
direction to support such "multiuser" web interfaces? 

Back to top 


Jaap Spies science forum beginner
Joined: 03 Nov 2005
Posts: 28

Posted: Mon May 22, 2006 8:21 pm Post subject:
Re: Free web front end to Mathematica



axelclk@gmail.com wrote:
Quote:  Robert Dodier wrote:
There seems to be a lot of interest in web interfaces lately.
If nothing else, maybe you have some suggestions about how
such devices ought to work.
I've also made some experiments with a math web interface which uses
some rewritten open source Java libraries on the server:
http://www.matheclipse.org
I think such a web interface will only be useful if it's free
accessible over the net (like the google math service).
Of course there are a lot of problems making symbolic math calculations
"free available" and running secure on a web server (and I've also
solved these problems only partially in the demo ):
[...} 
Maybe you find the following links interesting:
http://modular.math.washington.edu/sage/index.html
http://modular.math.washington.edu/calc/
http://modular.math.washington.edu:8389/
Jaap Spies 

Back to top 


Dave (from the UK) science forum addict
Joined: 12 Jan 2006
Posts: 76

Posted: Mon May 22, 2006 8:27 pm Post subject:
Re: Free web front end to Mathematica



axelclk@gmail.com wrote:
Quote:  I've also made some experiments with a math web interface which uses
some rewritten open source Java libraries on the server:
http://www.matheclipse.org

It looks quite impressive I must say.
Quote:  I think such a web interface will only be useful if it's free
accessible over the net (like the google math service).

It depends. In the case of Wolfram, I believe they object if Mathematica
is available over the net. The license for webMathematica makes this
point quite clear, although I somewhat doubt they would have much chance
in Europe of stopping you, as long as the number of simultaneous users
was <= number of licenses. I think it is a bit unfair of them to object.
I would have thought that if one buys a license and allows anyone to use
it, they should be able to.
Quote:  Of course there are a lot of problems making symbolic math calculations
"free available" and running secure on a web server (and I've also
solved these problems only partially in the demo ):

If its an opensource tool, it should be relatively easy to code it such
that unsafe commands are not available. When you are trying to bolt
something on to a commerical product, it is very different.
Quote:  * calculations should only be allowed up to a defined recursion limit.
* calculations must be limited in the size of usable memory and CPU
time per thread/user.

I have done that in my code, by wrapping all expressions around
TimeConstrained & MemoryConstrained, which are Mathematica commands
which limit these.
The user can't bypass these, since all expressions are wrapped around
it. However, it is not my aim to make a public Mathematica server, so
these are to protect the system from my stupidity, rather than anything
else.
There needs to be a way of aborting calculations.
Quote:  * no system calls are allowed of course.
* every user must have it's "context for calculations" assoiated with a
HTTP session (i.e. if a user sets a value for a variable these action
should be "hidden" from every other user using the web interface in
parallel)

That would happen anyway if there are multiple copies of Mathematica,
Maxima or whatever running.
Quote:  In my opinion such a sytem also needs some sort of caching to avoid a
lot of useless calculations with all the same input.

That depends very much on whether you are making it public, or for
private use.
Quote:  I.e. often users type in something like D[Sin[x],x] to get Cos[x]. In
my demo I therefore only allow assignments of values to variables which
start with a '$' character. (i.e. $x=42 ).

I noticed that.
Quote:  Does Maxima allow to create such a web system or do you go in an other
direction to support such "multiuser" web interfaces?

No idea, but I am sure somewhere else here does.

Dave K MCSE.
MCSE = Minefield Consultant and Solitaire Expert.
Please note my email address changes periodically to avoid spam.
It is always of the form: monthyear@domain. Hitting reply will work
for a couple of months only. Later set it manually. 

Back to top 


Richard Fateman science forum Guru Wannabe
Joined: 03 May 2005
Posts: 181

Posted: Tue May 23, 2006 2:07 am Post subject:
Re: Free web front end to Mathematica



WRI forbids various actions in their licenses presumably because
they would like to collect as much money as possible from
people who want to use Mathematica.
WRI presumably views various (free) web access schemes to interfere
with collecting money.
Next, security is not achieved by merely inhibiting commands
that access the file system or shell. You need more of a box. Running
inside a virtual system with limits to the file system, memory, and
CPU time go further. This is how Maxima is run at the Franz
Inc "telnet" site. Maxima allows you to execute any lisp
function, but only within this sandbox. There are no changes
to Maxima.
See
http://www.franz.com/success/demos/maxima/javatelnet.html
Though at the moment it looks like it needs to be updated to run.
Security includes protecting the host machine from being crashed
or some other kind of denial of service attack, accidental or
deliberate.
If your front end does not allow an "interrupt" to halt a
computation that you decide to abort, that's not so good.
I hope these designs include such facilities.
RJF 

Back to top 


Jaap Spies science forum beginner
Joined: 03 Nov 2005
Posts: 28

Posted: Tue May 23, 2006 1:13 pm Post subject:
Re: Free web front end to Mathematica



Richard Fateman wrote:
Quote:  WRI forbids various actions in their licenses presumably because
they would like to collect as much money as possible from
people who want to use Mathematica.
WRI presumably views various (free) web access schemes to interfere
with collecting money.

That is why Mma access is denied on the web interface to SAGE:
http://modular.math.washington.edu/calc/
But you can use SAGE, GAP, PARI, KASH, Maxima, and Singular here.
There is an experimental web interface to SAGE based on AJAX here:
http://modular.math.washington.edu:8389/
SAGE is Software for Algebra and Geometry Experimentation and includes
interfaces to all major Open Source Mathematics software, but also to
installed non free software like Maple and Mathematica. See:
http://modular.math.washington.edu/sage/index.html
Jaap Spies 

Back to top 


Dave (from the UK) science forum addict
Joined: 12 Jan 2006
Posts: 76

Posted: Tue May 23, 2006 4:08 pm Post subject:
Re: Free web front end to Mathematica



Jaap Spies wrote:
Quote:  Richard Fateman wrote:
WRI forbids various actions in their licenses presumably because
they would like to collect as much money as possible from
people who want to use Mathematica.
WRI presumably views various (free) web access schemes to interfere
with collecting money.
That is why Mma access is denied on the web interface to SAGE:

I assume WRI can't complain if its for internal use  i.e. not
publically acessable.
There are interfaces available for Excel which calls Mathematica from
Excel. I really can't see the difference if you call it from Excel,
write your own frontend in C like jmath
http://robotics.caltech.edu/~radford/jmath/
or use browser. (Of course, WRI are unlikely to know, but that is hardly
the point.)
Of course, if you make it available on the web for access by anyone and
everyone that is a different matter. (I still think that is not
unreasonable up to the number of commercial licenses you have, but I am
now a lawyer.)
Quote:  http://modular.math.washington.edu/calc/
But you can use SAGE, GAP, PARI, KASH, Maxima, and Singular here.

I'll ask if the interface to Mathematica is available. That seems to do
pretty much what I was trying to achieve. I assume for the fact the
source has the extension .py it is probably python, but I don't know.
It would be interesting if WRI provided a full web interface for a few
hours in a week. That would allow people to play with Mathematica
without the hassle of installing it. If the times it was available were
restricted, users who found it useful would soon want to buy a copy.
Nobody could make extensive use of a program they can only use a few
hours/week. Interesting marketing idea?

Dave K MCSE.
MCSE = Minefield Consultant and Solitaire Expert.
Please note my email address changes periodically to avoid spam.
It is always of the form: monthyear@domain. Hitting reply will work
for a couple of months only. Later set it manually. 

Back to top 


Google


Back to top 



The time now is Tue Dec 12, 2017 4:23 am  All times are GMT

