Skip to main content
added 626 characters in body
Source Link
halirutan
  • 113.4k
  • 7
  • 266
  • 479

As Nasser already pointed out that exponential expressions are converted into powers. You can find the corresponding documentation in the Possible Issues section of Exp

When you know this, than you can circumvent the issue by holding your expression and replacing all exponential powers to Exp[..] again. Therefore, a simple solution is

FormatExp[expr_] := HoldForm[expr] /. HoldPattern[Power[E, arg_]] :> Exp[arg]

and then you go

FormatExp[Series[(1 + z/n)^n, {n, Infinity, 2}]]

Mathematica graphics

The good thing is that the displayed expressions are still functional because there is only a HoldForm wrapped around which prevents evaluation. Therefore, if you wanted to use such a displayed result, you can use ReleaseHold

Normal[ReleaseHold[%]]

There is another alternative. I wasn't sure whether to show it but let's give it a try. As you might know we have Format which can be used to set formatting rules to symbols. The problem here is, that we need to assign a special formatting rule to Power which is a protected built-in symbol. Therefore, use it with caution as I can not predict whether this breaks something.

Unprotect[Power];
Format[HoldPattern[Power[E, arg_]]] := DisplayForm[RowBox[{"Exp", "[", arg, "]"}]];
Protect[Power];

Now, every Exp is displayed per default as Exp[..] and everything should work as expected.

As Nasser already pointed out that exponential expressions are converted into powers. You can find the corresponding documentation in the Possible Issues section of Exp

When you know this, than you can circumvent the issue by holding your expression and replacing all exponential powers to Exp[..] again. Therefore, a simple solution is

FormatExp[expr_] := HoldForm[expr] /. HoldPattern[Power[E, arg_]] :> Exp[arg]

and then you go

FormatExp[Series[(1 + z/n)^n, {n, Infinity, 2}]]

Mathematica graphics

The good thing is that the displayed expressions are still functional because there is only a HoldForm wrapped around which prevents evaluation. Therefore, if you wanted to use such a displayed result, you can use ReleaseHold

Normal[ReleaseHold[%]]

As Nasser already pointed out that exponential expressions are converted into powers. You can find the corresponding documentation in the Possible Issues section of Exp

When you know this, than you can circumvent the issue by holding your expression and replacing all exponential powers to Exp[..] again. Therefore, a simple solution is

FormatExp[expr_] := HoldForm[expr] /. HoldPattern[Power[E, arg_]] :> Exp[arg]

and then you go

FormatExp[Series[(1 + z/n)^n, {n, Infinity, 2}]]

Mathematica graphics

The good thing is that the displayed expressions are still functional because there is only a HoldForm wrapped around which prevents evaluation. Therefore, if you wanted to use such a displayed result, you can use ReleaseHold

Normal[ReleaseHold[%]]

There is another alternative. I wasn't sure whether to show it but let's give it a try. As you might know we have Format which can be used to set formatting rules to symbols. The problem here is, that we need to assign a special formatting rule to Power which is a protected built-in symbol. Therefore, use it with caution as I can not predict whether this breaks something.

Unprotect[Power];
Format[HoldPattern[Power[E, arg_]]] := DisplayForm[RowBox[{"Exp", "[", arg, "]"}]];
Protect[Power];

Now, every Exp is displayed per default as Exp[..] and everything should work as expected.

Source Link
halirutan
  • 113.4k
  • 7
  • 266
  • 479

As Nasser already pointed out that exponential expressions are converted into powers. You can find the corresponding documentation in the Possible Issues section of Exp

When you know this, than you can circumvent the issue by holding your expression and replacing all exponential powers to Exp[..] again. Therefore, a simple solution is

FormatExp[expr_] := HoldForm[expr] /. HoldPattern[Power[E, arg_]] :> Exp[arg]

and then you go

FormatExp[Series[(1 + z/n)^n, {n, Infinity, 2}]]

Mathematica graphics

The good thing is that the displayed expressions are still functional because there is only a HoldForm wrapped around which prevents evaluation. Therefore, if you wanted to use such a displayed result, you can use ReleaseHold

Normal[ReleaseHold[%]]