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