Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

I'm doing this exercise in Wagner's book (p.78)

Mathematica graphics

, and this is my attempt:

Clear[curvature];

(*Define curvature function *)
curvature[x_, y_, z_] := Module[{s, v, T},
  s = {x, y, z};
  v = D[s, t];
  T = v/Norm[v];
  Simplify[Norm[D[T, t]/Norm[v]]]]

(* Apply function to Cos[t],Sin[t],t *)
curvature[Cos[t], Sin[t], t]

Mathematica graphics

As you could see I did not get the expected answer (1/2) when applying my curvature function.

It also would not reduce even when a value for t was substituted:

curvature[Cos[t], Sin[t], t] /. t -> 4

Mathematica graphics

However, following Wagner's solution where he defines a separate magnitude function does work:

Clear[curvature];

(* Define function to find magnitude of a vector *)
mag[vec_] := Sqrt[vec.vec]

(* Define curvature function *)
curvature[x_, y_, z_] := Module[{s, v, T},
  s = {x, y, z};
  v = D[s, t];
  T = v/mag[v];
  Simplify[mag[D[T, t]/mag[v]]]]

(* Apply function to Cos[t],Sin[t],t *)
curvature[Cos[t], Sin[t], t]

Mathematica graphics

It seems pretty clear that using Norm to find the magnitude of a vector does not work in this case. More specifically, using Norm doesn't seem to simplify trigonometric results unless the t is substituted

Norm[{Cos[t], Sin[t]}]
Norm[{Cos[t], Sin[t]}] /. t -> 4 // Simplify

Mathematica graphics

I'm very fuzzy on my matrix knowledge so I'd really appreciate an explanation on why Norm doesn't seem to return the expected answer in this case. Also, is there any other way to find a vector's magnitude that will give the correct answer without defining a new function?

share|improve this question
1  
Simplify[Norm[{Cos[t], Sin[t]}], Element[t, Reals]]... –  Yves Klett Jul 3 at 7:43
    
This is a related post: Finding unit tangent, normal, and binormal vectors for a given r(t), and explicitly this is the simplest answer. –  Artes Aug 24 at 9:11

3 Answers 3

up vote 7 down vote accepted

Norm in general assumes complex arguments and uses Abs to provide for that:

Norm[{x, y}]

Sqrt[Abs[x]^2 + Abs[y]^2]

For real elements, you can either add an assumption for Simplify or manually get rid of Abs beforehand:

Simplify[Norm[{Cos[t], Sin[t]}], Element[t, Reals]]
Simplify[Norm[{Cos[t], Sin[t]}] /. Abs -> Identity]

1

1

This now returns the desired result for real t:

curvature[x_, y_, z_] := Module[{s, v, T}, s = {x, y, z};
  v = D[s, t];
  T = v/Norm[v];
  Simplify[Norm[D[T, t]/Norm[v]] /. Abs -> Identity]]

curvature[Cos[t], Sin[t], t]

1/2

share|improve this answer

Here is a version of curvature that uses Mathematica machinery not available to Wagner, who used V3.

curvature[x_, y_, z_] :=
  Module[{s, v, vMag, T},
    Block[{$Assumptions = {{x, y, z} ∈ Reals}},
      s = {x, y, z};
      v = D[s, t];
      vMag = Surd[v.v, 2];
      T = v/vMag;
      Simplify[Norm[D[T, t]/vMag]]]]
curvature[Cos[t], Sin[t], t]
1/2
share|improve this answer
1  
That post would have been also great from @Sjoerd: Surd by Sjoerd :D –  Yves Klett Jul 3 at 11:24
2  
@YvesKlett. Perhaps Sjoerd thought that using Surd to eliminate Abs was absurd :D –  m_goldberg Jul 3 at 11:28
    
hehe, I had that one coming :-) –  Yves Klett Jul 3 at 11:29

EDIT

With V10 we can use

ArcCurvature[2 {Cos[t], Sin[t]}, t]

1/2

Or

FrenetSerretSystem[a {Cos[t], Sin[t]}, t]

enter image description here

yielding curvature, tangent, and normal

Original answer

An alternative:

$Assumptions = t \[Element] Reals;

J[{x_, y_}] := {-y, x}

Curvature[a_][t_] := a''[t].J[a'[t]]/Norm[J[a'[t]]]^3 // Simplify

circle[a_][t_] := {a Cos[t], a Sin[t]}

Curvature[circle[2]][t]

enter image description here

ellipse[a_, b_][t_] := {a Cos[t], b Sin[t]}

Curvature[ellipse[2, 3]][t]

enter image description here

Curvature[ellipse[2, 3]][Pi]

enter image description here

$Assumptions = True; (* Clear *)
share|improve this answer
    
Thank you for your answer. Could you help me understand why you defined a function with 2 parameters in separate brackets? –  seismatica Jul 3 at 19:45
    
@seismatica I think it's just a matter of personal taste. Makes code clearer for me in the ellipse-case (t vs. Pi). –  eldo Jul 3 at 19:58

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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