[sage-devel] Re: Fwd: axiom

2008-08-21 Thread Ondrej Certik

On Thu, Aug 21, 2008 at 6:50 AM, mhampton [EMAIL PROTECTED] wrote:

 I really need to go to sleep so I won't do a top-ten, but here's a top
 2:

Thanks for reminding me this. It seems that people really like
Mathematica, so when I graudate, I'll try to learn it and do something
in it, so that I get a better feeling for how easy it is. Especially
its assumptions and substitution.

Ondrej

--~--~-~--~~~---~--~~
To post to this group, send email to sage-devel@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/sage-devel
URLs: http://www.sagemath.org
-~--~~~~--~~--~--~---



[sage-devel] Re: Fwd: axiom

2008-08-21 Thread Fernando Perez

On Wed, Aug 20, 2008 at 9:37 PM, mhampton [EMAIL PROTECTED] wrote:

 I used to really enjoy writing programs in mathematica, but maybe I'm
 a strange person.  I only stopped in order to force myself to get
 fluent with Sage.  I think it just depends on your background, what
 you are used to, and what you want to do.  For symbolic calculations
 and programming I still miss mathematica quite often.

 -M. Hampton

 On Aug 20, 12:59 am, Fernando Perez [EMAIL PROTECTED] wrote:
 On Tue, Aug 19, 2008 at 1:05 PM, Ondrej Certik [EMAIL PROTECTED] wrote:
  but
  programming in Mathematica is not fun.

 And that would be the understatement of the week.

I don't think you're strange, I was just joking a bit.  Caveat: it's
been years that I've *programmed* in Mathematica in a serious way
(recently I've mostly used it as a fancy calculator for quickly
computing integrals I'm too lazy to do  by hand).  But having said
that, what I really found Mathematica programming to be was a very
mixed experience: certain things that should be easy were
unjustifiably tricky to achieve, even after consulting with local
hard-core gurus.

But the elegance with which you can  manipulate expressions
*structurally* is truly something to behold. This comes courtesy of
the lisp-like facilities you have for accessing any entity, working on
it as an expression tree you  can manipulate with very powerful
transformation rules. And there are classes of problems where that
approach allows you to get pretty much exactly the solution you're
after with a minimum amount of fuss, where as in more conventional
languages it would be a lot of work.

So there, I hope this is a slightly more reasoned reply to a topic
worthy of an honest answer ;)

Cheers,

f

--~--~-~--~~~---~--~~
To post to this group, send email to sage-devel@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/sage-devel
URLs: http://www.sagemath.org
-~--~~~~--~~--~--~---



[sage-devel] Re: Fwd: axiom

2008-08-21 Thread Ondrej Certik

On Thu, Aug 21, 2008 at 10:47 AM, Fernando Perez [EMAIL PROTECTED] wrote:

 On Wed, Aug 20, 2008 at 9:37 PM, mhampton [EMAIL PROTECTED] wrote:

 I used to really enjoy writing programs in mathematica, but maybe I'm
 a strange person.  I only stopped in order to force myself to get
 fluent with Sage.  I think it just depends on your background, what
 you are used to, and what you want to do.  For symbolic calculations
 and programming I still miss mathematica quite often.

 -M. Hampton

 On Aug 20, 12:59 am, Fernando Perez [EMAIL PROTECTED] wrote:
 On Tue, Aug 19, 2008 at 1:05 PM, Ondrej Certik [EMAIL PROTECTED] wrote:
  but
  programming in Mathematica is not fun.

 And that would be the understatement of the week.

 I don't think you're strange, I was just joking a bit.  Caveat: it's
 been years that I've *programmed* in Mathematica in a serious way
 (recently I've mostly used it as a fancy calculator for quickly
 computing integrals I'm too lazy to do  by hand).  But having said
 that, what I really found Mathematica programming to be was a very
 mixed experience: certain things that should be easy were
 unjustifiably tricky to achieve, even after consulting with local
 hard-core gurus.

 But the elegance with which you can  manipulate expressions
 *structurally* is truly something to behold. This comes courtesy of
 the lisp-like facilities you have for accessing any entity, working on
 it as an expression tree you  can manipulate with very powerful
 transformation rules. And there are classes of problems where that
 approach allows you to get pretty much exactly the solution you're
 after with a minimum amount of fuss, where as in more conventional
 languages it would be a lot of work.

 So there, I hope this is a slightly more reasoned reply to a topic
 worthy of an honest answer ;)

I need to learn Mathematica to understand what it means. In SymPy, you
can do some fancy stuff as well, e.g.:

In [1]: e = x*y+sin(x*y)**3

In [2]: print e
x*y + sin(x*y)**3

In [3]: from sympy.utilities.iterables import postorder_traversal,
preorder_traversal

