-1
$\begingroup$

I have a complicated parametric curve which takes too long to integrate, therefore I want to sample points and interpolate to speed up calculations.

The curve is:

     T2[s_, y_] := c1[s] + 0.1*(j[s]*Sin[y] - v[s]*Cos [y])

where

    y = 5 Pi*s

I start by

    Table[T2[s, y], {s, 0, 250, 0.1}]
    func = Interpolation[%]

which doesn't give any correct point on the curve.

Definitions of functions are:

    a = 5
    g[t_] := {-(a + 3*Cos[6*t])*Sin[7*t], (a + 3*Cos[6*t])*Cos[7*t], 
    3*Sin[6*t]}

    dg[t_] := If[t - 2*Pi <= 0, g'[t], g'[2*Pi]];

    tfn = NDSolveValue[{t'[s] == 1/Norm[dg[t[s]]], t[0] == 0, 
    WhenEvent[t[s] == 2*Pi, "StopIntegration"]}, 
    t, {s, 0, 2*Pi + NIntegrate[Norm[g'[t]], {t, 0, 2*Pi}]}];

    l = NIntegrate[Norm[D[g[t], t]], {t, 0, 2*Pi}]
    c1[s_] := g[tfn[s]]
    j[s_] := Normalize[Cross[D[c1[s], s], D[D[c1[s], s], s]]]
    v[s_] := Normalize[Cross[j[s], Normalize[D[c1[s], s]]]]

I think the problem is with the func part.

Thank you.

$\endgroup$
6
  • $\begingroup$ The problem, seems, lies in the definition of the functions j[s] and v[s] . as well as in the fact that c1[s] yields a list of functions, rather than a single one. One can make sure by direct plotting them. After that is fixed, in the definition of the table for the interpolation function try this: Table[{s,T2[s, y]}, {s, 0, 250, 0.1}] . $\endgroup$ May 29 '15 at 12:26
  • $\begingroup$ j and v are vector functions, while when I plot c1, it seems OK to me. i.imgur.com/liwvzZI.png $\endgroup$
    – thedude
    May 29 '15 at 12:29
  • $\begingroup$ ParametricPlot3D[Evaluate@T2[s, y], {p, 0, l}, PlotPoints -> 1000] i.imgur.com/5H9EIqn.png $\endgroup$
    – thedude
    May 29 '15 at 13:05
  • $\begingroup$ This is your third or so question about the same problem and I believe your main issue is clarity. Think a little further about the math and the function definitions and try to make them easier to understand (for you and others). Just as an example, you don't need two Normalize[ ]s on the v[s_] definition. $\endgroup$ May 29 '15 at 13:24
  • $\begingroup$ Also, a curve is a one-dimensional variety (mostly) so for example the reason of using two parameters to describe it should be stated $\endgroup$ May 29 '15 at 13:34
2
$\begingroup$

As I already said in the comments to your question I believe the functions aren't clear enough. Anyway perhaps something like this may help:

a = 5
g[t_] := {-(a + 3*Cos[6*t])*Sin[7*t], (a + 3*Cos[6*t])*Cos[7*t], 3*Sin[6*t]}
l = NIntegrate[Norm[g'[t]], {t, 0, 2*Pi}]
tfn = NDSolveValue[{t'[s] == 1/Norm[g'[t[s]]], t[0] == 0}, t, {s, 0, l}];
c1[s_] := g[tfn[s]]
j[s_] := Normalize[Cross[c1'[s], c1''[s]]]
v[s_] := Normalize[Cross[j[s], c1'[s]]]
T2[s_] := c1[s] + 0.1*(j[s]*Sin[5 Pi s] - v[s]*Cos[5 Pi s])
tab = Table[{s, T2[s]}, {s, 0, l, .05}];

fns = Interpolation /@ Transpose[tab /. {t_, {x_, y_, z_}} -> {{t, x}, {t, y}, {t, z}}]

ParametricPlot3D[Through[fns[x]], {x, 0, l}, PlotPoints -> 30 IntegerPart@l]

Mathematica graphics

$\endgroup$
0

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