Before I started the program, I implemented Bernoulli equations. But the general solution to Bernoulli equations involves raising something to the power of , where n is the power of the dependent term (see the Wikipedia page for more info). This works great, as I soon discovered, unless n == 1. Then you get something to the power of
. So I had to go in and remove the corner case.
So you think that after that I would have been more careful after that about checking that if general solution that divides by something I would test to see if that something is not zero before returning it as a solution.
Well, as I was just trying to implement some separable equation tests, I was going through the exercises of my ode text as I usually do for tests, and I came across . If you recall, this equation also has coefficients that homogeneous of the same order (1). From the general solution to homogeneous coefficients, you would plug it into
where
or
where
(here, P and Q are from the general form
). Well, it turns out that if you plug the coefficients from my example into those equations, the denominator will become 0 for each one. So I (obviously) need to check for that
and
are not 0 before running the homogeneous coefficients solver on a differential equation.