Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie
Hi there,
There is an issue with role permissions that is being worked on at the moment.
If you are having trouble with access or permissions on regional forums please post here to get access: https://www.boards.ie/discussion/2058365403/you-do-not-have-permission-for-that#latest

Double Integral of an Absolute Value Function

  • 21-07-2011 10:09am
    #1
    Registered Users, Registered Users 2 Posts: 550 ✭✭✭


    I'm just wondering if it's possible to get the double integral of an absolute value function.
    Something like : \int \int abs(x-y)dxdy

    If it was \int abs(x-4) dx with limits from - infinity to + infinity then I know you would basically split it up into 2 separate equations:
    \int (x-4) dx limits from 4 to + infinity and \int -(x-4) dx limits for - infinity to 4

    But when you change the constant (in this case 4) for a variable (y) I've no idea what to do.

    Anyone able to help?


Comments

  • Moderators, Science, Health & Environment Moderators Posts: 1,852 Mod ✭✭✭✭Michael Collins


    Hey Teg Veece.

    Your approach to the simplier integrals with the constant, e.g.

    [latex] \displaystyle \int |x-4| \;\hbox{d}x [/latex]

    extends to this case too, although it is a bit more complicated.

    First you'll have to find the area of the xy plane where the integrand, without the absoulte value, is positive, i.e.

    [latex] \displaystyle (x-y)>0 [/latex].

    Then you integrate your function (without the absolute value) on this space. Then you repeat for the case where the function is negative, you'll get a negative area but just take the positive value and add it too the previous result*. This is exactly the same as you have said in your post for the simplier kind involving a constant.

    So have a go at this:

    1. Find the region of the xy where the function x - y is positive.
    2. Integrate the function on this space (for this you'll need to know how to integration over non-rectangular spaces - if you have trouble here, just post back with your answer to the first part and we'll take it from there).

    *In this case since your integrand is even about a line in the xy plane (what line?), you can just get the first result and double it.


  • Registered Users, Registered Users 2 Posts: 550 ✭✭✭Teg Veece


    Thanks, Michael.

    Let me have a think about the problem again with this new info and I'll see what I can come up with.

    How did you post equations like that?


  • Moderators, Science, Health & Environment Moderators Posts: 1,852 Mod ✭✭✭✭Michael Collins


    No problem.

    To make those equations you have to know a bit of LaTeX .

    To display this [latex] \int_{0}^{1} x^{2} \; dx [/latex] you'd write

    [PHP][latex] \int_{0}^{1} x^{2} \; dx [/latex][/PHP]

    where

    1. the [latex ] and [/latex ] commands start and end the LaTeX environment, you put your maths inside of these.
    2. \int makes the integral sign
    3. _{something} puts that something on the bottom of the integral (this can be used to subscript variables too e.g. x_{something} gives [latex] x_{something} [/latex]
    4. Similarly ^{something} puts "something" on the top of the integral sign or variable
    5. x^{2} is an example of this last point
    6. \; adds a small space at the end of the integrand before the "dx" bit.

    if you want a large equation, like the ones in my previous post include this:

    \displaystyle

    after the first [latex ] command.

    There's a huge amount of stuff on LaTeX out there, see:

    http://www.latex-project.org/

    and a boards.ie thread with more info

    http://www.boards.ie/vbulletin/showthread.php?t=2055679780


  • Registered Users, Registered Users 2 Posts: 550 ✭✭✭Teg Veece


    Right, well I've had a think about the problem a bit more and I understand what you said about identifying where the function inside the absolute value bars becomes negative and then use non-rectangular integrals if necessary. It makes perfect sense.

    I'm struggling though trying to apply it to my equation. Maybe it can't be done.

    So I have a function that takes 2 locations as an input and returns a scalar value that relates the two inputs. What I want to do is change the function so that instead of taking in two points, it takes in two line segments and returns the path integral along those segments.

    An example of the equation is:

    [latex] f(x_1,x_2) = sin(d) [/latex]

    [latex] d = |x_1 - x_2| [/latex]

    So d is the distance between the locations x1 and x2.

    Basically I'm trying to evaluate:
    [latex] \int \int sin(|x_1 - x_2|) dx_1dx_2[/latex] and the limits are the start and ending points of the line segments.

    The inputs are 2D locations (ie x_1 has 2 components). I've solved this before by using a quadrature but I was hoping that there might be an analytical solution.
    Is there?


  • Registered Users, Registered Users 2 Posts: 550 ✭✭✭Teg Veece


    I think I've worked out how to get the 2D data into the integral (you just express the y component in terms of x using the parameters of the line).

    So if the two line segments have equations:
    [latex]y_1=m_1x_1+c_1[/latex]
    [latex]y_2=m_2x_2+c_2[/latex]

    then I think the integral formula becomes something like:

    [latex]\int \int sin(\sqrt [(x_1-x_2)^2+(m_1x_1+c_1 - (m_2x_2+c_2))^2]) \; dx_1 \; dx_2[/latex]

    Unfortunately, this looks intractable. Have I hit a dead end or is there a different way of approaching the problem?


  • Advertisement
Advertisement