Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Linear first order differential equation with unknown function

  1. Sep 5, 2014 #1
    I was wondering if there is a way to get specific numerical values for the following differential equation:

    [tex]f'(x)+ \frac{1}{x-20}\cdot f(x)=\frac{1}{x-20}\cdot g(x)[/tex]

    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. jcsd
  3. Sep 5, 2014 #2


    User Avatar
    Science Advisor

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

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

    Clearly, that requires that [itex]u'= \frac{u}{x- 20}[/itex]
    [tex]\frac{du}{u}= \frac{dx}{x- 20}[/tex]
    [tex]ln(u)= ln(x- 20)+ C[/tex]
    [tex]u= c(x- 20)[/tex]

    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
    [tex]((x- 20)f)'= g(x)[/tex]

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

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

    Use the values for g(x) that you are given to do a numerical integral.
  4. Sep 6, 2014 #3
    Thanks, I'll give that a try
  5. Sep 6, 2014 #4
    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 [itex]g(x_0), g(x_1) ... g(x_n)[/itex] and I would like good approximations for [itex]f(x_0), f(x_1) ... f(x_n)[/itex], 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}
  6. Sep 6, 2014 #5


    User Avatar
    Homework Helper

    The lower limit corresponds to the arbitrary constant of integration.

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

    EDIT: If you take [itex]x_0 = 20[/itex] then you must take [itex]f(20) = g(20)[/itex] to avoid a singularity.
  7. Sep 6, 2014 #6
    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
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook

Similar Discussions: Linear first order differential equation with unknown function