Processing math: 100%

Wednesday, September 27, 2023

Math and ChatGPT

Performing symbolic math steps is often related to pattern recognition. In theory, ChatGPT could be doing a good job here. I wanted to find the inverse of f(x)=sign(x)log(1+|x|) This function is a form of a signed logarithmic scaling. So, let's see what ChatGPT is telling us:



The idea to split this into two branches is excellent. Strictly speaking, we should handle x=0 also in one of the branches, but let's ignore that for now. More worisome, somehow, it looses the sign(x) function in step 2 (needed for the x<0 branch). So, let's inform ChatGPT about this:


It says, "Let's include the sign(x) factor," but then it does not actually do that.

Doing the inverse by hand yields: f1(x)=sign(x)(exp(|x|)1)


Hmm. ChatGPT does not really understand much of my feedback. It is rather polite, but it is just ignoring what I say.

Update 1: Wolfram Alpha


Wolfram Alpha [1] is based on the same symbolic math foundations as Mathematica. I tried the command:

inverse of sign(x)*log(1+|x|)

The response is:




This does not look too good either:
  • The inverse function is incorrect 
  • and the blue line is not the plot of ex1

It is noted that ChatGPT can use Wolfram Alpha [2].

Update 2: Sage


Sage is a well-known open-source symbolic math package. An online version is available [3]. This does not seem to work either:


Sage cannot solve this. I tried doing it for the branches x0 and g<0 separately. That worked fine. The complete function, however, seems out of reach.

Update 3: Google Gemini


Not much better:

Also wrong!! The correct answer is: f1(y)={ey1if y>01eyif y<00if y=0

Conclusion


A pen and a piece of paper is sometimes the most reliable tool to do math.

References

2 comments:

  1. The details... It knows the overall picture, but when it gets to the actual steps it completely messes up. Confidently. Like the student who turns in a very clean-looking work which is utter nonsense. If you just glance at it you may think that the student is good and surely just messed up a sign somewhere. But if you read the work carefully you realize he has no clue.
    I think ChatGPT is useless for mathematics.

    For the record, any decent symbolic math package could do that 30 years ago.

    ReplyDelete
  2. A comment on Wolfram's software: Generally better is to use the "Reduce"-function for such inverses, which should consider all cases. The current version of Wolfram Alpha yields with input "Reduce[ y == Sign[x] Log[1 + Abs[x]], x, Reals ]" indeed only the result you mention above. But Wolfram Mathematica (the non-free software; ver 12.1) yields correctly: (y < 0 && x == 1 - E^-y) || (y == 0 && x == 0) || (y > 0 && x == -1 + E^y).

    ReplyDelete