Mathematica 9 is now available
Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2004
*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 2004

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

Search the Archive

Re: NIntegrate a list

  • To: mathgroup at smc.vnet.net
  • Subject: [mg52979] Re: [mg52940] NIntegrate a list
  • From: DrBob <drbob at bigfoot.com>
  • Date: Sat, 18 Dec 2004 04:00:12 -0500 (EST)
  • References: <200412171019.FAA16101@smc.vnet.net>
  • Reply-to: drbob at bigfoot.com
  • Sender: owner-wri-mathgroup at wolfram.com

I'm not sure why you want to integrate functions of x with respect to theta, but it's easily done symbolically:

Integrate[x*Sin[x]*{1, 2}, {theta, -Pi, Pi}]
{2*Pi*x*Sin[x], 4*Pi*x*Sin[x]}

The same thing with NIntegrate doesn't work because NIntegrate needs an integrand that resolves to NUMBERS.

If we change theta to x, these work:

Integrate[x*Sin[x]*{1, 2}, {x, -Pi, Pi}]
NIntegrate[x*Sin[x]*{1, 2}//Evaluate, {x, -Pi, Pi}]

but this doesn't:

NIntegrate[x*Sin[x]*{1, 2}, {x, -Pi, Pi}]

Bobby

On Fri, 17 Dec 2004 05:19:17 -0500 (EST), Aaron Fude <aaronfude at yahoo.com> wrote:

> Hi,
>
> I can Integrate this, but apparently not NIntegrate this:
>
> Integrate[x*Sin[x]*{1, 2}, {theta, -Pi, Pi}]
>
> but not
>
> NIntegrate[x*Sin[x]*{1, 2}, {theta, -Pi, Pi}]
>
> Is there a good way to do this (w/o writing loops)?
>
> Many thanks!
>
> Aaron Fude
>
>
>
>



-- 
DrBob at bigfoot.com
www.eclecticdreams.net


  • Prev by Date: Re: slow eigenvectors and eigenvalues
  • Next by Date: An argument pattern problem: ranges and lists
  • Previous by thread: Re: NIntegrate a list
  • Next by thread: Re: NIntegrate a list