# Is this something about DensityPlot[]?

Posted 8 years ago
3835 Views
|
|
0 Total Likes
|
 Hello Group:This works: (* directly from the help page *) DensityPlot[Arg[Sqrt[x + I y]], {x, -3, 3}, {y, -3, 3} ] I want to define the inner function myself with: f[a_, b_] := a + I b (* this forum software is removing the underscore in the functions definition ?!?!?..should be f[Placeholder[a], Placeholder[b]]:=a+ I b *)But then this does not work: DensityPlot[Arg[Sqrt[f]], {x, -3, 3}, {y, -3, 3} ] Neither does any of these: DensityPlot[Evaluate[Arg[Sqrt[f]]], {x, -3, 3}, {y, -3, 3} ] DensityPlot[Arg[Sqrt[f]], {a, -3, 3}, {b, -3, 3} ] DensityPlot[Evaluate[Arg[Sqrt[(#1 + I #2) &]]], {x, -3, 3}, {y, -3, 3}] I have been confused in the past to know when Evaluate[] was needed. It usually fixes these wierd cases.Thanks in advance.
 You need to give arguments to your function f, otherwise evaluation of f fails as you noted  Clear[f] f[a_,b_]:= a + I b DensityPlot[Arg[Sqrt[f[x,y]]], {x, -3, 3}, {y, -3, 3} ] B.t.w. this forum software has a help post about post's formatting READ FIRST: How to post and use Wolfram Community and the link appears prominently near the top of the page.