Re: hi, how can i accomplish this densityplot?
- To: mathgroup at smc.vnet.net
- Subject: [mg107406] Re: [mg107392] hi, how can i accomplish this densityplot?
- From: Bob Hanlon <hanlonr at cox.net>
- Date: Thu, 11 Feb 2010 08:33:13 -0500 (EST)
- Reply-to: hanlonr at cox.net
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" <hiphopphysics 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!