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:

problemThere’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

problem2

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.

UPDATE:

As I look at what the numerator is doing I’m encouraged.  Take a look

problem3

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:

f(x)=\frac{(x-1)^2}{(x-1)}

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)

UPDATE II:

[Embarrassed clearing of throat] I found the solution, it was a missing minus sign.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: