For some sense of what mathematica can now do, check out:
http://www.wolfram.com/products/mathematica/newin6/content/DynamicInteractivity/.
I actually think its more impressive in person.
While I would like to help remedy the gap between sage and mathematica/
matlab in this respect, I am not sure how it would be done. I am
learning a little about wxPython, but I don't think that would work
through the notebook at all, unless a program was created on the
server for download and byte-compilation by the client. Does anyone
have any ideas? If javascript is a possibility, can someone recommend
a good reference for learning to use it for such complicated
purposes? Or is java an option?
-Marshall
Good timing. Just yesterday I sent this to enthought-dev:
https://mail.enthought.com/pipermail/enthought-dev/2007-September/009023.html
Traits/TraitsUI is currently the closest python-side technology to
mathematica 6's stuff. In certain ways it's more generic, in others
not, and Mathematica's implementation is impressively elegant. I'd
also love to have this...
For more on traits:
http://code.enthought.com/traits/
This is a very nice mini-tutorial geared towards experimental scientists:
http://www.gael-varoquaux.info/computers/traits_tutorial/index.html
A word of caution: today, playing with Manipulate[], I found a truly
serious bug. On Linux at least (all I have tested on, Ubuntu Feisty),
if you leave a window that has Manipulate[] widgets open for a few
hours and go do something else, at some point those widgets go dead.
The notebook remains alive, you can run new code, etc. But both
existing Manipulate widgets and new ones you make become 100%
unresponsive to mouse input to drag their controls.
Something to be aware of before using this in front of an audience. I
hope they'll fix it soon.
Cheers,
f
Isn't this exactly the sort of thing that javascript/AJAX is good at doing?
When you move an html control the server is contacted for the updated
output and it is displayed (by directly manipulating the DOM). I'm sure
it won't be as snappy as a purely local GUI (e.g., Mathematica), but it
will work from anywhere over a web browser, which counts for a lot
these days.
I've had some discussions with people about implementing things like
this (mostly with Robert Miller), but nobody has actually done it for
SAGE yet. Our complete rewrite of the notebook to use Twisted
as the underlying server technology I think makes doing something
like this easier.
-- William
That is really cool!
Generating, serving, and displaying pngs via javascript would be
really hard to do fast enough to make it smooth.
{{{
%time
for n in range(10):
plot(x^n).show()
}}}
CPU time: 2.44 s, Wall time: 2.93 s
A rough estimate of 4 frames/sec... maybe it's possible.
- Robert
Well that's why I asked, I am ignorant about javascript/AJAX. Can you
suggest a good reference?
While we are at it, if you use debian, you can use my preliminary
debian packages for tratis/traitsui, that will later get to debian
unstable. Put:
deb http://debian.wgdd.de/debian unstable main
into your /etc/apt/sources.list and
apt-get update
apt-get install python-ets-traits-ui
Please report any bugs,
Ondrej
No, unfortunately I can't, but hopefully someone else can. There are
a lot of bookstores in Barnes and Noble about "AJAX". It's also how programs
like Google Maps, etc., work.
It took me quite a while to get my head around AJAX programing. Basically
Alex Clemesha and Tom Boothby made a bunch of self-contained examples
and gave some takes, and after a while I just "got it". That was a while
ago and there are probably good books now.
William
-- William
On Sep 14, 3:31 pm, Hamptonio <hampto...@gmail.com> wrote:
> Recently I started using Mathematica 6 in the computer labs of some
> courses I teach, and I cannot help but be impressed. The new dynamic
> commands such as Manipulate are very impressive, and are perfect for
> teaching. Before seeing how powerful it is, I had hoped to switch
> from using mathematica to sage in the fall of 2008. But now I am not
> sure I can justisfy that switch or convince my colleagues it would
> make sense. (As an aside: assume for the sake of argument that my
> department gets mathematica for free, which is true in a certain
> bureaucratic sense).
>
> For some sense of what mathematica can now do, check out:http://www.wolfram.com/products/mathematica/newin6/content/DynamicInt....
I have submitted bugs to mathematica and gotten no response, so I know
what you mean there as well.
But I am committed to using and improving sage over the long haul,
don't get me wrong. I think the superiority of the development model
will win on most fronts eventually.
Cheers,
Marshall
Please realize that WRI's marketing materials (aka documentation -
lol) make it seem like MMA can do anything (and so they might attempt
to use MMA in all their later courses - like me - which may not be
wise).
You could do much worse than teaching them SAGE, because then they
would learn the Python language and its libraries, which wouldn't be a
bad thing at all.
William
-- William
Does anyone of you tried AJAX from pypy?
You can write all of your code in Python (resp RPython) and you don't
have to mess up with javascript. Some of the demos look cool, but I
haven't seen much activity on pypy since March, I hope it's not dead.
Ondrej
Ondrej
It's exactly like this, but not Java, but Python. :)
> Instead I think it is much better to use a good javascript library,
> like the excellent Mochikit library (mochikit.com ). Once you have
> sufficient understanding of how to produce AJAX apps, then you
> begin to realize the pain (DOM and Event issues, etc)
> of making those apps work in all the main browsers ...
> this is where a javascript library comes in.
I understand, that technically at this moment it's better to use
Mochikit or something. But in the long term I like to just write just
Python and don't care about some ugly technical details, like
javascript in browsers.
Ondrej
Thanks! Great simple example.
For the total newbie, the way to use it is to download
simple_ajax_twisted_sage.py
to a file on your computer, then type
sage -python simple_ajax_twisted_sage.py
and follow the directions, i.e. open your browser to localhost:8000.
Make sure you aren't already running a sage notebook on that
port.
I'll put this in the SAGE_ROOT/examples directory so it comes with
future versions of SAGE.
William
Btw, before reading William's instructions, I ran it without the -
python option and it seemed fine. Does the -python option just turn
off the preparser?
Cheers,
Marshall
On Sep 14, 7:52 pm, "William Stein" <wst...@gmail.com> wrote:
> Recently I started using Mathematica 6 in the computer labs of some
> courses I teach, and I cannot help but be impressed. The new dynamic
> commands such as Manipulate are very impressive, and are perfect for
> teaching.
I looked at Mathematica's new manipulate command and I am now
wondering if it calculates the rendering data on-the-fly when the
sliders are moved or does it precalculate the rendering data and then
the sliders are used to navigate through this data?
Ted
-MH
On Sep 14, 5:50 pm, Chris Chiasson <chris.chias...@gmail.com> wrote: