On 20/09/2020 17:29, Oscar Benjamin wrote:

The main difference as far as I tell compared to replace is the need
to create the Wild symbols explicitly. Maybe we could add a bunch of
those to sympy.abc with names like p1_ and p2_ (are those names
standardised?).

Those examples are a revelation! I think they should be added to the documentation of replace and Wild(). I must admit I thought I'd tried something like that with replace, but without success - maybe I hit a bug?

Of course I realise that SymPy can't start defining operators like /. -> etc. In any case, one irritation with Mathematica, is that there are just too many operator precedences to remember!

The only thing that is standard about the names is the _ on the end, the rest of the name is chosen by the user, if you named the pattern variables with a trailing _ in abc , then I think it would be really friendly - I mean I think a CAS needs to be easy to use.

Given that functionality, the pattern matching looks pretty good. One other thing is that Mathematica also has a way to define a pattern that only matches if a predicate returns True when applied to it, for example:

p1_?Even

There are also some more obscure things that can be done with Mathematica patterns, but probably these are of lesser importance. Also patterns are used in some other contexts, for example a user defined function is written with pattern variables as arguments. This allows for overloaded functions.

It sounds as if the real thing that needs doing is documenting these features!

I haven't used this at all myself but you might be interested by mathics:
http://mathics.github.io/
""
Mathics is a free, general-purpose online computer algebra system
featuring Mathematica-compatible syntax and functions. It is backed by
highly extensible Python code, relying on SymPy for most mathematical
tasks.
"""

I did consider  this, but it became clear that it isn't being actively supported. For example, it required a specific (out of date) version of Python. I'd certainly not get anything like the support that your group offer! Besides, by now, I have got somewhat under the hood of SymPy.

David

--
You received this message because you are subscribed to the Google Groups 
"sympy" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sympy/1838043e-772a-787e-1716-c716e76587fd%40dbailey.co.uk.

Reply via email to