Larger stack size - Printable Version +- HP Forums (https://www.hpmuseum.org/forum) +-- Forum: HP Calculators (and very old HP Computers) (/forum-3.html) +--- Forum: General Forum (/forum-4.html) +--- Thread: Larger stack size (/thread-16086.html) Pages: 1 2 RE: Larger stack size - Mike (Austria) - 12-29-2020 06:18 PM In conventional math notation, serial exponentiation is right-associative: https://en.wikipedia.org/wiki/Order_of_operations#Serial_exponentiation Best! Mike RE: Larger stack size - Albert Chan - 12-29-2020 06:20 PM (12-29-2020 05:56 PM)Allen Wrote:  Symbolically it does. This is exactly the reason exponentiation is evaluated from right to left. (had it been from left to right, we could have rewritten as products of exponents) lua> pow(2, pow(1.8, pow(1.6, pow(1.4, 1.2)))) 9.72086810644022 lua> 2 ^ 1.8 ^ 1.6 ^ 1.4 ^ 1.2 9.72086810644022 RE: Larger stack size - Massimo Gnerucci - 12-29-2020 06:23 PM It is 2^(x^(y^(z^t))), not 2^(x y z t) RE: Larger stack size - Dave Britten - 12-29-2020 06:26 PM (12-29-2020 05:56 PM)Allen Wrote:   (12-29-2020 04:59 PM)Valentin Albillo Wrote:  Wrong. Yout code above does not compute correctly that tower of exponentials. V. Symbolically it does. In python it's off by the trailing digit, but the same could be true of either implementation on different calculators with different accuracy. Code: ``` pow(pow(pow(pow(2,1.8),1.6),1.4),1.2) Out[124]: 28.609056210554545 pow(2,1.8*1.6*1.4*1.2) Out[125]: 28.60905621055455``` I would suggest that on a pocket calculator \( 2^{1.8*1.6*1.4*1.2} \) is the better approach since there is only 1 opportunity to cascade floating point errors, rather than the nested exponential which propagates any round-off error from the first EXP several times before arriving at the final result. I think there's some disagreement over the associativity of exponentiation. The 65 Notes article suggests it's right associative - i.e. 2^1.8^1.6^1.4^1.2 = 2^(1.8^(1.6^(1.4^1.2))) - which the 35's x^y is particularly well suited to handle. That is, of course, most definitely not equal to 2^(1.8*1.6*1.4*1.2). If we assume the exponents are left-associative, then you are correct. It seems like TI treats it as left-associative (28.6) according to my 58C, 85, and 84 Plus, and Casio changed from left-associative to right-associative (9.72) at some point: my fx-7000G is left-associative, and the fx-5800P and fx-991EX both display the operator as ^( in line I/O mode, clearly showing the right associativity. RE: Larger stack size - Massimo Gnerucci - 12-29-2020 06:29 PM (12-29-2020 06:26 PM)Dave Britten Wrote:  I think there's some disagreement over the associativity of exponentiation. Mathematically none that I know of. RE: Larger stack size - Dave Britten - 12-29-2020 06:31 PM (12-29-2020 06:29 PM)Massimo Gnerucci Wrote:   (12-29-2020 06:26 PM)Dave Britten Wrote:  I think there's some disagreement over the associativity of exponentiation. Mathematically none that I know of. Between calculator models, there certainly seems to be. The TI 84 Plus is worse than I thought: it's left-associative in classic mode, and right-associative in Math Print mode. The exact same key sequence will give you a different result depending on which of the two display modes you're in! I think Casio has the right idea of making it clearly right-associative, with a forced ( in line-I/O mode. RE: Larger stack size - Valentin Albillo - 12-29-2020 09:07 PM (12-29-2020 05:56 PM)Allen Wrote:   (12-29-2020 04:59 PM)Valentin Albillo Wrote:  \( 2^{1.8^{1.6^{1.4^{1.2}}}} \) Wrong. Yout code above does not compute correctly that tower of exponentials. V. Symbolically it does. Nope. Written as you posted, it's evaluated from right to left, i.e.: you first evaluate 1.4^1.2, then 1.6 raised to the last result, then 1.8 raised to the last result, then 2 raised to the last result. That final result is 9.720868106440216192155483936635... V. RE: Larger stack size - robve - 12-29-2020 10:10 PM (12-29-2020 09:07 PM)Valentin Albillo Wrote:   (12-29-2020 05:56 PM)Allen Wrote:  Symbolically it does. Nope. Written as you posted, it's evaluated from right to left, i.e.: you first evaluate 1.4^1.2, then 1.6 raised to the last result, then 1.8 raised to the last result, then 2 raised to the last result. That final result is 9.720868106440216192155483936635... V. Since the dawn of computing it's been "top down" or right associative. Otherwise it is a bug. However, mathematicians like Neil Sloane take a much more creative look at this problem with "Dungeon Numbers - Numberphile" giving "top down" an entirely different meaning https://www.youtube.com/watch?v=xNx3JxRhnZE One of my favorite videos. RE: Larger stack size - ijabbott - 12-30-2020 01:49 PM (12-29-2020 06:31 PM)Dave Britten Wrote:   (12-29-2020 06:29 PM)Massimo Gnerucci Wrote:  Mathematically none that I know of. Between calculator models, there certainly seems to be. The TI 84 Plus is worse than I thought: it's left-associative in classic mode, and right-associative in Math Print mode. The exact same key sequence will give you a different result depending on which of the two display modes you're in! I think Casio has the right idea of making it clearly right-associative, with a forced ( in line-I/O mode. The Casio solution is a good technique. For the TI, you can understand why they would have made it left-associative in classic mode for consistency with other binary operators, and perhaps for consistency with earlier AOS models. Back to HP Land, the HP-27S also has a left-associative exponentiation operator, but it displays partially evaluated results as it goes, so that [3] [x^y] [3] [x^y] [3] is finally displayed as 27^3. RE: Larger stack size - Dave Britten - 12-30-2020 02:11 PM (12-30-2020 01:49 PM)ijabbott Wrote:   (12-29-2020 06:31 PM)Dave Britten Wrote:  Between calculator models, there certainly seems to be. The TI 84 Plus is worse than I thought: it's left-associative in classic mode, and right-associative in Math Print mode. The exact same key sequence will give you a different result depending on which of the two display modes you're in! I think Casio has the right idea of making it clearly right-associative, with a forced ( in line-I/O mode. The Casio solution is a good technique. For the TI, you can understand why they would have made it left-associative in classic mode for consistency with other binary operators, and perhaps for consistency with earlier AOS models. Back to HP Land, the HP-27S also has a left-associative exponentiation operator, but it displays partially evaluated results as it goes, so that [3] [x^y] [3] [x^y] [3] is finally displayed as 27^3. Interestingly, the fx-CG500 (the calculator formerly known as ClassPad) will display the entry as 3^3^3 without any parentheses, but still evaluates it as right-associative (i.e. 7.63E12 rather than 19683). The fx-991MS 2nd Edition also does not include parentheses, but evaluates this as left-associative. The TI Voyage 200 - and presumably 92 and 89 - are right-associative, and will even automatically change your input to 3^(3^3) after entry if pretty print mode is turned off (if it's on you get a tower of superscripts). Very strange to see so much inconsistency on this, even between calculators from a single manufacturer. RE: Larger stack size - robve - 12-30-2020 02:19 PM (12-29-2020 06:31 PM)Dave Britten Wrote:   (12-29-2020 06:29 PM)Massimo Gnerucci Wrote:  Mathematically none that I know of. Between calculator models, there certainly seems to be. The TI 84 Plus is worse than I thought: it's left-associative in classic mode, and right-associative in Math Print mode. The exact same key sequence will give you a different result depending on which of the two display modes you're in! I think Casio has the right idea of making it clearly right-associative, with a forced ( in line-I/O mode. No, no, no! The Ti 84 Plus is not that bad. Let's take a look at Ti BA II Plus Professional. Quoting from the manual: Choosing Calculation Methods When you choose chain (Chn) calculation method, the calculator solves problems in the order that you enter them. (Most financial calculators use Chn.) For example, when you enter 3[+]2[x]4[=], the Chn answer is 20 (3+2=5, 5*4=20). The worst part is that Chn is the default method on all of these calculator models. Their AOS^tm (algebraic operation system) is only optional, and "solves problems according to the standard rules of algebraic hierarchy." Apparently financial calculators only offer one register to calculate with, i.e. a stack of one register (an accumulator). Why bother calculating with a stack of four registers? PS. Funny that they introduce fancy names for standard stuff, like AOS^tm and also APD^tm (automatic power down). I'm sure their marketing department had some say in this crap. - Rob RE: Larger stack size - JSBach - 01-04-2021 12:21 PM Hi, on the HP-28S if I type '3^3^3 [EVAL] I get 19683 Fail :-( JSB RE: Larger stack size - John Keith - 01-04-2021 03:58 PM This appears to have changed at some point, the 50g returns 7625597484987, which is 3^(3^3) as opposed to (3^3)^3.