Results 1 to 11 of 11

Math Help - Integrals in computers

  1. #1
    Junior Member
    Joined
    Jun 2010
    Posts
    59

    Integrals in computers

    Hello everyone I would like to calculate the following integral using computer (because I have to calculate many of them , in different scenarios).

    The integral is of the form

    Integrate the
    s(x)*g(x) from the interval of [a,b]

    First I want to understand how to calculate the multiplication of two function before feeding them into the integral function

    Could you please help me with that?

    Regards
    A
    Follow Math Help Forum on Facebook and Google+

  2. #2
    MHF Contributor
    Prove It's Avatar
    Joined
    Aug 2008
    Posts
    11,835
    Thanks
    1604
    The two most common ways to evaluate integrals of products are "integration by parts" and "substitution".

    I suggest you look them up.
    Follow Math Help Forum on Facebook and Google+

  3. #3
    Grand Panjandrum
    Joined
    Nov 2005
    From
    someplace
    Posts
    14,972
    Thanks
    4
    Quote Originally Posted by dervast View Post
    Hello everyone I would like to calculate the following integral using computer (because I have to calculate many of them , in different scenarios).

    The integral is of the form

    Integrate the
    s(x)*g(x) from the interval of [a,b]

    First I want to understand how to calculate the multiplication of two function before feeding them into the integral function

    Could you please help me with that?

    Regards
    A
    That is too vague please provide more context or explanation

    CB
    Follow Math Help Forum on Facebook and Google+

  4. #4
    Junior Member
    Joined
    Jun 2010
    Posts
    59
    Hello,
    I would like to thank you for your answers.
    I tried to upload a pretty simplified version of what I want to calculate so to build understanding how integration works in computers.

    ImageShack® - Online Photo and Video Hosting

    In the image you will see three plots: s(x), g1(x),g2(x)

    At the bottom of the image are the two integrals that I would like to find:
    s(x)*g1(x)
    s(x)*g2(x).

    So first I multiply the two functions and then I integrate them?
    Follow Math Help Forum on Facebook and Google+

  5. #5
    Grand Panjandrum
    Joined
    Nov 2005
    From
    someplace
    Posts
    14,972
    Thanks
    4
    Quote Originally Posted by dervast View Post
    Hello,
    I would like to thank you for your answers.
    I tried to upload a pretty simplified version of what I want to calculate so to build understanding how integration works in computers.

    ImageShack® - Online Photo and Video Hosting

    In the image you will see three plots: s(x), g1(x),g2(x)

    At the bottom of the image are the two integrals that I would like to find:
    s(x)*g1(x)
    s(x)*g2(x).

    So first I multiply the two functions and then I integrate them?
    That is still too vague, do you want to use numerical integration methods, do you want an analytic/exact result, ...

    CB
    Follow Math Help Forum on Facebook and Google+

  6. #6
    Junior Member
    Joined
    Jun 2010
    Posts
    59
    Numerical integration
    Follow Math Help Forum on Facebook and Google+

  7. #7
    MHF Contributor

    Joined
    Apr 2005
    Posts
    16,454
    Thanks
    1868
    Then I can see no problem with the multiplication. You have values of f(x) and g(x) at various points- just multiply them together to get f(x)g(x). Yes, you "multiply then then integrate them". That is what " \int f(x)g(x)dx" means!

    What integration algorithm are you using, Simpson's rule?
    Follow Math Help Forum on Facebook and Google+

  8. #8
    Grand Panjandrum
    Joined
    Nov 2005
    From
    someplace
    Posts
    14,972
    Thanks
    4
    Quote Originally Posted by HallsofIvy View Post
    Then I can see no problem with the multiplication. You have values of f(x) and g(x) at various points- just multiply them together to get f(x)g(x). Yes, you "multiply then then integrate them". That is what " \int f(x)g(x)dx" means!

    What integration algorithm are you using, Simpson's rule?
    There is a technical difficulty in that one of the functions is a saltus function (a step function), which means that most numerical integration schemes become inefficient. The best policy would be to decompose the integrals into a sum of integrals over the intervals on which the saltus function is a constant.

    CB
    Follow Math Help Forum on Facebook and Google+

  9. #9
    Junior Member
    Joined
    Jun 2010
    Posts
    59
    Quote Originally Posted by CaptainBlack View Post
    There is a technical difficulty in that one of the functions is a saltus function (a step function), which means that most numerical integration schemes become inefficient. The best policy would be to decompose the integrals into a sum of integrals over the intervals on which the saltus function is a constant.

    CB
    I would like to thank you for your reply all.
    Actually for fun sake I tried numerical integration and if step function has only few steps (like 5-10) I get good results... but when the function has like 800steps then I get errors. thus I would like to ask you for a reference
    --> that explain the difference between numerical,analytic/extact integration, and anything else that has to do with calculating integrals in computers.

    I will also try the solution Captain Black suggested to decompose the integrals into a sum of integrals and I ll post back again.

    Regards and Happy new Year!
    Alex



    EDIT: One more thing I noticed a step function is not continuous thus can not be integrated. Is that right?
    Last edited by dervast; January 12th 2011 at 07:41 AM. Reason: I noticed that...
    Follow Math Help Forum on Facebook and Google+

  10. #10
    Grand Panjandrum
    Joined
    Nov 2005
    From
    someplace
    Posts
    14,972
    Thanks
    4
    Quote Originally Posted by dervast View Post

    EDIT: One more thing I noticed a step function is not continuous thus can not be integrated. Is that right?
    No a piecewise continuous function is integrable.

    CB
    Follow Math Help Forum on Facebook and Google+

  11. #11
    Junior Member
    Joined
    Jun 2010
    Posts
    59
    I would like to thank you for your answer.
    So to make sure I got it right
    a. If you want to integrate a function has to be continuous.
    b. If you want to integrate a step function (which is ofc. not continuous) you have to do find the integrals for the smallest step functions.

    Do you agree with that?

    I would like to thank you in advance for your help
    Best Regards
    Alex
    Follow Math Help Forum on Facebook and Google+

Similar Math Help Forum Discussions

  1. Four color theorem and computers
    Posted in the Math Software Forum
    Replies: 1
    Last Post: November 21st 2010, 11:31 PM
  2. Calculus for computers question
    Posted in the Calculus Forum
    Replies: 23
    Last Post: August 17th 2008, 01:39 AM
  3. Computers problem
    Posted in the Advanced Applied Math Forum
    Replies: 0
    Last Post: July 28th 2008, 12:20 PM
  4. Finance Charges and Computers! Help!
    Posted in the Algebra Forum
    Replies: 1
    Last Post: March 7th 2008, 09:16 AM
  5. Fermat, computers, and a smart boy
    Posted in the Math Challenge Problems Forum
    Replies: 10
    Last Post: February 2nd 2006, 02:34 PM

Search Tags


/mathhelpforum @mathhelpforum