MathGroup Archive 2012

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

Search the Archive

NIntegrate and replacements

  • To: mathgroup at smc.vnet.net
  • Subject: [mg127752] NIntegrate and replacements
  • From: S-Tat <kravcov.msu at gmail.com>
  • Date: Sat, 18 Aug 2012 03:47:24 -0400 (EDT)
  • Delivered-to: l-mathgroup@mail-archive0.wolfram.com
  • Delivered-to: l-mathgroup@wolfram.com
  • Delivered-to: mathgroup-newout@smc.vnet.net
  • Delivered-to: mathgroup-newsend@smc.vnet.net

Hi everyone,

I have a simple question. There is my code, it integrates a function which is a solution of the equation:

bc[r_, x_] := r + x^2;
sol[r_] := Re[x /. FindRoot[bc[r, x] == 0, {x, 1.1 + I}]];
NIntegrate[sol[r], {r, 1, 8}]


Trying this code, I got these messages:

FindRoot::nlnum: "The function value {(0.21 +2.2\ I)+r}\\n is not a list of numbers with dimensions {1} at {epseff} = {1.1 +1.` I}"

ReplaceAll::reps: "{FindRoot[bc[r,epseff]==0,{epseff,1.1 +I}]}\\n is neither a list of replacement rules nor a valid dispatch table, and so cannot be used for replacing"

Sorry if it's too dumb but I cannot see why NIntegrate couldn't just use exact value for r every time. Isn't it how numerical integration is supposed to work?

Thank you



  • Prev by Date: Re: Using a huge list of random numbers from random.org
  • Next by Date: Re: NIntegrate and replacements
  • Previous by thread: Re: Defining a total derivative
  • Next by thread: Re: NIntegrate and replacements