3
$\begingroup$

I am working on a notebook for my calculus students and am dealing frequently with the norm of vector valued functions. I always seem to run into this kind of situation.

Clear[a, s, r];
r[s_] = {a Cos[s/a], a Sin[s/a]};
T[s_] = r'[s];
κ[s_] = Norm[T'[s]]

Where the output is:

(*Sqrt[Abs[Cos[s/a]/a]^2 + Abs[Sin[s/a]/a]^2]*)

Then I have to bring on the Simplify command to fix the problem. In this case, for example, I do:

κ[s_] = Simplify[Norm[T'[s]], s > 0 && a > 0]

Which provides the same answer students achieve when doing the problem by hand, namely, 1/a.

Am I dealing with the Norm command properly, or would folks like to give better advice?

Update:

Here is an idea that is extremely helpful if you are going to use these assumptions frequently in a large notebook:

Clear[a, s, r];
$Assumptions = a > 0 && s ∈ Reals;
r[s_] = {a Cos[s/a], a Sin[s/a]};
T[s_] = r'[s];
κ[s_] = Norm[T'[s]]

The output is:

(*Sqrt[Abs[Cos[s/a]/a]^2 + Abs[Sin[s/a]/a]^2]*)

But now I can quickly simplify.

Clear[a, s, r];
$Assumptions = a > 0 && s ∈ Reals;
r[s_] = {a Cos[s/a], a Sin[s/a]};
T[s_] = r'[s];
κ[s_] = Norm[T'[s]]//Simplify

The output is:

(*1/a*)
$\endgroup$
3
  • 2
    $\begingroup$ What you're doing seems to be the most reasonable answer in this case. If you want a simple result, you have to simplify. This is the only way to make use of all the assumptions. $\endgroup$
    – Jens
    Jun 14 '15 at 3:53
  • 2
    $\begingroup$ Since all values are real, you could implement the Norm directly as Sqrt[T'[s].T'[s]]. This doesn't obviate the need for simplifying, although you have one fewer condition to specify. Rather, it merely gets rid of the Abs. $\endgroup$
    – march
    Jun 14 '15 at 4:09
  • $\begingroup$ \[Kappa][s_] = Norm[T'[s]] //Simplify[#, {a > 0, Element[s, Reals]}] & $\endgroup$
    – Bob Hanlon
    Jun 14 '15 at 12:42
3
$\begingroup$

I frequently do what march advises in a comment, especially when I do not want to Simplify but I do want a differentiable norm:

norm = Sqrt[#.#] &;

If you were going to put this in a package for students to use, then you might prefer

norm[v_?VectorQ] := Sqrt[v.v];

Of course, it's only good for real-component vectors.

$\endgroup$
1
  • $\begingroup$ Yes, I've been seeing this type of method as being most desirable. I think I'll use the Sqrt when teach multivariable calculus next semester. $\endgroup$
    – David
    Jul 16 '15 at 2:01
2
$\begingroup$

I agree with Jens that Simplify seems like the right approach.
Perhaps you would find value in making its use more terse.

Define:

simp[cond_: {}][expr_] :=
 Simplify[
   expr,
   Union @@ (Flatten[{$Assumptions, cond}] /.
     ({All -> #} & /@ Variables @ Level[expr, {-1}]))
 ]

Then you can do:

Norm[T'[s]] // simp[All > 0]
1/a

Or:

$Assumptions = {All > 0};

Norm[T'[s]] // simp[]
1/a
$\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.