Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.soft-sys.math.mathematica > #12669 > unrolled thread

tubes program not working in version 9

Started byRoger Bagula <roger.bagula@gmail.com>
First post2012-12-07 06:37 +0000
Last post2012-12-10 04:32 +0000
Articles 4 — 2 participants

Back to article view | Back to comp.soft-sys.math.mathematica


Contents

  tubes program not working in version 9 Roger Bagula <roger.bagula@gmail.com> - 2012-12-07 06:37 +0000
    Re: tubes program not working in version 9 "Nasser M. Abbasi" <nma@12000.org> - 2012-12-08 06:28 +0000
      Re: tubes program not working in version 9 Roger Bagula <roger.bagula@gmail.com> - 2012-12-10 04:29 +0000
      Re: tubes program not working in version 9 Roger Bagula <roger.bagula@gmail.com> - 2012-12-10 04:32 +0000

#12669 — tubes program not working in version 9

FromRoger Bagula <roger.bagula@gmail.com>
Date2012-12-07 06:37 +0000
Subjecttubes program not working in version 9
Message-ID<k9s2rq$mp9$1@smc.vnet.net>
The problem seems to be sometimes it works but mostly it doesn't.
The tubes program was written for an earlier version 
( works in version 5 I think) by Mark McClure
and has worked fine for literally years.
I haven't got a clue what has gone wrong.
( technically these are called channel surfaces or the like).

TubePlotFrenet[curve_List, {var_, min_, max_}, radius_, opts___] := 
 Module[{tangent, unitTangent, normal, unitNormal, biNormal}, 
  tangent = D[curve, t];
  unitTangent = tangent/Sqrt[tangent.tangent];
  normal = D[unitTangent, t];
  unitNormal = normal/Sqrt[normal.normal];
  biNormal = Cross[unitTangent, unitNormal];
  ParametricPlot3D[
   curve + radius Cos[s] unitNormal + radius Sin[s] biNormal // 
    Evaluate, {var, min, max}, {s, 0, 2 \[Pi]}, opts]]

