157 views

How can Mathematica automatically replace NonCommutativeMultiply[x] with x for a single argument x? [duplicate]

By default, an expression like NoncommutativeMultiply[x] does not simplify to x, unlike ...
• 151
236 views

What are Flat Attribute best practices? [duplicate]

I would like, as an example, to build a Times-like function. Take the following example ...
• 909
71 views

non listable plus and times [duplicate]

I am trying to create my own Plus and Times functions, which are identical to the built in ones with the exception that they are ...
• 1,223
45 views

How to make a Flat function return x when evaluated as f[x]? [duplicate]

With SetAttributes[f, Flat], f[a_] can get matched to f of any number arguments. How can I ...
• 1,790
33 views

Except not working in Function [duplicate]

I have defined the CirclePlus operator as follows: ...
• 1,419
750 views

SetAttributes[f,Flat]: Why the order dependence?

I'm experiencing a strange phenomenon. Here's a (quite artificial) test case: The following definition work just fine: ...
• 19.1k
531 views

Evaluation of Alternatives

I recently stumbled upon a few examples that suggest patterns containing Alternatives do not evaluate for individual alternatives. For example: ...
• 3,473
639 views

Orderless pattern matching

The MMA docs state that "In matching patterns with Orderless functions, all possible orders of arguments are tried". Why then does the following not work? ...
• 565
570 views

partial numerical evaluation

Context The following is an issue I have come across many times and still do not have a satisfactory solution for. The context of it is this. Let's say we have an equation, a linear ODE for the ...
• 1,223
202 views

Recursion depth exceeded in pattern matching with attribute Flat

I am defining a linear associative multiplication operation Mult[]: ...
• 781
1 vote
2k views

Why does Mathematica add Hold to the result of my user defined symbol?

In the code below I have defined a symbol that multiplies two block-matrices (I can't use the builtin Dot since Dot assumes that the matrix coefficients commute): ...
366 views

Why rule does not work if Flat attribute?

The following works: ...
• 2,023
126 views

Functions in a different context are replaced with infix forms of their namesake in System

So, in an attempt to help out Fabian with his question, I did what I often do, and created a new symbol in the Pillsy package that I could play with. Since it was ...
• 18.5k