Re: integral to table values
- To: mathgroup at smc.vnet.net
- Subject: [mg60512] Re: integral to table values
- From: Jean-Marc Gulliet <jeanmarc.gulliet at gmail.com>
- Date: Mon, 19 Sep 2005 04:45:32 -0400 (EDT)
- Organization: The Open University, Milton Keynes, U.K.
- References: <dgitq8$2f2$1@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
poster at giganews.com wrote:
> I can integrate the following expression.
>
> Integrate[Sqrt[2x - x^2], {x, 0, 2}]
>
> But, how can I get a TABLE of data? I want to vary the upper limit (h)
> over a range from 0 to 2.
>
> Ultimately, the table should look like this.
>
> h val
> ----- -----
> 0.000 0.000
> 0.100 0.029
>
> .....
>
> 1.000 0.785
>
> .....
>
> 0.800 0.586
> 1.900 1.541
> 2.000 1.570
>
> I have tried substituting a list "{0.1, 0.2, 0.3,}" for the "2" above,
> but this does provide the desired result.
>
> Thanks for your help.
> Dennis
>
Hi Dennis,
The following line should give you exactly what you want:
In[1]:=
TableForm[Table[(PaddedForm[#1, {3, 3}, NumberPadding -> {"", "0"}] & )
/@ {p, NIntegrate[Sqrt[2*x - x^2], {x, 0, p}]}, {p, 0, 2, 0.1}],
TableHeadings -> {None, {" h\n-----", " val\n-----"}}]
Best regards,
/J.M.