## 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) = {\mathrm{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 $${\mathrm{sign}}(x)$$ function in step 2 (needed for the $$x\lt 0$$ branch). So, let's inform ChatGPT about this:

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

Doing the inverse by hand yields: $f^{-1}(x) = {\mathrm{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 $$e^x-1$$.

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 $$x\ge 0$$ and $$g \lt 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: $f^{-1}(y) = \begin{cases}e^y-1 & \text{if y>0} \\ 1-e^{-y} & \text{if y<0} \\ 0 & \text{if y=0} \end{cases}$

### Conclusion

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