0
$\begingroup$

When I run below code the calculation of animation are aborted and in the animation window is visible the information "$Aborted". Why?

r[u_, v_] := { u + Cos[v], u - Sin[v], u };
vM = Pi/2;
uconr = r[u, vM];
uM = 1;
vconr = r[uM, v];
ru = D[r[u, v], u];
rv = D[r[u, v], v];
crs = Cross[ru, rv];
rNunit = crs/Sqrt[crs.crs];
rV = ParametricPlot3D[r[u, v], {u, -2 Pi, 2 Pi}, {v, 0, 2 Pi}];
uconrV = ParametricPlot3D[uconr, {u, -Pi, Pi}, PlotStyle -> Magenta];
vconrV = ParametricPlot3D[vconr, {v, 0, 2 Pi}, PlotStyle -> Cyan];
runorm = Sqrt[ru.ru] /. u -> uM /. v -> vM;
rvnorm = Sqrt[rv.rv] /. u -> uM /. v -> vM;
rNunitScale = 2.5;
rNV = Graphics3D[{Red, 
    Arrow[{r[uM, 
       vM], (r[uM, vM] + (rNunit /. u -> uM /. v -> vM)*
         rNunitScale)}]}];
opV = ParametricPlot3D[(r[u, v] + s*(ru + rv) + 
       k*Cross[ru + rv, rNunit]) /. u -> uM /. v -> vM, {s, -3, 
    3}, {k, -3, 3}, PlotStyle -> Directive[Opacity[0.7], Green], 
   Mesh -> None];


Show[{rV, uconrV, vconrV, rNV, opV}, 
 PlotRange -> {{-5, 5}, {-5, 5}, {-3, 3}}, 
 BaseStyle -> {FontSize -> 12, FontFamily -> "Verdena"}, 
 Axes -> True, AxesLabel -> {x, y, z}, Ticks -> Automatic, 
 AxesStyle -> {Red, Green, Blue}, 
 PlotLabel -> 
  Style[Framed["Wektor normalny i płaszczyzna styczna do powierzchni",
     FrameStyle -> Red], 13, Darker[Blue, .6], 
   Background -> Lighter[LightYellow]], 
 BaseStyle -> {FontSize -> 12, FontFamily -> "Verdena"}, 
 AspectRatio -> 1]


uconrA[v0_] := 
  ParametricPlot3D[r[u, v0], {u, -Pi, Pi}, PlotStyle -> Magenta];
vconrA[u0_] := 
  ParametricPlot3D[r[u0, v], {v, 0, 2 Pi}, PlotStyle -> Cyan];
rNA[u0_, v0_] := 
  Graphics3D[{Red, 
    Arrow[{r[u0, 
       v0], (r[u0, v0] + (rNunit /. u -> u0 /. v -> v0)*
         rNunitScale)}]}];
opA[u0_, v0_] := 
  ParametricPlot3D[(r[u, v] + s*(ru + rv) + 
       k*Cross[ru + rv, rNunit]) /. u -> u0 /. v -> v0, {s, -1, 
    1}, {k, -1, 1}, PlotStyle -> Directive[Opacity[0.7], Green], 
   Mesh -> None]; 

Animate[Show[{rV, uconrA[v0], vconrA[u0], rNA[u0, v0], opA[u0, v0]}, 
  PlotRange -> {{-5, 5}, {-5, 5}, {-3, 3}}, 
  BaseStyle -> {FontSize -> 12, FontFamily -> "Verdena"}, 
  Axes -> True, AxesLabel -> {x, y, z}, Ticks -> Automatic, 
  AxesStyle -> {Red, Green, Blue}, 
  PlotLabel -> 
   Style[Framed[
     "Wektor normalny i płaszczyzna styczna do powierzchni", 
     FrameStyle -> Red], 13, Darker[Blue, .6], 
    Background -> Lighter[LightYellow]], 
  BaseStyle -> {FontSize -> 12, FontFamily -> "Verdena"}, 
  AspectRatio -> 1], {v0, 0, 2 Pi}, {u0, -3.1, 3.1}, 
 AnimationRunning -> False]

When I run upper code the calculation of animation are aborted and in the animation window is visible the information "$Aborted". Why?

I am asking everyone to check the above code again. During this edition in the Animation code I added the element opA [u0, v0] which before I forgot to insert, for which I am sorry and this is the element of the code that causes the problem.

$\endgroup$
  • 1
    $\begingroup$ Most likely because it took too long to finish, see reference.wolfram.com/language/ref/SynchronousUpdating.html $\endgroup$ – Kuba Mar 1 '18 at 22:08
  • $\begingroup$ It works without problems on my machine (Mathematica 11.0.1 for macos). Try to refresh the kernel (e.g. with Exit) and try again. $\endgroup$ – Henrik Schumacher Mar 1 '18 at 22:44
  • $\begingroup$ I am asking everyone to check the above code again. During this edition in the Animation code I added the element opA [u0, v0] which before I forgot to insert, for which I am sorry and this is the element of the code that causes the problem. $\endgroup$ – SIJA Mar 2 '18 at 14:38
2
$\begingroup$

Here's the solution to my problem. Note that the vector

(r[u, v] + s*(ru + rv) + k*Cross[ru + rv, rNunit])

it's a complicated and time-consuming calculation. Therefore, it is necessary to calculate the calculations before it is put - as a result of the calculation - into the function opA [u0_, v0_].

So we mark calcv = (r[u, v] + s*(ru + rv) + k*Cross[ru + rv, rNunit]); and put the calcv into the function opA [u0_, v0_].

Now we can do all the code in the notebook without fear that something will go wrong.

This is an instructive example that complicated and time-consuming calculations, which will be performed repeatedly, should be performed once, and the result obtained in such a way should be substituted in a place where it will be used many times!

$\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.