MathGroup Archive 2005

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

Search the Archive

Re: integral to table values


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.


  • Prev by Date: Re: integral to table values
  • Next by Date: Re: integral to table values
  • Previous by thread: Re: integral to table values
  • Next by thread: Re: integral to table values