Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2000
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2000

[Date Index] [Thread Index] [Author Index]

Search the Archive

defining myIntegrate

  • To: mathgroup at smc.vnet.net
  • Subject: [mg24143] defining myIntegrate
  • From: Otto Linsuain <linsuain+ at andrew.cmu.edu>
  • Date: Wed, 28 Jun 2000 02:11:58 -0400 (EDT)
  • Sender: owner-wri-mathgroup at wolfram.com

 Hi. I am trying to define a function that will compute certain kind of
integrals starting from lists of abcisas and ordinates.

 So I have two lists abcisas={x1,x2,...}, ordinates={fx1,fx2,...}

 I want to implement a trapezoidal rule (I know these things have been
coded for decades, but bare with me)

  f[x,ordinates,abcisas]=a piecewise linear function of x that joins
(fx[[i]],x[[i]]) and (fx[[i+1]],x[[i+1]]) with a straight line.

 This function is linear in the intervals (x[[i]],x[[i+1]]) and it is an
approximation to the function that evaluates to the list ordinates when
Mapped to the list abcisas. 

  Now I want an approximation to the definite integral of f*Kernel*dx
{x,x1,xfinal}, where Kernel is a function of x and the indefinite
integrals x*Kernel*dx and  Kernel*dx I know analitically. 

  If Kernel weren't there I could just apply a Simpson's rule to
ordinates. I could form the list ordinates={f*Kernelx1,f*Kernelx2,....}
and apply Simpson's rule to that, but I don't want a trapezoidal
approximation to Kernel. I also don't want to use Mathematica's built-in
Integrate. There are reasons for this.

 So it is clear that I have all the ingredients to compute my integrals.
Now one could proceed in two different ways:

 1) Write some list crunching functions that will form the function f:
you have to form combinations like (x[[i+1] fx[[i]]-x[[i]]
fx[[i+1]])/(x[[i+1]]-x[[i]]) for example, and then dot this list with
PrimitiveofKernel[[i+1]]-PrimitiveofKernel[[i]], and so on. This way
seems the most straightforward, since it is just list crunching. However
there is a lot for it, and lots of room for that little mistake that
kills you.


 2) Or you can define some rules to implement the properties of
integration (linearity with respect to the integrand, additivity over
intervals, etc) and make use of this function.

 My question to the group is which way is more advisable. I am
particularly concerned with speed. I just want this function to compute
these integrals, not a package that considers all possibilities. Thanks,
Otto Linsuain. 


  • Prev by Date: RE: Re: "misbehaving" Union function
  • Next by Date: RE: Wrong Precision with "N" ??
  • Previous by thread: Problems with Mathlink examples. Help needed.
  • Next by thread: Finding the inverse of a function?