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 am building a mathematical simulation of curvature that will show the Osculation circle at each point on a curve. However my code keeps coming up with errors and Manipulate doesn't evaluate r[[1]]. I believe it keeps it as just an expression. It says:

Part::partd: Part specification r[[1]] is longer than depth of object. >>

r[t_] := {Cos[t], Sin[t]}
uT[t_] := Simplify[r'[t]/Norm[r'[t]], t \[Element] Reals]
x[t_] := r[[1]]
y[t_] := r[[2]]
OlcusionPoint[t_] := 
 x[t](*-((((x'[t])^2+(y'[t])^2)*y'[t])/((x'[t]*y''[t])-(x''[t]*y'[
  t])))*)// Evaluate
OclusionPoint2[t_] := 
 y[t](*+((((x'[t])^2+(y'[t])^2)*x'[t])/((x'[t]*y''[t])-(x''[t]*y'[
  t])))*)// Evaluate

Manipulate[
 Show[Graphics[{RGBColor[0.6, 0.6, 0.8], 
    Disk[{OlcusionPoint[t], OclusionPoint2[t]}, 
     Abs[1/(uT[t]/r'[t])]]}], 
  ParametricPlot[{Cos[t], Sin[t]}, {t, 0, 2 Pi}], 
  Graphics[{PointSize[.025], Point[{Cos[t], Sin[t]}]}]], {t, 0, 2 Pi}] 
share|improve this question

closed as off-topic by m_goldberg, Sjoerd C. de Vries, bobthechemist, Yves Klett, belisarius May 21 at 22:13

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "This question arises due to a simple mistake such as a trivial syntax error, incorrect capitalization, spelling mistake, or other typographical error and is unlikely to help any future visitors, or else it is easily found in the documentation." – m_goldberg, Sjoerd C. de Vries, bobthechemist, Yves Klett, belisarius
If this question can be reworded to fit the rules in the help center, please edit the question.

    
Re the error message: you need to use x[t_]:= r[t][[1]]. You will find this demo useful. –  kguler May 21 at 17:09

1 Answer 1

You also have to change y[t_] and replace 0 with 0.01. I also added ImageSize to prevent permanent resizing:

r[t_] := {Cos[t], Sin[t]}
uT[t_] := Simplify[r'[t]/Norm[r'[t]], t \[Element] Reals]
x[t_] := r[t][[1]]
y[t_] := r[t][[2]]
OlcusionPoint[t_] := x[t] // Evaluate
OclusionPoint2[t_] := y[t] // Evaluate

Manipulate[Show[Graphics[{RGBColor[0.6, 0.6, 0.8],
    Disk[{OlcusionPoint[t], OclusionPoint2[t]}, 
     Abs[1/(uT[t]/r'[t])]]}],
  ParametricPlot[{Cos[t], Sin[t]}, {t, 0.01, 2 Pi}],
  Graphics[{PointSize[.025], Point[{Cos[t], Sin[t]}]}], 
  ImageSize -> {500, 500}], {t, 0.01, 2 Pi}]
share|improve this answer

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