Questions tagged [custom-notation]

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

A lot of the usual mathematical notations have no built-in meaning, and can be extended to behave as the user wishes. There are several ways of creating custom notations built-in to Mathematica, and there is the Notation` package to ease the process, if needed.

154 questions
54
votes
2 answers

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

I tried Subscript[a, 0] = 1 (* 1 *) Clear[Subscript[a, 0]] During evaluation of Clear::ssym: Subscript[a, 0] is not a symbol or a string. >> Clear[a] Subscript[a, 0] (* 1 *) Any idea?
Osiris Xu
  • 1,019
  • 1
  • 9
  • 13
13
votes
2 answers

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 OverBar[SuperStar[af]] that formats as $\overline{af^*}$, and easy to type (but hard to read) symbols such as…
agravier
  • 609
  • 4
  • 10
12
votes
1 answer

Details about Symbolize

When I'm using Symbolize function, there are some details that I'm not sure. For example: << Notation` Symbolize[Subscript[q, 1],Subscript[q, 2]];(*I want to declare two symbols with subscript*) Can I type the name "Symbolize[...]" instead of…
novice
  • 2,325
  • 1
  • 24
  • 30
10
votes
1 answer

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 up? For example, suppose I wish to…
Suzan Cioc
  • 2,023
  • 1
  • 16
  • 21
9
votes
4 answers

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: H_-[1,2] = f[1] - g[2] and H_+[1,2] = f[1] + g[2] .
Skylar15
  • 281
  • 1
  • 9
9
votes
1 answer

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$ DSolve$[\ddot y[t] + \dot y[t]==0,\,\dot y[0]==0,\,y[0]==1,\,y,\,t]$ I would…
Narasimham
  • 3,160
  • 13
  • 26
9
votes
2 answers

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 well-known that turning a regular List into a linked list is easy: ToLinkedList[list_List]…
Pillsy
  • 18,498
  • 2
  • 46
  • 92
9
votes
2 answers

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 coordinates and time. However when doing further…
Misery
  • 2,640
  • 1
  • 30
  • 39
8
votes
1 answer

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 may have a simple Java bean Point that has two…
pjc42
  • 733
  • 3
  • 13
6
votes
3 answers

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: test = {1, 2, 3, 4} find = {3, 4}; Select[test, (# ∈ find) &] I know how to do this with the notation package, but I'm worried that it might cause…
user5601
  • 3,573
  • 2
  • 24
  • 56
6
votes
3 answers

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 A B C and have that mapped to my own Product[A,B,C]. (call me a purist) 1. Is there a clever way to avoid A B C being…
NoEscape
  • 842
  • 4
  • 14
4
votes
2 answers

How can I make angle brackets function like lists?

Is there a way to make behave like {a,b,c}, but remain displayed as (short of setting up new rules for every operation involving such a list that I care about)? Note: I've typed "<" and ">" here for readability, but really mean…
ibeatty
  • 2,533
  • 11
  • 22
4
votes
0 answers

Can I define a "postfix map" operator with comparable precedence behavior to //

I am trying to define a "postfix map" operator (denoted $OP$ for now) that behaves thus: {1, 2, 3} $OP$ # + 1 & == {2, 3, 4} and {1, 2, 3} // RotateLeft $OP$ # + 1 & == {3, 4, 2} and {1, 2, 3} // RotateLeft $OP$ # + 1 & // Total == 9 I hope not…
mfvonh
  • 8,460
  • 27
  • 42
4
votes
2 answers

Defining new brackets

I would like to wrap double-struck brackets around variables for notation purposes only. For instance [[X]] should display as the first image below. However, these brackets are reserved for the built-in function Part. At the moment, I use angle…
Bertram
  • 83
  • 7
4
votes
1 answer

Is there a better way to define more conventional if...then...else notations?

I am implementing pseudocode in Mathematica for a class I'm teaching. I would like to copy the textbook syntax which is IF ... THEN ... ELSE ... ENDIF. My results are not very satisfactory and my question is whether there is a way of overcoming the…
fairflow
  • 1,028
  • 5
  • 18
1
2