In [4]: postorder_traversal(e)
Out[4]: generator object at 0xa53376c

In [9]: print list(postorder_traversal(e))
[x, y, x*y, sin(x*y), 3, sin(x*y)**3, x, y, x*y, x*y + sin(x*y)**3]

In [10]: print list(preorder_traversal(e))
[x*y + sin(x*y)**3, sin(x*y)**3, sin(x*y), x*y, x, y, 3, x*y, x, y]

And here is how those two functions are implemented:

def preorder_traversal(node):
yield node
for arg in node.args:
for subtree in preorder_traversal(arg):
yield subtree

def postorder_traversal(node):
for arg in node.args:
for subtree in postorder_traversal(arg):
yield subtree
yield node



So you can access all expressions uniformly and iterate over the
expression tree in 4 lines by hand, or just calling one of the
predefined functions above. I don't think this is complicated, but
maybe things can be made even easier.


Ondrej

--~--~-~--~~~---~--~~
To post to this group, send email to sage-devel@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/sage-devel
URLs: http://www.sagemath.org
-~--~~~~--~~--~--~---



[sage-devel] Re: Fwd: axiom

2008-08-21 Thread Bill Page

On Thu, Aug 21, 2008 at 12:50 AM, mhampton wrote:

 I really need to go to sleep so I won't do a top-ten, but here's a
 top 2:

 1) Powerful substitutions and rules.  Sage does not have anything
 comparable.  The .subs() function is buggy even in its limited
 domain.  There have been previous posts on sage-devel that give
 good  examples of this.


Because of the subject of this thread I feel justified in giving the
following examples from Axiom:

http://axiom-wiki.newsynthesis.org/ManipulatingExpressions

Perhaps Sage can implement some form of pattern matching and
subsitution such is done by Axiom's rewrite rules? I think that in
many respects these provide a functionality similar to Mathematica.

There is also a similar re-writing system in Maple (applyrule).

 ...
 On Aug 20, 11:38 pm, William Stein wrote:
 On Wed, Aug 20, 2008 at 9:37 PM, mhampton [EMAIL PROTECTED] wrote:

  I used to really enjoy writing programs in mathematica, but maybe
  I'm  a strange person.  I only stopped in order to force myself to
  get fluent with Sage.  I think it just depends on your background,
  what you are used to, and what you want to do.  For symbolic
  calculations and programming I still miss mathematica quite often.

 Could you remind me (yet again) of the top ten things you miss about
 mathematica for symbolic calculations?


--~--~-~--~~~---~--~~
To post to this group, send email to sage-devel@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/sage-devel
URLs: http://www.sagemath.org
-~--~~~~--~~--~--~---



[sage-devel] Re: Fwd: axiom

2008-08-21 Thread Robert Bradshaw

On Aug 21, 2008, at 8:08 AM, Bill Page wrote:


 On Thu, Aug 21, 2008 at 12:50 AM, mhampton wrote:

 I really need to go to sleep so I won't do a top-ten, but here's a
 top 2:

 1) Powerful substitutions and rules.  Sage does not have anything
 comparable.  The .subs() function is buggy even in its limited
 domain.  There have been previous posts on sage-devel that give
 good  examples of this.


 Because of the subject of this thread I feel justified in giving the
 following examples from Axiom:

 http://axiom-wiki.newsynthesis.org/ManipulatingExpressions

 Perhaps Sage can implement some form of pattern matching and
 subsitution such is done by Axiom's rewrite rules? I think that in
 many respects these provide a functionality similar to Mathematica.

 There is also a similar re-writing system in Maple (applyrule).

I believe patter matching is something that GiNaC will get for us.

- Robert


--~--~-~--~~~---~--~~
To post to this group, send email to sage-devel@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/sage-devel
URLs: http://www.sagemath.org
-~--~~~~--~~--~--~---



[sage-devel] Re: Fwd: axiom

2008-08-21 Thread Robert Dodier

On Aug 21, 9:08 am, Bill Page [EMAIL PROTECTED] wrote:

 Perhaps Sage can implement some form of pattern matching and
 subsitution such is done by Axiom's rewrite rules? I think that in
 many respects these provide a functionality similar to Mathematica.

 There is also a similar re-writing system in Maple (applyrule).

Dunno if it matters but there is also pattern matching, substitution,
and expression-hacking machinery in Maxima.

It's probably well within the realm of possibility to strengthen
Maxima's pattern matching by importing an existing Lisp
library for that purpose. I haven't looked into the details.

FWIW

Robert Dodier

--~--~-~--~~~---~--~~
To post to this group, send email to sage-devel@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/sage-devel
URLs: http://www.sagemath.org
-~--~~~~--~~--~--~---



[sage-devel] Re: Fwd: axiom

2008-08-20 Thread Fernando Perez

