Re: NIntegrate and Plot

• To: mathgroup at smc.vnet.net
• Subject: [mg30461] Re: NIntegrate and Plot
• From: Yasvir Avindra Tesiram <y.tesiram at pgrad.unimelb.edu.au>
• Date: Wed, 22 Aug 2001 01:41:58 -0400 (EDT)
• Sender: owner-wri-mathgroup at wolfram.com

```Thank for all the replies. Once again I am overwhelmed by the number of
ways in which one problem can be tackled with Mathematica. Nothing like
learning by example. However, I have one more request and if possible,
using the method as outlined by Tom Burton below, whether FF below could
be used once again to perform a similar integration, i.e., I now want to
integrate the integral again and plot the result. I assume that
ListIntegrate and InterpolationFunction could be used somehow on FF after
Partitioning FF.

Below is a re-typed copy of the notebook with Tom Burtons construct for
making a ListPlot of the first integral.

Any tips on making this a small package so that the function can be
changed (e.g. func_ -> Sech, Sin, Cos) would also be much appreciated. I
have seen Roman Maeders example on the Parametric Plots and will probably

Thanks
Yas

fco=0.01;
np=100;
beta1 = -4.6341 * Log[10,fco] + 1.3031;
betaN = 2^(n-1) * beta1;

f[x_] := (Sech[betaN * x^n])^2

(*First, define a function to integrate over an interval:*)

DF[{x1_, x2_}] := NIntegrate[f[x],{x,x1,x2}]

(* Then set the endpoints of the steps, just as you did:*)

xx = Table[-0.5 + (i -1)/(np-1), {i,1,np}];

(* Then partition into intervals:*)

Dxx = Partition[xx,2,1];

(* Set parameters:
In[37]:= betaN = 121.643; n = 2;*)

(* Step through the intervals, accumulating the integral as we go:*)

FF = FoldList[#1 + DF[#2]&, 0, Dxx];

(* Plots of f and FF:*)

In[39]:= ListPlot[{#,f[#]}&/@xx];
In[40]:= ListPlot[Transpose[{xx,FF}]];

```

• Prev by Date: Re: Pentium 3 versus Pentium, also memory, bus speeds
• Next by Date: Problem with context creation in packages
• Previous by thread: RE: Re: NIntegrate and Plot
• Next by thread: How to do a simple loop?