I implemented this custom notation...

In[57]:= Notation[ParsedBoxWrapper[
RowBox[{"x_", "↓", "y_"}]] ⟺ 
RowBox[{" ", 
RowBox[{"FunctionExpand", "[", 
RowBox[{"FactorialPower", "[", 
RowBox[{"x_", ",", "y_"}], "]"}], "]"}]}]]]

and works as expected:

In[71]:= x↓2

Out[71]= (-1 + x) x

What I really want is that when I enter x ^ ( 2 ) that this is interpreted as FactorialPower[x,2] meaning that the outer ( and ) make it a FactorialPower instead of a normal power.

Which changes should I implement to achieve this?

  • $\begingroup$ Not sure if it is what you are asking, but ctrl-6 on my mac gives a shortcut to raise something to a power. I have to use the arrow keys to move from that to the "normal" line of the equation. The "6" is the up carrot so if you are using a PC, there is probably an equivalent using the key with the up carrot. $\endgroup$ – Mark R Feb 7 '20 at 23:02
  • $\begingroup$ I have windows, I can do that too with ctr-6. If I create 5^(2) I get 25 instead of 20. $\endgroup$ – nilo de roock Feb 8 '20 at 8:08
  • $\begingroup$ @niloderoock I don’t understand what you’re looking for. It isn’t clear what you’re trying to shortcut to what. Can you provide a little more context, maybe what the definition of this shortcut should be? $\endgroup$ – CA Trevillian Feb 9 '20 at 4:21
  • $\begingroup$ Falling should give 5*4*3=60 rising should give 5*6*7=210 $\endgroup$ – CA Trevillian Feb 9 '20 at 4:30
  • 2
    $\begingroup$ Mma has the function FactorialPower which handles this. I am mainly concerned about the formatting / notation. - I am now investigating the Notation Package but that is not an easy package. $\endgroup$ – nilo de roock Feb 9 '20 at 8:19

Another non-Notation option is to use InputAliases:

CurrentValue[EvaluationNotebook[], {InputAliases, "fp"}] = TemplateBox[
    {"\[SelectionPlaceholder]", "\[Placeholder]"},

Then, typing Esc f p Esc will generate the desired input.

  • $\begingroup$ So Notation is not necessary after all. $\endgroup$ – nilo de roock Feb 11 '20 at 13:25
  • $\begingroup$ At the end of the day I want to be able to switch between normal exponents, falling exponents and rising exponents. To start with, I would like ( in "a falling exponents mode" ), x^2-x to display as x^(2). - Could this be the reason why initially Notation was suggested? I hoped the Notation[ _ <=> _] would be able to do this. $\endgroup$ – nilo de roock Feb 11 '20 at 13:42

This code interprets the superscript (achieved with ctrl+6) as FactorialPower:

MakeExpression[SuperscriptBox[x_, RowBox[{"(", y_, ")"}]], StandardForm] := 
  MakeExpression[RowBox[{FactorialPower, "[", x, ",", y, "]"}], StandardForm]

Then an input of


leads to

  • $\begingroup$ How can I add FunctionExpand after FactorialPower ? I want (x+5)^(3) to evaluate to (x+5)(x+4)(x+3) ; FactorialPower as a name should never appear. $\endgroup$ – nilo de roock Feb 11 '20 at 13:25
  • 1
    $\begingroup$ You can add a layer of RowBox[{FunctionExpand,"["...,"]"}] around the FactorialPower inside MakeExpression. $\endgroup$ – QuantumDot Feb 11 '20 at 16:24
  • $\begingroup$ I found it very hard to choose which answer to accept, sorry. $\endgroup$ – nilo de roock Feb 24 '20 at 8:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.