r = Cos[q0*t] + 2;
x = r* Cos[p0*t];
y = r *Sin[p0*t];
z = Sin[q0*t];
w0 = 8*{x, y, z}
h = TubePlotFrenet[w0, {t, 0, 2 \[Pi]}, 1, Axes -> None, 
  Boxed -> False, PlotPoints -> {64, 16}, 
  ColorFunction -> "CandyColors", MeshFunctions -> {#3 &}]

My other tubes program which came from an answer in this group
still works.

[toc] | [next] | [standalone]


#12691

From"Nasser M. Abbasi" <nma@12000.org>
Date2012-12-08 06:28 +0000
Message-ID<k9umn6$sio$1@smc.vnet.net>
In reply to#12669
On 12/7/2012 12:37 AM, Roger Bagula wrote:
> The problem seems to be sometimes it works but mostly it doesn't.
> The tubes program was written for an earlier version
> ( works in version 5 I think) by Mark McClure
> and has worked fine for literally years.
> I haven't got a clue what has gone wrong.
> ( technically these are called channel surfaces or the like).
>
> TubePlotFrenet[curve_List, {var_, min_, max_}, radius_, opts___] :=
>   Module[{tangent, unitTangent, normal, unitNormal, biNormal},
>    tangent = D[curve, t];
>    unitTangent = tangent/Sqrt[tangent.tangent];
>    normal = D[unitTangent, t];
>    unitNormal = normal/Sqrt[normal.normal];
>    biNormal = Cross[unitTangent, unitNormal];
>    ParametricPlot3D[
>     curve + radius Cos[s] unitNormal + radius Sin[s] biNormal //
>      Evaluate, {var, min, max}, {s, 0, 2 \[Pi]}, opts]]
>
> r = Cos[q0*t] + 2;
> x = r* Cos[p0*t];
> y = r *Sin[p0*t];
> z = Sin[q0*t];
> w0 = 8*{x, y, z}
> h = TubePlotFrenet[w0, {t, 0, 2 \[Pi]}, 1, Axes -> None,
>    Boxed -> False, PlotPoints -> {64, 16},
>    ColorFunction -> "CandyColors", MeshFunctions -> {#3 &}]
>
> My other tubes program which came from an answer in this group
> still works.
>


Noticed few problems:

     tangent = D[curve, t];

when it should be

     tangent = D[curve, var];

after all, var is the independent variable symbol being passed
and is the one build in.

Also, there are no numerical values for the q0 and p0.
When I wrote

p0=1; q0=1; and fixed the above issue with var vs. t,
then it worked.


--Nasser


[toc] | [prev] | [next] | [standalone]


#12719

FromRoger Bagula <roger.bagula@gmail.com>
Date2012-12-10 04:29 +0000
Message-ID<ka3og0$apc$1@smc.vnet.net>
In reply to#12691
I'm also having trouble with merge cells which erased the {p0,q0} on pasting:
This solution is due to an email from an old friend who is very modest:
TubePlotFrenet2[curve_List, {var_, min_, max_}, radius_, opts___] := 
 Module[{tangent, unitTangent, normal, unitNormal, biNormal}, 
  tangent = D[curve, t] // Simplify;
  unitTangent = tangent/Sqrt[tangent.tangent] // Simplify;
  normal = D[unitTangent, t] // Simplify;
  unitNormal = normal/Sqrt[normal.normal] // Simplify;
  biNormal = Cross[unitTangent, unitNormal] // Simplify;
  ParametricPlot3D[
   curve + radius Cos[s] unitNormal + radius Sin[s] biNormal // 
    Evaluate, {var, min, max}, {s, 0, 2 \[Pi]}, opts]]

h = TubePlotFrenet2[{Cos[2 t] (2 + Cos[5 t] Sin[5 t]), 
   Sin[2 t] (2 + Cos[5 t] Sin[5 t]), -Sin[5 t]}, {t, 0, 2 \[Pi]}, 1/5,
   Axes -> None, Boxed -> False, PlotPoints -> {64, 16}, 
  ColorFunction -> "CandyColors", MeshFunctions -> {#3 &}]

I haven't tried the ver for t solution yet:
this one is much slower.
On Friday, December 7, 2012 10:28:54 PM UTC-8, Nasser M. Abbasi wrote:
 
> p0=1; q0=1; and fixed the above issue with var vs. t,
> 
> then it worked.
> 
> 
> 
> 
> 
> --Nasser

[toc] | [prev] | [next] | [standalone]


#12736

FromRoger Bagula <roger.bagula@gmail.com>
Date2012-12-10 04:32 +0000
Message-ID<ka3ok5$art$1@smc.vnet.net>
In reply to#12691
I'm also having trouble with merge cells which erased the {p0,q0} on pasting:
This solution is due to an email from an old friend who is very modest:
TubePlotFrenet2[curve_List, {var_, min_, max_}, radius_, opts___] := 
 Module[{tangent, unitTangent, normal, unitNormal, biNormal}, 
  tangent = D[curve, t] // Simplify;
  unitTangent = tangent/Sqrt[tangent.tangent] // Simplify;
  normal = D[unitTangent, t] // Simplify;
  unitNormal = normal/Sqrt[normal.normal] // Simplify;
  biNormal = Cross[unitTangent, unitNormal] // Simplify;
  ParametricPlot3D[
   curve + radius Cos[s] unitNormal + radius Sin[s] biNormal // 
    Evaluate, {var, min, max}, {s, 0, 2 \[Pi]}, opts]]

h = TubePlotFrenet2[{Cos[2 t] (2 + Cos[5 t] Sin[5 t]), 
   Sin[2 t] (2 + Cos[5 t] Sin[5 t]), -Sin[5 t]}, {t, 0, 2 \[Pi]}, 1/5,
   Axes -> None, Boxed -> False, PlotPoints -> {64, 16}, 
  ColorFunction -> "CandyColors", MeshFunctions -> {#3 &}]

I haven't tried the ver for t solution yet:
this one is much slower.
On Friday, December 7, 2012 10:28:54 PM UTC-8, Nasser M. Abbasi wrote:
 
> p0=1; q0=1; and fixed the above issue with var vs. t,
> 
> then it worked.
> 
> 
> 
> 
> 
> --Nasser

[toc] | [prev] | [standalone]


Back to top | Article view | comp.soft-sys.math.mathematica


csiph-web