29

Maybe I miss the point here, but FullForm[x ↗ y] gives UpperRightArrow[x,y]. This is described in the documentation to UpperRightArrow and since this symbol is not protected and has not built-in meaning, you can just define it the way you like: UpperRightArrow[x_, y_] := FooBar[x, y] and this instantly gives you Update: As answer to Jacobs comment I ...


25

Updated to include both unary and binary operators One idea is to use the usage message of a symbol as a clue that it has a special display form, probably with no built-in meaning. For example: ?TildeTilde The following 2 functions check the usage message of a symbol to see if it contains "displays as" or "formats as", and then weeds out those symbols ...


23

UpArrow[a_, n_Integer] := Nest[a^# &, 1, n] then UpArrow[4, 3] or 4 \[UpArrow] 3 To complete this method you may wish to add an input alias: AppendTo[CurrentValue[$FrontEndSession, InputAliases], "up" -> "\[UpArrow]"]; Now EscupEsc will enter \[UpArrow]. Change $FrontEndSession to $FrontEnd and run it only once to make the change persist ...


21

Corrected to use SubscriptBox as Rojo showed and Kvothe commented, fixing binding. Rojo shows a way in Is it possible to define custom compound assignment operators like ⊕= similar to built-ins +=, *= etc? MakeExpression[RowBox[{f_, SubscriptBox["/@", n_], expr_}], StandardForm] := MakeExpression @ RowBox[{"Map", "[", f, ",", expr, ",", "{", n, "}", "]"}...


20

I can't answer how the association is made for the built-in operators, but I can show how to add your own. If your symbol is already an operator you can do this simply as halirutan showed. This question may be a duplicate of How can one define an infix operator with an arbitrary unicode character? but since it admits a simpler interpretation I shall not ...


19

Update As pointed out by @Edmund, my initial answer didn't work with hex numbers starting with an integer. To fix that, I included an initial \[DiscretionaryHyphen] character, and then I drop that character when converting to a number using FromDigits (my first update used x, but I like this new approach better): CurrentValue[EvaluationNotebook[], ...


17

Update I've created a paclet. Install with: PacletInstall["https://github.com/carlwoll/DifferentialOperator/releases/download/0.1/DifferentialOperator-0.0.1.paclet"] and load with: <<DifferentialOperator` Original post Here's an approach I've been playing with that attempts to mimic traditional notation for these kinds of operators. The ...


16

Agree with other answers, this is a bad idea (why, precisely do you want to do this?), but in the spirit of encouraging unmaintainable write-once read-never code, here's my entry into the freak show: $NewSymbol = If[StringMatchQ[#, "f" ~~ NumberString], ToExpression[# <> "[x_]=x+" <> StringDrop[#, 1]]] &; Remove["f*"]; ...


15

The Notation package is the most convenient way to define new notation(s). <<Notation` Define an infix notation. You can use the palette that the 'Notation` package pops up to do this. InfixNotation[ParsedBoxWrapper["\[UpperRightArrow]"], FooBar] Check that the infix notation maps to the correct FullForm expression. x \[UpperRightArrow] y // ...


13

The possibility to insert operators and functions as you know them from mathematics is not possible for all things. Usually, you find the special input possibilities on the reference page of the function in the Details section. See for instance the documentation of Integrate. For Binomial there seems to be no such 2d input, because as you already found out, ...


13

You can use the Notation package. It requires a GUI palette though. Needs["Notation`"] Once you have this package loaded, you can use the template to define: Notation[+[x___] ==> Plus[x___]] and then +[1,2,3] (* 6 *) Similarly, Notation[*[x___] ==> Times[x___]] and so *[2,3,4] (* 24 *) Note: A * typed as the first character of a cell ...


13

I'm not aware of a simple one, but perhaps you could make your own? The following is not great because it requires you to enter CenterDot as Esc+.+Esc, and you can't control the precedence, but depending on your use-case, it might be useful. In addition, you can use whatever built-in symbol with no built-in meaning you want: CenterDot[f_, a_] := Map[f, a, {...


12

Just to be clear, I think this is a terrible idea but nevertheless, a question has been posed for which there is a simple answer: ClearAll@fn SetAttributes[fn, HoldAll] fn[h_[x_]] /; StringMatchQ[SymbolName@h, "f" ~~ DigitCharacter ..] := First@StringCases[SymbolName@h, "f" ~~ d : DigitCharacter .. :> x + ToExpression@d] fn[...


12

The big issue here is that ∈ is a system defined symbol and messing with it in this way can have all manner of unintended consequences. You don't know what is using it behind the scenes. If you really need to then you can use Infix notion on your own in function. in[form_, list_] := MemberQ[list, form] Select[test, #~in~find &] (* {3, 4} *) Or you ...


11

Here's a more general variant a(↑...↑)b with any given number of up-arrows, as defined on MathWorld: (* Short-hand for single arrow. *) UpArrow[a_, b_] := UpArrow[1][a, b]; (* Trivial case of a(↑...↑)1. *) UpArrow[_][a_, 1] := a; (* Single arrow: exponentation. *) UpArrow[1][a_, b_] := a^b; (* Generic case: do a recursion. *) UpArrow[n_Integer][a_, ...


11

Use upvalues. You don't want || to change its behavior except when it's operating on impedances. So, use a wrapper (z[ ], say) around the quantities that represent impedances, and associate upvalues with the wrapper. This lets you redefine how standard operators work on the wrapped values: z[a_] || z[b_] ^= z[1/(1/a + 1/b)]; z[a_] + z[b_] ^= z[a + b]; a_ z[...


11

I can't test robustness, because I don't know what your work flow is, but one can Format the expression: Format[D[f_[t], {t, n_ /; n < 3}]] := OverDot[f, n] Then, expr1 = D[f[t], t] expr2 = D[f[t], {t, 2}] looks like: Then, you can use TeXForm: TeXForm[expr1 + expr2] (* \ddot{f}+\dot{f} *)


11

Here is an approach based on reading the Front End resource UnicodeCharacters.tr. This method finds some operators that do not presently appear in Carl Woll's list including documented operators CapitalDifferentialD, DifferentialD, and Square, and runs much more quickly. However it also misses the bracketing operators i.e. AngleBracket, BracketingBar, ...


10

I think SeriesCoefficient is what you want. Then you can use it to display formatted formulas series[expr_, x_, x0_] := Defer[expr = Sum[#, {n, 0, ∞}]] &[ FullSimplify@SeriesCoefficient[expr, {x, x0, n}, Assumptions -> {n >= 0}] (x - x0)^n] series[Sin[x] Cos[x]/x, x, 0]


10

The Notation package is not necessary to use an infix form of \[Star] as that is handled automatically. Also I recommend PadRight for constructing your expression (reference Generating a matrix using sublists A and B n times). SetAttributes[Star, HoldFirst] Star[a_List, n_Integer] := PadRight[a, n*Length@a, a] {1, 2}⋆5 (* ⋆ is \[Star] *) {1, 2, 1, ...


10

I don't like the idea of redefining Or (||). Rather, I would suggest defining a function with the name DoubleVerticalBar. There is a special double vertical bar character which will be interpreted as the infix operator for DoubleVerticalBar and can be input with Esc+Space+|+|+Esc. SetAttributes[ DoubleVerticalBar, {NumericFunction, Orderless, Flat, ...


10

One approach is to the use that Notation Package's AddInputAlias function to setup an alias that will convert Esc 0x Esc to 16^^ when you type it. First load the notation package with Needs["Notation`"] You can then view all the active notation aliases with ActiveInputAliases[] One of these in the list is an input alias to add input alias (addia). ...


9

You can use something like this dx /: MakeBoxes[dx[a_], fmt_] := RowBox[{FractionBox["\[PartialD]", "\[PartialD]x"], MakeBoxes[a, fmt], "=", MakeBoxes[#, fmt] &@D[a, x]}]; dx[Sin[x]] dx[Sin[x]] // TraditionalForm I prefer MakeBoxes but it also can be implemented with Format ClearAll[dx] Format[dx[a_]] := DisplayForm@RowBox[{FractionBox["\...


9

You can also do this: << Notation` Symbolize[ParsedBoxWrapper[SubscriptBox["_", "_"]]] If you want to, you can import the Notation package first, then use the Symbolize function, so you don't have to use the ParsedBoxWrapper function, and just enter _,(ctrl+_),_. What this does, is set a pattern matching a subscripted character as a symbol. ...


9

Just Subscript[\[Delta], m_, n_] := KroneckerDelta[n, m] or am I missing something?


9

Maybe this? OverDot[f_, n_Integer] := Derivative[n][f] It really only works for . and \[DoubleDot]. To keep the output from displaying as y'[x], etc., you could define MakeBoxes[Derivative[n_Integer][f_], form_] /; 1 <= n <= 2 := ToBoxes[HoldForm[OverDot[f, n]], form]


9

The most robust way I know of would be to use the built in Notation package and write something like Needs["Notation´"] Symbolize[H±] (* Be careful to use the Writing Assistant palette or other formatting guides s.t. the definition actually displays like you want it to and not Subscript or similar means *) H±[x_, y_] := f[x] ± g[y] (* Same caveat about ...


9

For Plus, there's this, from How would I add together any list of arguments as a pure function?: +Sequence[1, 2, 3] (* 6 *)


9

To avoid any conflict with the built-in symbol for \[Element], I would use the small element symbol, ∊ instead (this is a different unicode character from ∈). Here is a way to define its use as an infix operator by way of a template: ClearAll[myMemberQ] appearanceIn[x_, y_] := TemplateBox[{x, y}, "myMemberQ", DisplayFunction :> (RowBox[{#1, "∊", #2}]...


9

Point of conversion A large and perhaps key difference is that MakeBoxes (foo) only transforms the expression into the expanded form when it is converted to Box form. It's FullForm remains unchanged. foo[1, 0.3] // InputForm foo[1, 0.3`] This means that you can operate upon the expression in every standard way without thought to a hidden internal format....


Only top voted, non community-wiki answers of a minimum length are eligible