Linear first order differential equation with unknown function

1. Sep 5, 2014

DMT69

I was wondering if there is a way to get specific numerical values for the following differential equation:

$$f'(x)+ \frac{1}{x-20}\cdot f(x)=\frac{1}{x-20}\cdot g(x)$$

I have numerical values for g(x) for about 10 different x values. I need to find f(x) numerically for those same values.

Is this even possible from this information?

2. Sep 5, 2014

HallsofIvy

The simplest thing to do is to find the "integrating factor".

That is, you want a function u(x) such that
$$\frac{d(uf)}{dx}= uf'+ u'f= uf'+ \frac{u}{x- 20}f$$

Clearly, that requires that $u'= \frac{u}{x- 20}$
$$\frac{du}{u}= \frac{dx}{x- 20}$$
$$ln(u)= ln(x- 20)+ C$$
$$u= c(x- 20)$$

Since we only need one such function, we can take c= 1. The integrating factor is u= x- 20.

Multiplying both sides of the equation by x- 20, we have
$$((x- 20)f)'= g(x)$$

So that $(x- 20)f= \int_a^x g(t)dt$ where the choice of a gives the "constant of integration".

The solution, then, is $f(x)= \frac{1}{x- 20}\int_a^x g(t) dt$

Use the values for g(x) that you are given to do a numerical integral.

3. Sep 6, 2014

DMT69

Thanks, I'll give that a try

4. Sep 6, 2014

DMT69

Okay, I've been reading up on numerical integration, and I have a fair handle on that part. And I am able to follow how you solved the differential equation. But there is one thing that I am still confused about, and this is maybe more a general misunderstanding on my part for differential equation solutions.

It has to do with the lower limit "a" of the integration. How is this chosen appropriately for a practical situation?

Say, for example, I have some values $g(x_0), g(x_1) ... g(x_n)$ and I would like good approximations for $f(x_0), f(x_1) ... f(x_n)$, how would I choose the lower limit of integration in these cases (I assume the upper limit is the value of f(x) I am trying to approximate).

If it helps, I have values for f(20), which is the same as g(20) in all cases. In all cases (I have a bunch of similar cases to calculate) the values I have are for x = {20,50,100,140,200,250,300,350,400,450,500}

5. Sep 6, 2014

pasmith

The lower limit corresponds to the arbitrary constant of integration.

To obtain a unique solution for $f$, you need to specify the value of $f$ at some $x_0$. You then have $$f(x) = \frac{1}{x - 20}\left((x_0 - 20)f(x_0) + \int_{x_0}^x g(t)\,dt\right)$$

EDIT: If you take $x_0 = 20$ then you must take $f(20) = g(20)$ to avoid a singularity.

6. Sep 6, 2014

DMT69

Okay, that was what I was thinking since I do have f(20)=g(20) in all cases. Now if I use, for example, Newton-Cotes to approximate the integral for the different points, it seems that I will have a bad approximation for x=50, with increasingly better ones up to x=500. This seems a little arbitrary to me in some sense (shouldn't it be reversible?). Also, why would it get more accurate the further I get away from my "starting point", even if I have more intermediate values at that point? Or could I oscillate somehow? For example, use all the values to get an approximation for 500, but then taken 500 as my starting point and change the sign in front of the integral to a minus to a good value for 50? Or does that not make work?

Thinking a bit more on this, shouldn't having many points increase the accuracy equally for all the points I have?

Last edited: Sep 6, 2014