Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

How would I draw this in sage? It's a Frenet Trihedron along a given curve:

enter image description here

Tools other then Sage are welcome too.

Im just interested in which equations I need to input, besides the curve to obtain the animation.

share|cite|improve this question
There are various official places to get Sage help, by the way. – Dylan Moreland May 25 '12 at 4:35
up vote 4 down vote accepted

I don't yet know Sage well enough to carry this off, but here's some Mathematica code:

fn[t_] := {Cos[t], Sin[t], t/2}
fnD1[t_] := Simplify[D[fn[tt], tt] /. tt -> t, Trig -> True]
fnD1n[t_] := Simplify[fnD1[t]/Sqrt[fnD1[t].fnD1[t]], Trig -> True]
fnD2[t_] := Simplify[D[fnD1n[tt], tt] /. tt -> t, Trig -> True]
fnD2n[t_] := Simplify[fnD2[t]/Sqrt[fnD2[t].fnD2[t]], Trig -> True]
binormal[t_] := Simplify[Cross[fnD1n[t], fnD2n[t]], Trig -> True]
trihedron[t_] := {fn[t], fnD1n[t], fnD2n[t], binormal[t]}

curve = ParametricPlot3D[fn[t], {t, 0, 10}];
 tri = trihedron[t];
 Graphics3D[{Red, Line[{tri[[1]], tri[[1]] + tri[[2]]}], Green, 
 Line[{tri[[1]], tri[[1]] + tri[[3]]}], Blue, 
 Line[{tri[[1]], tri[[1]] + tri[[4]]}]}]}], {t, 0, 10}]

The expression D[f[x],x] computes the derivative of f; Cross computes the cross product; Trig->True instructs Mathematica to simplify trig expressions. You will probably want to hard-code the formulas for fnD1n, fnD2n, and binormal. They are simple enough:

fnD1n[t] = {-Sin[t], Cos[t], 1/2} * (2/Sqrt[5])
fnD2n[t] = {-Cos[t], -Sin[t], 0}
binormal[t] = {Sin[t], -Cos[t], 2} * (1/Sqrt[5])

Addendum: As I said, I'm no expert in Sage. I actually didn't think the code above was all that long, but it could have been shortened a bit by hard-coding the formulas for the three unit vectors rather than computing them from the definitions. The latter has the advantage of allowing the code to be easily adapted for other curves.

Here's some code to draw a still image in Sage:

pl1=parametric_plot3d( (cos(t), sin(t), t/2), (t, 0, 10));
pl2=parametric_plot3d( (cos(a) - t*sin(a)*2/sqrt(5), sin(a)+t*cos(a)*2/sqrt(5), 
 a/2+t*1/2*2/sqrt(5)), (t,0,1), texture="red");
pl3=parametric_plot3d( (cos(a) - t*cos(a), sin(a)-t*sin(a)*2/sqrt(5), a/2+t*0), 
 (t,0,1), texture="green");
pl4=parametric_plot3d( (cos(a) + t*sin(a)*1/sqrt(5), sin(a)-t*cos(a)*1/sqrt(5), 
 a/2+t*2*1/sqrt(5)), (t,0,1), texture="blue");

You'll see that the unit vectors have been hard-coded in this version. The trihedron is moved along the curve by varying $a$. I haven't figured out how to animate this yet. I have seen examples in the Sage documentation where a 2-D plot is animated, but not 3-D. Apparently there's some work to be done in this area. See the following posts:

share|cite|improve this answer
Could you convert this to Sage? I'll accept your answer then. Expected it to have less code. – Tool May 25 '12 at 15:38
Why would you expect it to have less code? The Mathmatica code that Will gave is pretty much minimal! – Mariano Suárez-Alvarez May 26 '12 at 20:10
Thanks, you really saved my life! – Tool May 27 '12 at 20:25

Your Answer


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.