Re: Why 2 ^^ 1 ^^ 2 = 2?

2017-11-01 Thread Igor Shirkalin via Digitalmars-d-learn

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?


Re: Why 2 ^^ 1 ^^ 2 = 2?

2017-11-01 Thread Q. Schroll via Digitalmars-d-learn

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.



Re: Why 2 ^^ 1 ^^ 2 = 2?

2017-10-27 Thread Ivan Kazmenko via Digitalmars-d-learn

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.



Re: Why 2 ^^ 1 ^^ 2 = 2?

2017-10-26 Thread Kagamin via Digitalmars-d-learn

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.


Re: Why 2 ^^ 1 ^^ 2 = 2?

2017-10-26 Thread Kagamin via Digitalmars-d-learn

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.


Re: Why 2 ^^ 1 ^^ 2 = 2?

2017-10-22 Thread Ivan Kazmenko via Digitalmars-d-learn

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.



Re: Why 2 ^^ 1 ^^ 2 = 2?

2017-10-22 Thread kinbelle via Digitalmars-d-learn

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


Re: Why 2 ^^ 1 ^^ 2 = 2?

2017-10-22 Thread Timon Gehr via Digitalmars-d-learn

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.)