Re: hi, how can i accomplish this densityplot?
- To: mathgroup at smc.vnet.net
- Subject: [mg107437] Re: hi, how can i accomplish this densityplot?
- From: çåå <hiphopphysics at yahoo.com.tw>
- Date: Fri, 12 Feb 2010 04:44:53 -0500 (EST)
- References: <hl10vh$4fn$1@smc.vnet.net>
On 2=E6=9C=8811=E6=97=A5, =E4=B8=8B=E5=8D=889=E6=99=8233=E5=88=86, Bob Hanlon <hanl... at cox.net> wrote: > The problem is that you used patterns (e.g., x_) in the function in the DensityPlot. You should also restrict the definition of f to numeric arguments since the RHS cannot evaluate without numeric input. > > f[x_?NumericQ, y_?NumericQ] := > NIntegrate[r0*Exp[-(r0 + 2* > (x^2 + y^2 + r0^2 + 2*r0* > ((x^2 + y^2)^0.5)* > (Cos[theta0]*(y/(x^2 + y^2)^0.5) - > Sin[theta0]*(x/(x^2 + y^2)^0.5)) > )^0.5)], > {r0, 0, Infinity}, {theta0, 0, Pi}] > > DensityPlot[f[x, y], {x, -2, 2}, {y, -2, 2}] > > Bob Hanlon > > ---- "=E7=9C=9F=E5=A5=BD=E5=91=BD" <hiphopphys... at yahoo.com.tw> wrote: > > ============= > f[x_, y_] := > NIntegrate[ > r0*Exp[-(r0 + > 2*(x^2 + y^2 + r0^2 + > 2*r0*((x^2 + y^2)^0.5)*(Cos[theta0]*(y/(x^2 + y^2)^0.5) - > Sin[theta0]*(x/(x^2 + y^2)^0.5)))^0.5)], {r0, 0, > Infinity}, {theta0, 0, Pi}] > > DensityPlot[f[x_, y_], {x, -2, 2}, {y, -2, 2}] > > i entered the code above but mathematica return the error message: > > NIntegrate::inumr: The integrand E^(-r0-2 (r0^2+<<1>>+<<1>>+2 r0 > Power[<<2>>] Plus[<<2>>])^0.5) r0 has evaluated to non-numerical > values for all sampling points in the region with boundaries {{\ > [Infinity],0.},{0,3.14159}}. >> > > General::stop: Further output of NIntegrate::inumr will be suppressed > during this calculation. > > what's wrong with my code? please help me! thanks a lot! thank you so much, you are a nice guy, have a nice day!