Tagged Questions

This is for questions about creating and using custom notations. For help on the use of the built-in operators, see syntax.

10k views

Can we use letter with a subscript as a variable in Mathematica?

I tried Subscript[a, 0] = 1 (* 1 *) Clear[Subscript[a, 0]] ...
772 views

Prefix operator with low precedence

The question is simple, but I will elaborate on the background as well for those interested in the idea: How to define a new operator with specified precedence value? Background Mathematica was ...
1k views

I'm trying to define some notation so that Mathematica code would be more functional, similar to Haskell (just for fun): currying, lambdas, infix operator to function conversion, etc.. And I have some ...
3k views

How do I create an operator which acts like a derivative to everything to the right of it: for example: $\left( \partial_x + \partial_y + z \right ) x \psi$ How do I make that evaluate to: $x \... 3answers 1k views How is + as an infix operator associated with Plus? How is + associated with Plus? Suppose I want to define a head FooBar and have it ... 2answers 1k views How to use subscript in pattern names? For example I want to define a function with parameters σx and σy, that is, the function will be declared as: f[σx_,σy_] := . . .... 2answers 993 views How can one define an infix operator with an arbitrary unicode character? You can setup "UsefulFunction[a, b]" to use custom infix notation "a [LeftRightArrow] b" as follows: ... 4answers 3k views How to implement Donald Knuth's up-arrow notation How does one enter very large numbers in up-arrow notation? Up-arrow notation was created by Donald Knuth to write very large numbers in it iterated exponentiation form, for example 6↑↑3 = 6^6^6. 2answers 338 views Difficulties in creating strict and robust equivalence between two symbols using the Notation package I am investigating the use of the Notation package facilities to create strict the equivalence between pretty-printed symbols such as ... 1answer 242 views Why is D[a[b][c],a[b]] equal to 1[c]? Background: I had the same issue as described here, and I went to extend Mr.Wizard’s code such that a[b][c] would be shown as$a_b^c$. Issue: To my surprise, ... 1answer 501 views Creating custom notation How does one generate custom symbols? For example, the physicist notation for the rotation is "nabla cross function". In this case however, Mathematica complains that the ... 3answers 350 views Redefining a built-in operator Is there a way I can redefine the || operator such that a||b will be 1/(1/a + 1/b)? Is it ... 2answers 342 views Custom Format for “constructors” Say I have a the typical Mathematica linked list structure defined like so: Attributes[Pair] = {HoldAllComplete}; Nil = Pair[]; Cons = Pair[#1, #2]&; It's ... 2answers 2k views How to tell Mathematica that a function is dependent on other variables? I am trying to derive some turbulence model dependencies and I am using Reynolds averaged Navier-Stokes equations. What I am trying to do is to tell Mathematica that OverBar[u] is dependent on x,y,z ... 1answer 349 views Assignment rule to distribute matrix-multiplication over custom notation I'm trying to write some code to do basic algebraic manipulations in BraKet notation. Thus far I have a function KetToVec which will convert any expression of the form a1 Ket[s1]+ b Ket[s2] +... to a ... 1answer 257 views Can the Notation function support complex structures on its left hand side? In my investigation of the possibilities offered by the Notation package, I came over a limitation in the complexity of the left hand side symbol. For instance, although I am able to enter ... 1answer 226 views How to construct custom operators with precedence? I need to combine data structures in operations analogous to addition, subtraction, multiplication and division (and more). I need more than one operation of each type, i.e. more than one method of ... 5answers 503 views Defining indefinitely many functions Is it possible to define a class of indefinitely many functions f1, f2, f3, ... such that <... 1answer 621 views Using the symbol I for electrical current [duplicate] I would like to use the I as a symbol for the electrical current. How can I redefine it, so it is not interpreted as the imaginary unity? 1answer 647 views Simplistic Notation example Notation package looks poorly documented. For example, GridBoxDividers option is not documented at all. Can someone give me a simplistic example of a Notation set ... 3answers 212 views Map Input A B C to MyProduct[A,B,C] (NOT to Times[A,B,C]) In writing my own (noncommutative) product I want to avoid typing redundant symbols like A.B.C or A**B**C, I just want to type <... 1answer 317 views Dot in place of prime to denote differentiation To denote differentiation with respect to time I wish to use overhead dots rather than primes, so that differential expressions will look somewhat like this:$\quad \quad$... 1answer 212 views Custom display format for custom operator I've tried searching here and in the WRI documentation, but I haven't found what I'm looking for in either place. I'm defining a dx operator to act as a ... 1answer 368 views How to use Feynman Slash notation? How can I use Feynman slash notation, e.g.,$\require{cancel} \cancel{A}$, in Mathematica? I've seen some answer from 2008 which doesn't seem to work well in Mathematica 10. I'd like this to be part ... 1answer 350 views $\TeX$conversion, support for \hphantom I'm trying to write some$\TeX$conversion for a tensor with an upper and a lower index, but I would like the lower index to be displaced to the right by the width of the upper index. In (La)TeX I ... 3answers 606 views Can symbols like + or * be used to denote the Plus and Times functions? Can one do something similar to +[1, 2]? The point is that with one symbol you would be able to write expressions like ... 3answers 188 views How to use in for MemberQ I'd like to use for MemberQ, but I don't want to break anything! The usage would be like this: ... 3answers 252 views How to imitate list comprehensions for constant arrays? In Python, ['a'] * 10 generates ['a', 'a', 'a', 'a', 'a', 'a', 'a', 'a', 'a', 'a'] and ... 1answer 246 views Override @ to mock Java Classes This question appears impossibly long so apologies in advance (skip to the bottom if you want to see the actual questions). I want to be able to mock Java Classes in Mathematica code. For example, I ... 2answers 158 views How do I mimic the functionality of “<>”? The Cell expression for: <> is Cell[BoxData["<>"], "Input"] However similar expressions are parsed into RowBox(... 3answers 209 views How to re-parse (or re-map) character '.' to user-defined function The default behavior of the character . between two non-numeric characters is to be interpreted as the infix of the Mathematica function ... 3answers 236 views One line definition of a symbol with plus-minus I'm pretty new to Mathematica. I was wondering is there any way to define the symbol$H_\pm(x,y) = f(x) \pm g(y)$in one line, so that$H_-$or$H_+$can be called separately? Something like: ... 5answers 127 views Special notation using round brackets and avoiding commas (for$\LaTeX$input)? Internally, when I work with mathematica I use a notation like br[1,2,3,4] to denote some quantities. Then I would like to export the results in ... 3answers 983 views Using subscript in a string I am trying to create a string of the form$0 < d_1 < d_2 < \ldots < d_n$For a given n. My closest attempt so far is ... 3answers 298 views Notation package: parenthesis placement for SuperscriptBox The question concerns the Notation package. I want to define notation for the function very similar to the built-in Power[a,b] ... 1answer 139 views Setting a binary operator Flat I defined a binary operator in as the first statement in a new Mathematica notebook. {x1_, y1_} ⊕ {x2_, y2_} := Module[{}, Print["do anything"];] where the code ... 1answer 179 views How can I make angle brackets function like lists? Is there a way to make <a,b,c> behave like {a,b,c}, but remain displayed as ... 1answer 96 views How to implement Feynman function notation? I would like trig functions to format with custom DisplayForms as follows: These were created by Richard Feynman in high school. Related: http://tex.stackexchange.com/questions/274463/feynman-... 0answers 183 views Notation Package Quirk for single Symbols I encounter the following quirk in the Notation package: consider the following ==> and <== declarations ... 1answer 151 views Best choice for an infix join operator? I would love some advice for what symbol to use and best implement it? ... 1answer 107 views Vertical “fractions” with more than 2 parts Standard FractionBox syntax allows only 2 arguments and creates 2-part fraction for numerator and denominator. Is it possible to draw similar construction, but ... 1answer 2k views How to define the Einstein summation convention in Mathematica? How to define a Einstein summation convention in Mathematica? Say, how to let Mathematica know T[i,i] equals ... 1answer 212 views Custom operators; custom pattern matching with pure functions What I'm trying to achieve in Mathematica is the creation of a binary operator whose operands are both pure functions over the natural numbers. The result of the operator should be another pure ... 1answer 56 views How is MakeExpression processed by Mathematica? According to the documentation on MakeExpression, MakeExpression[boxes, form] is the low-level function used in Wolfram System sessions to construct expressions ... 0answers 58 views Custom units Compatible with Conversions [closed] I am writing a Mathematica Palette to work with units, and am wondering if anyone knows a way to define new units outside of the standard ones that come with Mathematica 9. I do know of the ... 0answers 78 views Notation, Format and Interpretation I am unclear on the exact relationship between Notation, Format and Interpretation. ... 0answers 58 views Can I define a “postfix map” operator with comparable precedence behavior to // [duplicate] I am trying to define a "postfix map" operator (denoted$OP$for now) that behaves thus: ... 0answers 280 views Best Practice for using Notation,$Pre, MakeExpression in a package [closed]

I'm setting up a package that defines a custom notation. I'd like to inquire about best practices and possible issues of: using the Notation Package using \$Pre ...