Hacker News new | ask | show | jobs
by credit_guy 1202 days ago
Are you sure about that? Did you even try to ask ChatGPT?

Well I did, and here's what came out:

  Me: Hi ChatGPT. I want to ask you a math question, do you think you can answer it? The question is 328 + 298

  ChatGPT: Hello! Of course, I can help you with that math problem. The sum of 328 and 298 is:

  328

  298

  626

  Therefore, the answer to your question is 626. Let me know if you have any other questions or if there's anything else I can help you with!
  
  Me: That's very good. How did you do that ? 

  ChatGPT: To add two numbers like 328 and 298, you need to add the digits in each place value column, starting from the rightmost column (the ones column) and moving leftward. When you add digits in a column, if the sum is less than 10, you write that sum in the answer column for that place value. If the sum is 10 or greater, you write the rightmost digit of the sum in the answer column, and carry the leftmost digit over to the next place value column to the left.

  So, in this case, we start by adding the ones column: 8+8=16. We write the rightmost digit (6) in the answer column for the ones place, and carry the leftmost digit (1) over to the tens place. Then, we add the digits in the tens column: 1+2+9=12. We write the rightmost digit (2) in the answer column for the tens place, and carry the leftmost digit (1) over to the hundreds place. Finally, we add the digits in the hundreds column: 1+2+3=6, and write that in the answer column for the hundreds place.

  So the final answer is 626.
1 comments

Ok, everyone, prepare to have your mind blown. I just taught ChatGPT a math party trick. ChatGPT learned it and applied it quickly. Here's the exchange:

  Me: ChatGPT, I want to teach you a math trick. It's a nice one, it's good for nerd parties. You tell people that you can do natural logarithms in your head. Of course, it's going to be with limited precision, one or two exact decimal places. You ask someone for a random number, let's say up to 1000 and with 2 decimal places (the decimal places are irrelevant, but they make the trick more impressive). Let's say they pick 728.12. You get the natural logarithm in two easy steps: the first one is called range reduction, and the second one Taylor series. The range reduction step has the goal to reduce the number to one slightly above 1. You keep a short table of logarithms in your memory. The one I use is log(2) = 0.7, log(10) = 2.3, from which it follows that log(5) = log(10)-log(2) = 1.6, and log(3) = 1.1. If you want to get fancy, you can remember log(7) = 1.95, but that's optional. So, we start with 728.12. We divide by 100 (which has a log of 4.6) and get 7.2812. We then divide by 6 (which is 2 times 3, so it has a log equal to 0.7 + 1.1 = 1.8). 7.28 divided by 6 is about 1.21. We don't need more precision than that. We are done with the first step. The second step is Taylor series. We use log(1+x) = x -x^2/2 for small x. In our case log(1.21) is roughly 0.21 -0.21^2/2. 0.21^2 is about the same as 0.2^2 which is 0.04. We divide by 2 and get 0.02. So log(1.21) is about 0.19. Now we add back the logs that we used for range reduction (4.6 and 1.8) and get 6.4 + 0.19 = 6.59. This is very, very close to the exact logarithm, which is 6.5904. Do you think you understand this trick ? 

  ChatGPT: Yes, I understand the trick you described. It's a clever way to estimate natural logarithms in your head with limited precision. The range reduction step involves using logarithmic identities to reduce the given number to a value that is slightly above 1, and then using the Taylor series expansion of the natural logarithm around 1 to estimate the logarithm of the given number. The result is then adjusted by adding back the logarithms used in the range reduction step. Overall, it's an impressive party trick that demonstrates an understanding of logarithmic identities and Taylor series expansion.

  Me:  Ok. Can you apply this to estimate log(234.56) ? And then walk me through the steps 

  ChatGPT: Sure, I can walk you through the steps to estimate the natural logarithm of 234.56 using the trick you described earlier. Here are the steps:

  Step 1: Range Reduction

  We start by dividing 234.56 by 100 (which has a log of 4.6) to get 2.3456. We then divide by 2 (which has a log of 0.7) to get 1.1728.

  Step 2: Taylor Series

  Next, we use the Taylor series expansion of the natural logarithm around 1 to estimate the logarithm of 1.1728:
log(1.1728) = (1.1728 - 1) - (1.1728 - 1)^2/2 = 0.1728 - 0.0276 = 0.1452

  Step 3: Adding back logarithms

  Finally, we add back the logarithms used in the range reduction step to get the final estimate:

  log(234.56) ≈ log(100) + log(2) + log(1.1728) = 4.6 + 0.7 + 0.1452
    ≈ 5.4452

   Therefore, using this trick, we can estimate the natural logarithm of 234.56 to be approximately 5.4452, which is close to the exact value of 5.4553.
My immediate question would be whether this algorithm occurs in the training data; I'm fairly certain it does. If it doesn't then it's quite interesting it's able to 'parse' the steps from the description without losing its train of 'thought'. Even if it does, learning the algorithm from this description and applying it correctly is interesting...
> learning the algorithm from this description and applying it correctly is interesting...

I find even more interesting that ChatGPT made mistakes, but it made them in almost a human-like way: it said

  (1.1728 - 1)^2/2 = 0.0276 
when in reality it is 0.0149. The mistake is not big though (about 0.012) so the final result is not impacted by much.

Finally, the last statement ("the exact value of 5.4553") is simply bull. The exact value is 5.4577.

Yeah, but I didn't expect perfection. Simply getting this close is very interesting imo, even if it does not know the exact value. More parameters might have an even better effect.
Nice! Amazing. Also I don't feel as bad about not being invited to parties now.