Results 1 to 4 of 4

Math Help - Help Computing Intengral

  1. #1
    Newbie
    Joined
    Jun 2010
    Posts
    19

    Help Computing Intengral

    I need help computing this integral with the different techniques mentioned below.

    ∫ 50 1/x dx
    1

    (thats a 50 at the top and a 1 at the bottom of the integram sign)

    - Right rectangular scheme
    - Left rectangular scheme
    - Midpoint Rectangular scheme
    - trapezoid scheme
    - Simpson sRule
    Follow Math Help Forum on Facebook and Google+

  2. #2
    MHF Contributor
    Joined
    Mar 2010
    From
    Florida
    Posts
    3,093
    Thanks
    5
    \int\frac{1}{x} \ dx=\ln|x| +c
    Follow Math Help Forum on Facebook and Google+

  3. #3
    Newbie
    Joined
    Jun 2010
    Posts
    19
    More specifically I need to write a code in either Matlab or any other programming language from n = 2, 10, 100, 1000 to compute each method.
    Follow Math Help Forum on Facebook and Google+

  4. #4
    Behold, the power of SARDINES!
    TheEmptySet's Avatar
    Joined
    Feb 2008
    From
    Yuma, AZ, USA
    Posts
    3,764
    Thanks
    78
    Quote Originally Posted by lilyungn View Post
    I need help computing this integral with the different techniques mentioned below.

    ∫ 50 1/x dx
    1

    (thats a 50 at the top and a 1 at the bottom of the integram sign)

    - Right rectangular scheme
    - Left rectangular scheme
    - Midpoint Rectangular scheme
    - trapezoid scheme
    - Simpson sRule
    for the first 2 just use the definition of a Riemann sum.

    Here is some pseudo code

    \Delta x =\frac{b-a}{n}

    x_i=a+i\Delta x if you want left end points i=0,1,2,...,n-2,n-1 and for right i=1,2,...,n-1,n

    Now for the left just calculate

    \int_{a}^{b} f(x)dx \approx \Delta x\sum_{i=0}^{n-1}f(x_i).

    In Matlab would use parameters like a and b and have the function take them as an input. Also if you define your partition as a vector you can have Matlab evaluate all of the x_i's at the same time. Just modify the above to use the other quadrature rules.

    Here is a copy of an m file for the left end point

    Code:
    function [ output ] = LeftEnd(n,a,b )
    %Use Left end point to approximate the integral of 1/x from a to b using
    % n points.
    OneOver=@(x) x.^(-1);
    v=zeros(1,n);
    for m=1:n
       v(1,m)=a+((b-a)/n)*((m-1));
    end
    y=OneOver(v);
    output=((b-a)/n)*sum(y);
    
    
    end
    Last edited by TheEmptySet; June 9th 2011 at 01:47 PM. Reason: added .m file
    Follow Math Help Forum on Facebook and Google+

Similar Math Help Forum Discussions

  1. Computing A^k
    Posted in the Advanced Algebra Forum
    Replies: 7
    Last Post: September 19th 2011, 01:51 PM
  2. Computing Eigenvectors
    Posted in the Advanced Algebra Forum
    Replies: 3
    Last Post: April 12th 2010, 01:42 AM
  3. Computing ROI ?
    Posted in the Business Math Forum
    Replies: 1
    Last Post: May 13th 2009, 02:46 PM
  4. Computing e^A
    Posted in the Advanced Algebra Forum
    Replies: 6
    Last Post: November 27th 2008, 06:49 AM
  5. computing
    Posted in the Discrete Math Forum
    Replies: 4
    Last Post: April 28th 2007, 12:25 AM

Search Tags


/mathhelpforum @mathhelpforum