On Sun, Jul 13, 2014 at 8:10 PM, Aaron Meurer <asmeu...@gmail.com> wrote:
> On Thu, Jul 3, 2014 at 5:44 PM, F. B. <franz.bona...@gmail.com> wrote:
>>
>>
>> On Thursday, July 3, 2014 11:46:21 PM UTC+2, Aaron Meurer wrote:
>>>
>>> On Mon, Jun 23, 2014 at 10:02 AM, F. B. <franz....@gmail.com> wrote:
>>> > I suggest to keep the Mathics implementation of pattern matching as a
>>> > reference. It should be compatible with Mathematica, but, unlike
>>> > Mathematica, we can access Mathics' source code.
>>>
>>> If you think you can use mathics code directly, we can ask Angus if he
>>> is willing to relicense it.
>>>
>>
>> I think that much of Mathics is owned by Poeschko.
>
> But if Angus wrote the original code, then he is the one would would
> need to relicense it.
>
> Of course, the first step is to see if it is even reusable. It likely
> depends on how easy it is to decouple it from the Mathematica
> frontend.
>
>>
>>> >
>>> > http://www.mathics.net/doc/reference-of-built-in-symbols/patterns-and-rules/alternatives/
>>> >
>>> > I mean, you can use the "alternatives" to match more patterns at the
>>> > same
>>> > time. Something like:
>>> >
>>> > x_**n_ | x_
>>> >
>>> > which would match both Symbol("x") and Pow(x, n).
>>>
>>> But I don't get the part where we need this to have mathematically
>>> sensitive pattern matching.
>>
>>
>> For example, to simulate the current pattern matching.
>>
>>> I don't know Mathematica. What is f[{x, y}]? Is it the same as f[x, y]
>>> (or f(x, y) in SymPy)?
>>>
>>
>> f[{x, y}] is the same as f[List[x, y]], in Python it would be f((x, y)). In
>> general, to understand Mathematica expressions, just convert them to the
>> full form by adding //FullForm to the end of the expression.
>>
>> Expression in Mathematica are roughly equivalent to Lisp S-expression, just
>> the first element is written outside of the square bracket and arguments are
>> comma separated.
>>
>> Lisp: (f (list x y))
>> Mathematica: f[List[x, y]]
>
> But SymPy makes the distinction between f((x, y)) and f(x, y). I think
> in order to have a sequence pattern, you would need a custom routine
> that rebuilt the expression (or add support for it to subs).
>
> Aaron Meurer

I wouldn't worry about this, though, at least for the first pass. Wild
sequences are mainly needed for Add and Mul, which are both
associative, and so would "denest" automatically. In fact, I'm not
sure if they're really useful for non-associative objects. But maybe
you have a use-case for the tensor code.

Aaron Meurer

>
>>
>>
>>> > That would require to efficiently mix many patterns into a unique data
>>> > structure. Furthermore, it also needs to compare priority among
>>> > patterns. I
>>> > think that if pattern are associated with assumptions and conditions,
>>> > the
>>> > correct name would be "predicate dispatch".
>>>
>>> The priority can be separate. The way dsolve works is that it just has
>>> a simple priority system, or you can pass an option to get the result
>>> with all matching patterns.
>>
>>
>> Mathematica allows to artificially modify the matching list after the
>> functions have been defined. I don't know if we really need this feature.
>>
>> --
>> 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 sympy+unsubscr...@googlegroups.com.
>> To post to this group, send email to sympy@googlegroups.com.
>> Visit this group at http://groups.google.com/group/sympy.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/sympy/80ca9987-ed26-4f22-ac0b-79c4d18d5d30%40googlegroups.com.
>>
>> For more options, visit https://groups.google.com/d/optout.

-- 
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 sympy+unsubscr...@googlegroups.com.
To post to this group, send email to sympy@googlegroups.com.
Visit this group at http://groups.google.com/group/sympy.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sympy/CAKgW%3D6LRw7G7nEJbc8BEj4m6d0NdQUNry2KbEbjOtLWDmbSVUA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to