In exp(1)^n, the ^ (%power) operator examines the base and expt to
do certain transformation, for example exp(1)^n => exp(n).
It does not do such transformation for integer (to prevent messing
up kernel for other functions, e.g. limit):
exp(1)^3 =!> exp(3)
(3) -> mainKernel exp 3
3
(3) %e
(4) -> mainKernel ((exp 1)^3)
(4) %e
(5) -> exp(3)-(exp 1)^3
3 3
(5) %e - %e
On 12/28/23 05:48, Ralf Hemmecke wrote:
I propose that exp(1)^3 should be displayed with parenthesis around %e.
I oppose. Even though you would make %e^3 distinguishable from exp(3) or
exp(1)^3, I oppose against adding parentheses where none are needed.
Parentheses should be added by the formatting routine and (if possible)
not be stored in the OutputForm datastructure itself.
Let me be clear: a normal %e will be printed without parentheses,
only when printing under a power, there are parentheses.
- Qian
One approach will be changing
exp(1)::OUTFORM from %e to (EXP 1)
exp(n)::OUTFORM from (^ %e n) to (EXP n)
I would actually not really be against showing exp(n) as "exp(n)" in the
output. But as Waldek said %e and exp(1) are only two different
representations of the same thing.
And we also have this...
%%% (14) -> operator first kernels (%e^n)
(14) exp
Type: BasicOperator
%%% (15) -> argument first kernels (%e^n)
(15) [n]
Type: List(Expression(Integer))
%%% (16) -> argument first kernels (exp n)
(16) [n]
Type: List(Expression(Integer))
%%% (17) -> operator first kernels (exp n)
(17) exp
Type: BasicOperator
%%% (20) -> kernels (exp(1)^n)
n
(20) [%e ]
Type: List(Kernel(Expression(Integer)))
%%% (21) -> kernels (exp(n))
n
(21) [%e ]
Type: List(Kernel(Expression(Integer)))
Do you see exp(1)^3 and exp(3) treated differently somewhere? Or even
stored differently?
Ralf
--
You received this message because you are subscribed to the Google Groups "FriCAS -
computer algebra system" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to fricas-devel+unsubscr...@googlegroups.com.
To view this discussion on the web visit
https://groups.google.com/d/msgid/fricas-devel/ebc6ee97-1505-4be5-ab5d-c8ac2b353a07%40gmail.com.