Page 3 of 4 FirstFirst 1234 LastLast
Results 31 to 45 of 48

Math Help - help in Integral Maximization

  1. #31
    A Plied Mathematician
    Joined
    Jun 2010
    From
    CT, USA
    Posts
    6,318
    Thanks
    4
    Awards
    2
    I don't just tell people my answers. But I'll help you to arrive at it.

    First idea: assume equal intervals. Then the area under the linear pieces \{x_{1},\dots,x_{N}\} paired with \{y_{1},\dots,y_{N}\} is given by the trapezoidal rule

    \int_{x_{1}}^{x_{N}}f(x)\,dx=\frac{x_{N}-x_{1}}{N}(y_{1}+2y_{2}+2y_{3}+\dots+2y_{N-1}+y_{N}).

    In looking at this formula, what values can I swap without changing the sum?
    Follow Math Help Forum on Facebook and Google+

  2. #32
    Member
    Joined
    Jun 2010
    From
    Zewail University - Cairo - Egypt
    Posts
    141
    Quote Originally Posted by Ackbeet View Post
    I don't just tell people my answers. But I'll help you to arrive at it.

    First idea: assume equal intervals. Then the area under the linear pieces \{x_{1},\dots,x_{N}\} paired with \{y_{1},\dots,y_{N}\} is given by the trapezoidal rule

    \int_{x_{1}}^{x_{N}}f(x)\,dx=\frac{x_{N}-x_{1}}{N}(y_{1}+2y_{2}+2y_{3}+\dots+2y_{N-1}+y_{N}).

    In looking at this formula, what values can I swap without changing the sum?
    i can't understand anything from these formula
    Follow Math Help Forum on Facebook and Google+

  3. #33
    A Plied Mathematician
    Joined
    Jun 2010
    From
    CT, USA
    Posts
    6,318
    Thanks
    4
    Awards
    2
    Whoops. I forgot the factor of two. It should be the following:

    \displaystyle{\int_{x_{1}}^{x_{N}}f(x)\,dx=\frac{x  _{N}-x_{1}}{2N}(y_{1}+2y_{2}+2y_{3}+\dots+2y_{N-1}+y_{N})}.

    Here is the explanation of this formula: the LHS is merely a symbol representing, in this case, the area under all the piecewise linear functions (another way to think of it: it's the sum of all the areas of the trapezoids).

    The RHS of this formula shows you how to compute that area. To get this formula, merely note that the width of each trapezoid is equal to the width of the whole interval divided by the number of intervals, which is

    \displaystyle{\frac{x_{N}-x_{1}}{N}}.

    Now, the area of the jth trapezoid is given by (merely translating the formula you gave me):

    \displaystyle{\frac{x_{N}-x_{1}}{N}\left(\frac{y_{j}+y_{j+1}}{2}\right)}.

    You can think of this expression as the width times the average of the heights on the right and left sides of the subinterval. Does this make sense?

    Now, if I add all those areas up, I get this:

    \displaystyle{\frac{x_{N}-x_{1}}{N}\left(\frac{y_{0}+y_{1}}{2}+\frac{y_{1}+y  _{2}}{2}+\dots+\frac{y_{N-1}+y_{N}}{2}\right)}

    \displaystyle{=\frac{x_{N}-x_{1}}{2N}(y_{0}+y_{1}+y_{1}+y_{2}+\dots+y_{N-1}+y_{N})}

    \displaystyle{=\frac{x_{N}-x_{1}}{2N}(y_{0}+2y_{1}+2y_{2}+\dots+2y_{N-1}+y_{N}).}

    All the middle terms are in the sum twice, and the endpoints are there only once.

    Does this make the formula clear to you?
    Follow Math Help Forum on Facebook and Google+

  4. #34
    Member
    Joined
    Jun 2010
    From
    Zewail University - Cairo - Egypt
    Posts
    141
    Quote Originally Posted by Ackbeet View Post
    Whoops. I forgot the factor of two. It should be the following:

    \displaystyle{\int_{x_{1}}^{x_{N}}f(x)\,dx=\frac{x  _{N}-x_{1}}{2N}(y_{1}+2y_{2}+2y_{3}+\dots+2y_{N-1}+y_{N})}.

    Here is the explanation of this formula: the LHS is merely a symbol representing, in this case, the area under all the piecewise linear functions (another way to think of it: it's the sum of all the areas of the trapezoids).

    The RHS of this formula shows you how to compute that area. To get this formula, merely note that the width of each trapezoid is equal to the width of the whole interval divided by the number of intervals, which is

    \displaystyle{\frac{x_{N}-x_{1}}{N}}.

    Now, the area of the jth trapezoid is given by (merely translating the formula you gave me):

    \displaystyle{\frac{x_{N}-x_{1}}{N}\left(\frac{y_{j}+y_{j+1}}{2}\right)}.

    You can think of this expression as the width times the average of the heights on the right and left sides of the subinterval. Does this make sense?

    Now, if I add all those areas up, I get this:

    \displaystyle{\frac{x_{N}-x_{1}}{N}\left(\frac{y_{0}+y_{1}}{2}+\frac{y_{1}+y  _{2}}{2}+\dots+\frac{y_{N-1}+y_{N}}{2}\right)}

    \displaystyle{=\frac{x_{N}-x_{1}}{2N}(y_{0}+y_{1}+y_{1}+y_{2}+\dots+y_{N-1}+y_{N})}

    \displaystyle{=\frac{x_{N}-x_{1}}{2N}(y_{0}+2y_{1}+2y_{2}+\dots+2y_{N-1}+y_{N}).}

    All the middle terms are in the sum twice, and the endpoints are there only once.

    Does this make the formula clear to you?
    but with this formula and the test case :
    4
    2 3 5 6
    1 2 1 2

    = (6-2)/(2*4)*(1+4+2+2)=4.5
    and the correct answer is 7
    Follow Math Help Forum on Facebook and Google+

  5. #35
    A Plied Mathematician
    Joined
    Jun 2010
    From
    CT, USA
    Posts
    6,318
    Thanks
    4
    Awards
    2
    Your test case has non-uniform x-intervals, for which the formula here is invalid. If you have non-uniform x-intervals, then you have to use the more general formula:

    \displaystyle{\int_{a}^{b}f(x)\,dx=\frac{1}{2}\sum  _{j=2}^{N}(x_{j}-x_{j-1})(y_{j}+y_{j-1}).}

    For your test case, this more general formula yields
    \displaystyle{\int_{a}^{b}f(x)\,dx=\frac{1}{2}\lef  t[1\times 3+2\times 3+1\times 3\right]=\frac{1}{2}\,(4\times 3)=6.}

    I don't think the correct answer is 7. Check your work again.

    I think you might find it easier to work with the uniform-interval formula. It certainly provides more ideas readily to my mind.
    Follow Math Help Forum on Facebook and Google+

  6. #36
    Member
    Joined
    Jun 2010
    From
    Zewail University - Cairo - Egypt
    Posts
    141
    Quote Originally Posted by Ackbeet View Post
    Your test case has non-uniform x-intervals, for which the formula here is invalid. If you have non-uniform x-intervals, then you have to use the more general formula:

    \displaystyle{\int_{a}^{b}f(x)\,dx=\frac{1}{2}\sum  _{j=2}^{N}(x_{j}-x_{j-1})(y_{j}+y_{j-1}).}

    For your test case, this more general formula yields
    \displaystyle{\int_{a}^{b}f(x)\,dx=\frac{1}{2}\lef  t[1\times 3+2\times 3+1\times 3\right]=\frac{1}{2}\,(4\times 3)=6.}

    I don't think the correct answer is 7. Check your work again.

    I think you might find it easier to work with the uniform-interval formula. It certainly provides more ideas readily to my mind.
    thx i will try now but the correct answer is really 7 see problem link thx ackbeet >>
    Follow Math Help Forum on Facebook and Google+

  7. #37
    A Plied Mathematician
    Joined
    Jun 2010
    From
    CT, USA
    Posts
    6,318
    Thanks
    4
    Awards
    2
    Where do you get 7? I quote from the link:

    ...the integral of the polygonal line is the shaded area, with a value of 6.
    Follow Math Help Forum on Facebook and Google+

  8. #38
    Member
    Joined
    Jun 2010
    From
    Zewail University - Cairo - Egypt
    Posts
    141
    Quote Originally Posted by Ackbeet View Post
    Where do you get 7? I quote from the link:
    here in the second test case
    https://www.spoj.pl/problems/INTEGMAX/
    Follow Math Help Forum on Facebook and Google+

  9. #39
    A Plied Mathematician
    Joined
    Jun 2010
    From
    CT, USA
    Posts
    6,318
    Thanks
    4
    Awards
    2
    Ah, I see it now. Well, the author is contradicting himself there. The picture at the beginning of that file is precisely the same test case as the one where, later, he says the area is 7. The 7 is a typo. Trust me, the answer is 6. The author was correct the first time.
    Follow Math Help Forum on Facebook and Google+

  10. #40
    Member
    Joined
    Jun 2010
    From
    Zewail University - Cairo - Egypt
    Posts
    141
    Quote Originally Posted by Ackbeet View Post
    Ah, I see it now. Well, the author is contradicting himself there. The picture at the beginning of that file is precisely the same test case as the one where, later, he says the area is 7. The 7 is a typo. Trust me, the answer is 6. The author was correct the first time.
    i know that sokution of picture is 6
    but when you change Y,s to this range
    1,2,2,1
    the answer will be seven
    some one give me hint
    he told me about trapiziums , and said that each height will be x2-x1 and so on but he left for me to choose Y,s
    and his solution accepted???
    Follow Math Help Forum on Facebook and Google+

  11. #41
    Member
    Joined
    Jun 2010
    From
    Zewail University - Cairo - Egypt
    Posts
    141
    i found a solution
    i should sort Y values
    then i should take height as follows
    h[0]=x[1]-x[0] , h[n]=h[n]-h[n-1]
    then loop from i=0 to n
    h[i+1]=x[i+2]-x[i]
    finally
    loop from i=0 to n
    sum=sum+(h[i]*y[i])
    then the answer is y/2

    thx very much for ur help
    Follow Math Help Forum on Facebook and Google+

  12. #42
    A Plied Mathematician
    Joined
    Jun 2010
    From
    CT, USA
    Posts
    6,318
    Thanks
    4
    Awards
    2
    Yeah, I mis-spoke. The 7 comes from the maximized area, with the assignment of y's that you mentioned in post # 40. I will have to think about your solution. Do you understand your solution as posted in Post # 41?
    Follow Math Help Forum on Facebook and Google+

  13. #43
    Member
    Joined
    Jun 2010
    From
    Zewail University - Cairo - Egypt
    Posts
    141
    Quote Originally Posted by Ackbeet View Post
    Yeah, I mis-spoke. The 7 comes from the maximized area, with the assignment of y's that you mentioned in post # 40. I will have to think about your solution. Do you understand your solution as posted in Post # 41?
    i think that but i am waiting for ur reply about ur opinion for this solution
    Follow Math Help Forum on Facebook and Google+

  14. #44
    A Plied Mathematician
    Joined
    Jun 2010
    From
    CT, USA
    Posts
    6,318
    Thanks
    4
    Awards
    2
    Well, for the uniform interval case, with area formula given and explained in Post # 33, I think it's fairly clear that you can swap any of the interior points (points 2 through N-1), and not change the sum, right? In addition, you can swap the two endpoints (points 1 and N) without changing the sum. Does that suggest anything to you?

    I don't yet have a theory for the non-uniform case, although I do have some ideas. I'll have to think about it.

    The algorithm you posted in Post # 41 is a mystery to me. Where you found that algorithm, is there an explanation for why it produces the maximized area?
    Follow Math Help Forum on Facebook and Google+

  15. #45
    Member
    Joined
    Jun 2010
    From
    Zewail University - Cairo - Egypt
    Posts
    141
    Quote Originally Posted by Ackbeet View Post
    Well, for the uniform interval case, with area formula given and explained in Post # 33, I think it's fairly clear that you can swap any of the interior points (points 2 through N-1), and not change the sum, right? In addition, you can swap the two endpoints (points 1 and N) without changing the sum. Does that suggest anything to you?

    I don't yet have a theory for the non-uniform case, although I do have some ideas. I'll have to think about it.

    The algorithm you posted in Post # 41 is a mystery to me. Where you found that algorithm, is there an explanation for why it produces the maximized area?
    my father told me that but he is in his work nw
    and the solution he told me is accepted
    but u make him reach this formula by your idea with trapeziums
    i think u can get better formula waiting u
    Follow Math Help Forum on Facebook and Google+

Page 3 of 4 FirstFirst 1234 LastLast

Similar Math Help Forum Discussions

  1. Maximization
    Posted in the Calculus Forum
    Replies: 2
    Last Post: May 31st 2010, 02:47 PM
  2. Maximization
    Posted in the Pre-Calculus Forum
    Replies: 1
    Last Post: February 25th 2010, 06:08 PM
  3. Maximization
    Posted in the Calculus Forum
    Replies: 1
    Last Post: December 11th 2009, 08:11 PM
  4. Maximization
    Posted in the Calculus Forum
    Replies: 5
    Last Post: April 13th 2008, 04:55 AM
  5. Maximization
    Posted in the Calculus Forum
    Replies: 6
    Last Post: January 19th 2007, 12:39 AM

Search Tags


/mathhelpforum @mathhelpforum