On Tue, Aug 19, 2008 at 1:05 PM, Ondrej Certik [EMAIL PROTECTED] wrote:

 but
 programming in Mathematica is not fun.

And that would be the understatement of the week.

Cheers,

f

--~--~-~--~~~---~--~~
To post to this group, send email to sage-devel@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/sage-devel
URLs: http://www.sagemath.org
-~--~~~~--~~--~--~---



[sage-devel] Re: Fwd: axiom

2008-08-20 Thread mhampton

I used to really enjoy writing programs in mathematica, but maybe I'm
a strange person.  I only stopped in order to force myself to get
fluent with Sage.  I think it just depends on your background, what
you are used to, and what you want to do.  For symbolic calculations
and programming I still miss mathematica quite often.

-M. Hampton

On Aug 20, 12:59 am, Fernando Perez [EMAIL PROTECTED] wrote:
 On Tue, Aug 19, 2008 at 1:05 PM, Ondrej Certik [EMAIL PROTECTED] wrote:
  but
  programming in Mathematica is not fun.

 And that would be the understatement of the week.

 Cheers,

 f
--~--~-~--~~~---~--~~
To post to this group, send email to sage-devel@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/sage-devel
URLs: http://www.sagemath.org
-~--~~~~--~~--~--~---



[sage-devel] Re: Fwd: axiom

2008-08-20 Thread William Stein

On Wed, Aug 20, 2008 at 9:37 PM, mhampton [EMAIL PROTECTED] wrote:

 I used to really enjoy writing programs in mathematica, but maybe I'm
 a strange person.  I only stopped in order to force myself to get
 fluent with Sage.  I think it just depends on your background, what
 you are used to, and what you want to do.  For symbolic calculations
 and programming I still miss mathematica quite often.


Could you remind me (yet again) of the top ten things you miss about
mathematica for symbolic calculations?

 -- William

--~--~-~--~~~---~--~~
To post to this group, send email to sage-devel@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/sage-devel
URLs: http://www.sagemath.org
-~--~~~~--~~--~--~---



[sage-devel] Re: Fwd: axiom

2008-08-20 Thread mhampton

I really need to go to sleep so I won't do a top-ten, but here's a top
2:

1) Powerful substitutions and rules.  Sage does not have anything
comparable.  The .subs() function is buggy even in its limited
domain.  There have been previous posts on sage-devel that give good
examples of this.

2) Implicit variable declaration - ? I'm not sure what to call this.
Basically, mathematica assumes everything is in the equivalent of its
symbolic ring until told otherwise.  Because of problems with Sage's
symbolics, I often have to explicitly declare a ring (e.g. R.x,y,z =
PolynomialRing(QQ,3)), and then later when I want to do something else
declare another ring.  I often get headaches when adding or removing
variables, changing term orders, or trying to do simplifications in
which intermediate quantities don't fit the current setup (e.g. a
fraction field).  I am hoping that some of the coercion changes will
help with some of this.

Part of my problem with #2 probably doesn't make as much sense to you
because Mathematica has a bias towards working in QQ, and that is what
I usually care about.  I am sure that if you like working over more
exotic fields Sage starts to have advantages.

Hope that helps, I am too tired to explain in more detail right now.

Cheers,
M. Hampton

On Aug 20, 11:38 pm, William Stein [EMAIL PROTECTED] wrote:
 On Wed, Aug 20, 2008 at 9:37 PM, mhampton [EMAIL PROTECTED] wrote:

  I used to really enjoy writing programs in mathematica, but maybe I'm
  a strange person.  I only stopped in order to force myself to get
  fluent with Sage.  I think it just depends on your background, what
  you are used to, and what you want to do.  For symbolic calculations
  and programming I still miss mathematica quite often.

 Could you remind me (yet again) of the top ten things you miss about
 mathematica for symbolic calculations?

  -- William
--~--~-~--~~~---~--~~
To post to this group, send email to sage-devel@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/sage-devel
URLs: http://www.sagemath.org
-~--~~~~--~~--~--~---



[sage-devel] Re: Fwd: axiom

2008-08-19 Thread William Stein

 I would be glad (with your permission) to post this question and my
 reply on-list somewhere - sage-devel if you prefer.

 On Mon, Aug 18, 2008 at 6:50 PM, Ondrej Certik wrote:
 Hi Bill,

 since you know both Python and Aldor or Axiom and now you know
 Sage quite a bit, do you think Aldor or the Axiom style of things
 (domains) is viable? I know it's not 100% equivalent to Python and
 it can be fast with Aldor.


 Yes, certainly I think Axiom domains are viable. Another way of asking
 this question is: if static strongly typed language with first-order
 polymorphic dependent types is viable? I think this has been answered
 in the positive by other experiments besides Axiom such as the ML
 series of languages and Haskell. Axiom (and Aldor) however does have a

