## digitalmars.D.learn - Why 2 ^^ 1 ^^ 2 = 2?

• Ilya Yaroshenko (1/1) Oct 22 2017 .. i thought it should be (2 ^^ 1) ^^ 2 = 4
• Timon Gehr (4/5) Oct 22 2017 2 ^^ (1 ^^ 2) == 2
• kinbelle (2/7) Oct 22 2017 true
• Ivan Kazmenko (14/19) Oct 22 2017 Yeah, and a height-3 tower $a^{b^c}$ (TEX notation) actually
• Kagamin (4/7) Oct 26 2017 Because you have explicit braces there.
• Kagamin (3/4) Oct 26 2017 Is $a^{b^c}$ the same as ${a^b}^c$ ? They are drawn slightly
• Ivan Kazmenko (11/15) Oct 27 2017 Surely not the same.
• Q. Schroll (2/6) Nov 01 2017 On my TeX compiler, $3^3^3$ makes it give a warning/error.
• Igor Shirkalin (3/4) Nov 01 2017 Imagine 2^^10^^10^^7. It's a big number, isn't? (up-up-and up)
.. i thought it should be (2 ^^ 1) ^^ 2 = 4

Oct 22 2017
On 22.10.2017 16:20, Ilya Yaroshenko wrote:
.. i thought it should be (2 ^^ 1) ^^ 2 = 4

2 ^^ (1 ^^ 2) == 2

It is standard for ^/**/^^ to be right-associative. (This is also the
standard convention in mathematics.)

Oct 22 2017
On Sunday, 22 October 2017 at 14:44:04 UTC, Timon Gehr wrote:
On 22.10.2017 16:20, Ilya Yaroshenko wrote:
.. i thought it should be (2 ^^ 1) ^^ 2 = 4

2 ^^ (1 ^^ 2) == 2

It is standard for ^/**/^^ to be right-associative. (This is
also the standard convention in mathematics.)

true

Oct 22 2017
On Sunday, 22 October 2017 at 14:44:04 UTC, Timon Gehr wrote:
On 22.10.2017 16:20, Ilya Yaroshenko wrote:
.. i thought it should be (2 ^^ 1) ^^ 2 = 4

2 ^^ (1 ^^ 2) == 2

It is standard for ^/**/^^ to be right-associative. (This is
also the standard convention in mathematics.)

Yeah, and a height-3 tower $a^{b^c}$ (TEX notation) actually
means "a to the power of (b to the power of c)", not the other
way around.  Otherwise, it can be written as $a^{b \cdot c}$,
which is only a height-2 tower.

The convention also makes at least the following sense.  An
expression like
(((a ^^ b) ^^ c) ^^ d) ^^ e
already has an almost bracket-free notation as
a ^^ (b * c * d * e).
So it is useful to have a bracket-free way to write the
other-way-associative variant,
a ^^ (b ^^ (c ^^ (d ^^ e))).

Ivan Kazmenko.

Oct 22 2017
On Sunday, 22 October 2017 at 22:28:48 UTC, Ivan Kazmenko wrote:
Yeah, and a height-3 tower $a^{b^c}$ (TEX notation) actually
means "a to the power of (b to the power of c)", not the other
way around.

Because you have explicit braces there.

Math doesn't have precedence for exponentiation operator because
it's written as a superscript, which is always unambiguous.

Oct 26 2017
On Sunday, 22 October 2017 at 22:28:48 UTC, Ivan Kazmenko wrote:
Yeah, and a height-3 tower $a^{b^c}$ (TEX notation)

Is $a^{b^c}$ the same as ${a^b}^c$ ? They are drawn slightly
differently, so I suppose it's ambiguous indeed.

Oct 26 2017
On Thursday, 26 October 2017 at 10:02:54 UTC, Kagamin wrote:
On Sunday, 22 October 2017 at 22:28:48 UTC, Ivan Kazmenko wrote:
Yeah, and a height-3 tower $a^{b^c}$ (TEX notation)

Is $a^{b^c}$ the same as ${a^b}^c$ ? They are drawn slightly
differently, so I suppose it's ambiguous indeed.

Surely not the same.

"3 to the power of (3 to the power of 3)" is "3 to the power of
27", or 7,625,597,484,987.
"(3 to the power of 3) to the power of 3" is "27 to the power of
3", or 2187.

For an argument, the TEX command "^" accepts either a single
character or a bracket-enclosed string of arbitrary length.  So
$3^3^3$ indeed transforms to ${3^3}^3$, but not for some deeper
reason this time.

Ivan Kazmenko.

Oct 27 2017
On Saturday, 28 October 2017 at 00:14:15 UTC, Ivan Kazmenko wrote:
For an argument, the TEX command "^" accepts either a single
character or a bracket-enclosed string of arbitrary length.  So
$3^3^3$ indeed transforms to ${3^3}^3$, but not for some deeper
reason this time.

On my TeX compiler, $3^3^3$ makes it give a warning/error.

Nov 01 2017    Igor Shirkalin <mathsoft inbox.ru> writes:
On Sunday, 22 October 2017 at 14:20:20 UTC, Ilya Yaroshenko wrote:
.. i thought it should be (2 ^^ 1) ^^ 2 = 4

Imagine 2^^10^^10^^7. It's a big number, isn't? (up-up-and up)
Where would you start from?

Nov 01 2017