The Museum of HP Calculators

HP Forum Archive 20

[ Return to Index | Top of Index ]

48sx Numerical Integration Question
Message #1 Posted by svisvanatha on 9 Mar 2011, 4:05 p.m.

I am performing a numerical integration of a function f(x)=g(x)*h(x) over an interval [a,b]. In other words, "integral (f(x)*dx)". I am also interested in plotting the integral's result as a function of the distance along the interval [a,b].

The algorithm that the calculator uses to perform the integration must calculate the integral at a fixed number of intermediate points along [a,b].

So, my question is whether that information is available to the user when using the built-in numerical integration routine?

I can do what I want by performing a summation of the integral's value over a fixed number of divisions over the interval [a,b]. However, I thought that these intermediate values may be available and accessible.

Any thoughts?

Edited: 9 Mar 2011, 4:08 p.m.

      
Re: 48sx Numerical Integration Question
Message #2 Posted by Namir on 9 Mar 2011, 4:55 p.m.,
in response to message #1 by svisvanatha

If I am reading you correctly, you want to plot the the area from a to b, varying the value of b from a until you hit bmax:

For b = a to bmax
  area = area under f(x) curve between [a,b]
  plot value for area on a graph showing area vs b
Next
Yes? No?

Namir

Edited: 9 Mar 2011, 4:58 p.m.

            
Re: 48sx Numerical Integration Question
Message #3 Posted by svisvanatha on 9 Mar 2011, 6:19 p.m.,
in response to message #2 by Namir

Yes, that is correct.

The issue becomes one of speed, since the built-in numerical integration function divides the interval into a finite number of strips, calculates the area of that strip for a given ordinate, and adds that to the total sum. With your method, there is alot of computational overlap between successive iterations. I came up with a similar method, but it basically mimics the built-in routine. I was hoping that the intermediate values for iterations of the numerical solver are available in some manner, but seems like wishful thinking.

Thanks!

                  
Re: 48sx Numerical Integration Question
Message #4 Posted by Crawl on 9 Mar 2011, 7:00 p.m.,
in response to message #3 by svisvanatha

It seems like it would be easier to do with a program.

Supposing that the distance between pixels is dx, you'd want to integrate f(x) between x and dx for each coordinate x, and add the result to variable that keeps the total.

Since the limits are so close, for most functions I'd imagine the integral would converge quickly.

                        
Re: 48sx Numerical Integration Question
Message #5 Posted by svisvanatha on 10 Mar 2011, 6:38 a.m.,
in response to message #4 by Crawl

OK, so I divided the interval into a number of sub-intervals. For each sub-interval, I used the built-in numerical integration routine. I increment an area variable by that amount, and also store the total area and upper limit of the current interval as a 2 column row within a matrix.

At the end, I have the total area as well as the area as a function of the distance along the interval (a,b).

Thanks for the replies!


[ Return to Index | Top of Index ]

Go back to the main exhibit hall