Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2008

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

Search the Archive

Re: SetDelayed

  • To: mathgroup at smc.vnet.net
  • Subject: [mg92896] Re: [mg92875] SetDelayed
  • From: Bob Hanlon <hanlonr at cox.net>
  • Date: Fri, 17 Oct 2008 05:24:19 -0400 (EDT)
  • Reply-to: hanlonr at cox.net

Restrict f to only numerical arguments

f[x_?NumericQ] := NIntegrate[(x - Cos[y])/
    (1 + x^2 - 2*x*Cos[y])^1.5, {y, 0, Pi}];

Plot[f[x], {x, 0, 2}, Exclusions -> 1]

Or evaluate symbolically

f2[x_] = Assuming[{x > 0},
   Integrate[(x - Cos[y])/
     (1 + x^2 - 2*x*Cos[y])^(3/2), {y, 0, Pi},
    GenerateConditions -> False]] // Simplify

((x + 1)*EllipticE[(4*x)/(x + 1)^2] + 
      (x - 1)*EllipticK[(4*x)/(x + 1)^2])/(x*(x^2 - 1))

Plot[f2[x], {x, 0, 2}, Exclusions -> 1]


Bob Hanlon

---- Itzhak <shechtma at netvision.net.il> wrote: 

=============
Why does Mathematica reply with:

.."Integrand [(x-Cos[y])/(1+x^2-2*x*Cos[y])^1.5 is not numerical at {y}={1.5708}", to the following:

Clear[f]
f[x_]:=NIntegrate[(x-Cos[y])/(1+x^2-2*x*Cos[y])^1.5,{y,0,Pi}];
Plot[Evaluate[f[x],{x,0,2}]

How should it be written?

Thank you.


--

Bob Hanlon



  • Prev by Date: Re: SetDelayed
  • Next by Date: Reduce Question
  • Previous by thread: Re: SetDelayed
  • Next by thread: Re: SetDelayed