0

I am trying to take the curl of a vector field which is the a product of a scalar field (Psi) and a coordinate vector, {r,Theta,Phi}. After taking the curl I want to calculate the magnitude of the norm of the vector. My code for this is:

ψcurl = Curl[{r, θ, ϕ}*ψ[θ, ϕ,r], {r, θ, ϕ}, "Spherical"];

TEnorm[θ_, ϕ_, r_] := Abs[Norm[Evaluate[ψcurl[r, θ, ϕ]]]];

When I evaluate TEnorm for specific values of r, Theta, and Phi, it returns a long, non-numerical result which is the Abs-Norm of my vector function but r, Theta, and Phi still appear as symbolic variables instead of the values fed into the function, as if the function definition does not recognize that ψcurl contains the variables r, Theta, and Phi. Probably a bush-league mistake but what am I missing here?

Sjoerd C. de Vries
  • 65,815
  • 14
  • 188
  • 323
A. Pauls
  • 1
  • 1

1 Answers1

3

I think the following does what you are asking for.

ψcurl = Curl[{r, θ, ϕ} ψ[θ, ϕ, r], {r, θ, ϕ}, "Spherical"];
TEnorm[θ_, ϕ_, r_] = Abs[Norm[ψcurl]];

In this case, you do not want to delay evaluation of the assignment (use = rather than :=) making the Evaluate redundant.

Putting [r, θ, ϕ] after ψcurl in the second line is wrong, as they don't appear in the definition in the first line.

I suggest that you also need to think carefully about the underlying maths, as I think you may have gone wrong there too.

mikado
  • 16,741
  • 2
  • 20
  • 54