The popularity of these examples with end users suggests
to me a lack of viability. Though of course it depends on one's
goals.

 The Sage concept of 'parent' is an attempt to capture similar generic
 relationships that are represented by categories in Axiom, but I do
 not like the fact that this concept needs to be added on to Sage
 rather than being supported by some more fundamental feature of
 Python, e.g. Python meta-types.

Just to make sure credit goes where it should, the idea of
parent is not a Sage concept
but a Magma concept.  I think the credit for it should definitely
go to John Cannon et al., and certainly not to me or Sage.
I think in Magma it is also not a part of the language but something
that is implemented on top of the Magma language.  Unlike
you, I personally like that parent is not a fundamental feature
of Python, but a design pattern that can be implemented
on top of Python.  That means one can directly use the same idea
in C/C++/etc. code.

 -- William

--~--~-~--~~~---~--~~
To post to this group, send email to sage-devel@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/sage-devel
URLs: http://www.sagemath.org
-~--~~~~--~~--~--~---



[sage-devel] Re: Fwd: axiom

2008-08-19 Thread Ondrej Certik

Hi Bill,

On Tue, Aug 19, 2008 at 8:14 PM, Bill Page [EMAIL PROTECTED] wrote:
 Yes, certainly I think Axiom domains are viable. Another way of asking
 this question is: if static strongly typed language with first-order
 polymorphic dependent types is viable? I think this has been answered
 in the positive by other experiments besides Axiom such as the ML
 series of languages and Haskell. Axiom (and Aldor) however does have a
 slightly different angle on the object-oriented part of the language
 by introducing the concept of 'category'. Categories are named subsets
 of domains. Categories allow a kind of generic programming that seems
 quite suitable to mathematical algorithms but I think this part of the
 design is less proven. So a better form of your question might be: Is
 the Axiom concept of 'category' viable? The existence of the Axiom
 library (and some of the libraries available in Aldor) provide some
 positive evidence, but I do not consider it proven.


Thanks for answering. As William said, there are not many users of
such languges like Haskell. So while those languages have their
communities, for me personally this is not very viable. But of course
it depends what you want.


 The Sage concept of 'parent' is an attempt to capture similar generic
 relationships that are represented by categories in Axiom, but I do
 not like the fact that this concept needs to be added on to Sage
 rather than being supported by some more fundamental feature of
 Python, e.g. Python meta-types.

 What are your personal goals with Axiom (and forks)?


 My personal goals do shift a little over time but currently I am
 mostly focused on the goal of using many algebraic notions from
 mathematical category theory (not the same as the notion of category
 in Axiom), in computer algebra. Ultimately, like you I want to be able
 to use computer algebra in theoretical physics but perhaps my goals
 are a little more abstract.

 http://axiom-wiki.newsynthesis.org/CategoryTheoryAndAxiom

I see thanks.


 I don't know how to judge it. I was looking at fricas mailinglist,
 currently it has 59 members. Sympy list has 172 members.  But
 these numbers can easily change, so it imho doesn't say much.


 What do you mean by judge? Are you trying to consider which of Sympy
 or FriCAS is more viable? I think you first have to define more
 exactly what you mean, e.g. viable for what purposes etc. You have
 previously argued that the simply popularity of a language like Python
 trumps any technical advantage that FriCAS may or may not have. I do
 accept that as largely true. On the other hand Python would *not* be
 my language of choice for doing more abstract things in category
 theory.

 Sympy compared to fricas is really stupid, it cannot do many things.

 Probably it is more accurate to compare Sympy to some of the libraries
 that are available in Aldor, e.g. 'libAlgebra' and 'BasicMath'. These
 libraries also cannot do many things but they attempt to do at least
 a small number of things reasonably well.  FriCAS likewise has the
 Axiom library but it is not so easily separable from the rest of the
 Axiom environment and interpreter (some people might call it: the
 Axiom ecosystem). So maybe it is better to compare FriCAS to Sage
 and/or Maxima etc. As I understand it Sympy does not attempt to become
 such an ecosystem but rather just a rather more lightweight library
 for Python programmers. Right?

Yes, my own aim with Sympy is to just be a library to Python, that is
small and hackable, but feature full and fast. Something like numpy
but for symbolic stuff. That people can take and use in their programs
in engineering, physics, or applied math. It should have all features
of calculus in Mathematica. For example I would like to do quantum
field theory in sympy. There are many nice and interesting
calculations, that just cry out for being automated. I'd like to play
with it in python. There are some packages for it in Mathematica, but
programming in Mathematica is not fun.

Ondrej

--~--~-~--~~~---~--~~
To post to this group, send email to sage-devel@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/sage-devel
URLs: http://www.sagemath.org
-~--~~~~--~~--~--~---