Research: Numerical Problems
The coding I do in my research is relatively simple. I just solve some integrals that can’t be done analytically. Simple, right? You’d think, so, but I’m running into a classic problem, dividing by zero:
There’s bizarre stuff going on in the left side of the graph and there’s two divergent features at x=-0.2 and 0.4. It’s very simple why that’s happening. The denominator is going to zero at those parts. Here’s a graph of the denominator
The problem is, I don’t know how to circumvent this problem. That’s what the equation does, so… what do I do? Clearly I need to do some clever mathematical trick, perhaps express the quantity in another form without the singularity, I don’t know. It’s frustrating though.
As I look at what the numerator is doing I’m encouraged. Take a look
Notice that the numerator is zero at all the places (and more) where the denominator is zero: x= -1 to -0.8, x=-0.4 and x=0.2. This suggests that I’m not making some obvious mistake in my physics. If I had a fully analytic solution to these integrals then I imagine the divergences would go away, I think. While this observation makes me feel better, I’m still stuck. My best guess is that since both the numerator and denominator go to zero at those points, the overall function should probably go to zero, much like the function:
Both the numerator and denominator go to zero, but if you do you algebra correctly (or just take the limit as x approaches 1) the function goes to zero at the point where the denominator blows up (x = 1)
[Embarrassed clearing of throat] I found the solution, it was a missing minus sign.