0
$\begingroup$

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?

$\endgroup$
  • $\begingroup$ Are you sure that what you are trying to do is mathematically meaningful? I don't think that you can put r in a vector with angles. $\endgroup$ – mikado Jul 8 '16 at 19:01
  • $\begingroup$ Possible duplicates: (11461), (69590) $\endgroup$ – Mr.Wizard Jul 15 '16 at 10:32
3
$\begingroup$

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.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.