Can this function be re-written to eliminate the discontinuity?

I have the function $$f(x) = \frac{\sqrt{x^2 + d^2} - d}{x}$$, and I want to use it in a context that requires $$f(x)$$ to be continuous over the entire domain $$-d < x < d$$. However, because this function divides by $$x$$, when $$x = 0$$ the value of $$f(x)$$ is undefined due to division by zero, causing a discontinuity and breaking my use-case.

Is it possible to re-write this function to remove the discontinuity such that its graph has the same shape everywhere in its domain except for the fact that it is also defined at $$x = 0$$?

I know that the limit of $$f(x)$$ as $$x$$ approaches zero from both the negative and positive directions is zero. However, I cannot use piecewise definitions to simply add an extra definition at a single point; I need one single expression that is continuous over the specified domain.

I also know that the function is very close in shape to $$\frac{2}{π} \arctan\left(\frac{π}{2} \frac{x}{2 d}\right)$$, but unfortunately it isn't exactly the same shape, and I haven't been able to figure out a way to modify the arctan function to fit $$f(x)$$ exactly.

• I don't think there is a nice expression for this that doesn't involve an infinite series. Commented Dec 20, 2023 at 16:46
• I don't understand the constraint---why can't you use piecewise defined functions? Commented Dec 20, 2023 at 16:50
• @XanderHenderson The software functions I'm working with don't support them. Commented Dec 20, 2023 at 17:04
• @Lawton And what software is that? If you are constrained by software, that should be part of the question you are asking. Commented Dec 20, 2023 at 17:05
• @Lawton This seems like an XY Problem to me. You have software which is limiting your ability to do something which is very basic. Rather than asking a direct question about how to get around that software constraint (e.g. on Blender), you have abstracted it to a mathematics question, and provided us with an unmotivated constraint. When you ask a question, you need to provide as much detail as you can, in order to place the question in an understandable context for others. In mathematics, there is no reason to avoid piecewise functions, so the constraint seem unnatural... Commented Dec 20, 2023 at 17:27

The answer is given by the method for computing the limit at $$0$$: $$\frac{\sqrt{x^2+d^2} - d}{x} = \frac{\sqrt{x^2+d^2} - d}{x}\cdot \frac{\sqrt{x^2+d^2}+d}{\sqrt{x^2+d^2}+d} = \frac{x^2}{x}\cdot \frac{1}{\sqrt{x^2+d^2}+d} = \frac{x}{\sqrt{x^2+d^2}+d}.$$