Re: NIntegrate and Plot
- To: mathgroup at smc.vnet.net
- Subject: [mg30430] Re: [mg30408] NIntegrate and Plot
- From: BobHanlon at aol.com
- Date: Sat, 18 Aug 2001 04:04:56 -0400 (EDT)
- Sender: owner-wri-mathgroup at wolfram.com
In a message dated 2001/8/17 3:45:32 AM, y.tesiram at pgrad.unimelb.edu.au writes: >I would like to plot the integral of, > >(Sech[betaN * x^n])^2 , > >where beatN=121.643 and n=2 say. I have started by making a table of x >values as > >np=100; >x1 = Table[(-0.5 + ((i -1)/(np-1)), {i,1,np}]; >x2 = t1^n; >x3 = (Sech[betaN * x^n])^2; > >I have tried NIntegrate but of course that just returns the total area >of >x3. > f[x_, n_:2, betaN_:121.643] := Sech[betaN*x^n]^2; Plot[f[x], {x, -0.5, 0.5}, PlotRange -> All, PlotStyle -> RGBColor[0, 0, 1]]; Plot[NIntegrate[f[t], {t, -0.5, x}], {x, -0.5, 0.5}, PlotStyle -> RGBColor[1, 0, 0]]; To combine these plots into one, you would probably want to use separate scales for the curves. See: http://support.wolfram.com/Graphics/Axes/TwoAxisGraph.html Bob Hanlon Chantilly, VA USA