Subject: Re: Help: shift+enter doesn't give me any output suddenly! Are u using Linux? Than this is a known issue and u can look it up at wolfram.com Cyx >Very disturbing! Start a new session. Try anything simple, like 3 >shift-enter. Don't write a semicolon after the 3. You should now have >this input cell with a cell label, like >In[1]:= 3 >An output cell should appear immediately below with a cell label: >Out[1]= 3 >If you don't get this, you're in deep trouble. Please attach the notebook >and send me a mail. >Original Message: >--- === >Subject: Help: shift+enter doesn't give me any output suddenly! >I am a beginner. shift+enter doesn't give me any output at notebook >suddenly! >after I restart the program, it doesn't work either. === Subject: Re: Partitioning a list into unequal partitions For what it's worth, here's my way: UnevenPartition::usage = UnevenPartition[list, lengths] returns the list partitioned into groups with the specified successive lengths. UnevenPartition[list_, lengths_] := First@Fold[Regroup, {{}, list}, lengths] Regroup[{a_, b_}, n_] := {Append[a, Take[b, n]], Drop[b, n]} UnevenPartition[Range[10], Range[4]] --Mark. > Could someone please show me a simple (non-procedural) way of partitioning a > list into 1,2,3 ... n disjoint sublists, where the length of the list is > guaranteed to be correct (i.e. n*(n+1)/2) > I can't see a way, and yet I'm sure there *must* be a one-liner using Fold. > Mark R. Diamond === Subject: Re: Simplify using custom function > What I'm trying to achieve is to find a certain function in a more > complicated expression: > example: complicated expression: -1+2 x +2 e^x > function: f[x_]=x+e^x > Mathematica should return: -1+2 f[x] > I've been looking at TransformationFunctions and FullSimplify, but did > not succeed in defining a transformation function so far. How do I do > that? (It's Mathematica 5.0) > First of all, your problem is not well defined since the answer is not unique. There are obviously infinitely many ways to find a certain function in a more complicated expression. But, assuming that the expression you are looking for is a polynomial in your function, in cases like your example it can be done with PolynomialReduce:: Last[PolynomialReduce[-1+2 x+2 E^x,f[x]-x-E^x]] -1+2 f[x] Andrzej Kozlowski Chiba, Japan http://www.mimuw.edu.pl/~akoz/ === Subject: Re: Simplify using custom function expr=-1+2 x+2 E^x; expr /. E^x -> f[x]-x // Simplify 2 f(x)-1 However, f[x] cannot be defined or you will be back at expression. Bob Hanlon === > Subject: Simplify using custom function > What I'm trying to achieve is to find a certain function in a more > complicated expression: > example: complicated expression: -1+2 x +2 e^x > function: f[x_]=x+e^x > Mathematica should return: -1+2 f[x] > I've been looking at TransformationFunctions and FullSimplify, but did > not succeed in defining a transformation function so far. How do I do > that? (It's Mathematica 5.0) > === Subject: RE: Dashing option and Plot Jose, Plot[Sin[x], {x, 0, Pi}, PlotStyle -> AbsoluteDashing[{4}]] or Plot[Sin[x], {x, 0, Pi}, PlotStyle -> Dashing[{0.02}]] In order to more fully control the look of a plot it is necessary to use the various plot or Graphics options. Some of the options, such as PlotStyle for curves control the rendering of the curve itself, and other options, such as Axes, AxesLabel, Frame, FrameLabel, Ticks or FrameTicks, PlotLabel, AspectRatio, ImageSize and Background control the overall look of the plot. David Park djmp@earthlink.net http://home.earthlink.net/~djmp/ Hello! Can I use Dashing directly with Plot? How can I plot a dashed plot? For example, if I want to plot y=Sin[x], {x,0,Pi} completely === Subject: Re: Fitting a Cylinder to 3D data points I have sent you separately a full notebook with worked examples and graphics. Too large for this group, but others might also find it interesting. So below is a version of the notebook with all output removed. Tom Burton CreatedBy='Mathematica 5.0' Mathematica-Compatible Notebook This notebook can be used with any Mathematica-compatible application, such as Mathematica, MathReader or Publicon. The data for the notebook starts with the line containing stars above. To get the notebook into a Mathematica-compatible application, do one of the following: * Save the data starting with the line of stars above into a file with a name ending in .nb, then open the file inside the application; * Copy the data starting with the line of stars above to the clipboard, then use the Paste menu command inside the application. Data for notebooks contains only printable 7-bit ASCII and can be sent directly in email or through ftp in text mode. Newlines can be CR, LF or CRLF (Unix, Macintosh or MS-DOS style). NOTE: If you modify the data for this notebook not in a Mathematica- compatible application, you must delete the line below containing the word CacheID, otherwise Mathematica-compatible applications may try to use invalid cache data. For more information on notebooks and Mathematica-compatible applications, contact Wolfram Research: web: http://www.wolfram.com email: info@wolfram.com phone: +1-217-398-0700 (U.S.) Notebook reader applications are available free of charge from Wolfram Research. *******************************************************************) (*CacheID: 232*) (*NotebookFileLineBreakTest NotebookFileLineBreakTest*) (*NotebookOptionsPosition[ 106074, 3405]*) (*NotebookOutlinePosition[ 135173, 4465]*) (* CellTagsIndexPosition[ 134889, 4453]*) (*WindowFrame->Normal*) Notebook[{ Cell[CellGroupData[{ Cell[FitCylinder, Title], Cell[Fitted approximations to cylinders, Subtitle], Cell[TextData[{ Prepared by Tom Burton, , ButtonBox[Brahea, ButtonData:>{ URL[ http://www.brahea.com], None}, ButtonStyle->Hyperlink], , Inc. }], Subsubtitle, ShowGroupOpenCloseIcon->False], Cell[TextData[{ All closed and most open cylinders can be fitted by the function , ButtonBox[fitCylinder, ButtonData:>s.fitCylinder, ButtonStyle->Hyperlink], . If the user requests a fit to an open cylinder, this function tests first for flatness. If the points fall nearly onto a plane, the control is passed to the function , ButtonBox[fitSlightlyCurved, ButtonData:>s.fitSlightlyCurved, ButtonStyle->Hyperlink], . }], Text], Cell[< These functions do not accept a cloud of points. Rather, they accept a particular geometrical description as described in the Development sections of each function. You should be able to adjust the functions to accept clouds of points. >, Text], Cell[< These functions also determine the length and width of an equivalent rectangle. These portions code, written for a specific application not related to fitting the cylinder, can be ignored for this purpose. >, Text, PageWidth->WindowWidth], Cell[CellGroupData[{ Cell[Common messages, Section, PageWidth->WindowWidth, CellTags->hide], Cell[BoxData[ (ShrinkWrapBoundingBox)], Input], Cell[BoxData[ ((fitSmooth:: = ;))], Input, PageWidth->WindowWidth, InitializationCell->True], Cell[BoxData[ ((fitSmooth:: = ;))], Input, PageWidth->WindowWidth, InitializationCell->True], Cell[BoxData[ ((fitSmooth:: = ;))], Input, PageWidth->WindowWidth, InitializationCell->True], Cell[BoxData[ ((fitSmooth:: = ;))], Input, PageWidth->WindowWidth, InitializationCell->True], Cell[TextData[{ These messages are accompanied by a , StyleBox[Throw, FontFamily->Courier], of their parameters. Most should be intercepted by the front end for action by the user. When issued by , StyleBox[fitPlate, FontFamily->Courier], , however, the last message is often suppressed and its parameters caught by , StyleBox[fitCylinder, FontFamily->Courier], or , StyleBox[fitSpheroidalCap, FontFamily->Courier], . }], Text, PageWidth->WindowWidth], Cell[BoxData[ ((fitSmooth::notyet = ;))], Input, InitializationCell->True], Cell[CellGroupData[{ Cell[Common usage fragments:, Subsection], Cell[BoxData[{ ((fitOptions = ;)), n, (tt)}], Input, InitializationCell->True] }, Open ]] }, Closed]], Cell[CellGroupData[{ Cell[Basis functions, Section], Cell[TextData[{ The coordinate system is uniquely is by the directions of two of its three basis vectors {, x, ,, y, ,, z, }. The basis is a matrix whose , rows, are the three basis vectors.The function , basis, accepts one or two unnormalized vectors representing , x, , , y, , or , z, . If two of these are provided but are colineaer and therefore cannot form a basis, then the global basis , Cell[BoxData[ RowBox[{(, GridBox[{ {1, 0, 0}, {0, 1, 0}, {0, 0, 1} }], )}]]], is returned. There are also special forms defined below. }], Text], Cell[CellGroupData[{ Cell[Usage and messages, Subsection], Cell[BoxData[ ((basis:: = ;))], Input, InitializationCell->True], Cell[TextData[{ These routines write the three basis vectors of a coordinates system into the , StyleBox[rows, FontSlant->Italic], of a basis matrix, using a convention compatible with the transformations defined in this notebook. Row-matrices are more convenient in , StyleBox[Mathematica, FontSlant->Italic], than column matrices, because , StyleBox[Mathematica, FontSlant->Italic], stores matrix by rows. Convential mathematical notation, however, is to write these basis vectors into the , StyleBox[columns, FontSlant->Italic], of the matrix. Beware. }], Text], Cell[BoxData[ ((basis::parallel = <`1`-vector `2` is parallel to `3`-vector `4`. The basis cannot be formed.>;))], Input, InitializationCell->True], Cell[BoxData[ ((basis::short = <`1`-vector `2` or `3`-vector `4` has zero length. The basis cannot be formed.>;))], Input, InitializationCell->True] }, Closed]], Cell[CellGroupData[{ Cell[General basis function, Subsection, Evaluatable->False], Cell[TextData[{ This function returns a , StyleBox[row-matrix, FontSlant->Italic], of orthonormal vectors based on input vectors local_x and local_y. Local_z is constructed. }], Text, Evaluatable->False], Cell[CellGroupData[{ Cell[Code, Subsubsection], Cell[< v. 030 (7/24/96) Force numerical return (// N) v. 057 (1/9/98) Abort on exception >, Text, Evaluatable->False, FontFamily->Times New Roman, FontSize->11, FontWeight->Plain, FontSlant->Plain, FontTracking->Plain, FontColor->GrayLevel[0], Background->GrayLevel[1], FontVariations->{Underline->False, Outline->False, Shadow->False}], Cell[BoxData[ (basis[a_List, b_List] := Module[{anorm, bo, bnorm}, nttIf[ a . a b . b == 0, ntttMessage[basis::short, , a, , b]; ntttAbort[]ntt]; nttIf[ a[Cross]b . a[Cross]b == 0, ntttMessage[ basis::parallel, , a, , b]; ntttAbort[]ntt]; nttanorm = a/@(a . a); bo = b - anorm anorm . b; bnorm = bo/@(bo . bo); N[{anorm, bnorm, anorm[Cross]bnorm}]])], Input, InitializationCell->True, FontFamily->Courier New, FontWeight->Bold, FontColor->GrayLevel[0], Background->GrayLevel[1]] }, Open ]], Cell[CellGroupData[{ Cell[Local tests, Subsubsection], Cell[< basis[{0,0,0},{0,0,1}] basis[{0,0,1},{0,0,2}] basis[{0,1,2},{1,2,3}] >, Input, FontFamily->Courier New, FontWeight->Bold, FontColor->GrayLevel[0], Background->GrayLevel[1]] }, Closed]] }, Open ]], Cell[CellGroupData[{ Cell[Axisymmetric beam or isotropic plate, Subsection], Cell[< First case, basis function to orient an isotropic beam. The vector connects end 1 to end 2 and is assumed to define the beam's third principle direction. The other two are arbitrary. Also used to orient a curved connector. >, Text, Evaluatable->False, FontFamily->Times New Roman, FontSize->11, FontWeight->Plain, FontSlant->Plain, FontTracking->Plain, FontColor->GrayLevel[0], Background->GrayLevel[1], FontVariations->{Underline->False, Outline->False, Shadow->False}], Cell[CellGroupData[{ Cell[Code, Subsubsection], Cell[TextData[{ v. 030 (7/24/96) Force numerical return (// N)nv. 057 (1/8/98) Abort on an exceptionnv. 083 (12/16/98) Change criterion for , StyleBox[c, Input], being close to parallel to , StyleBox[b, Input] }], Text], Cell[< basis[c_List] := Module[{cnorm, b={0,1,0}, a}, If[c.c==0, Message[basis::short,Z,c,(NA),]; Abort[] ]; cnorm=c/Sqrt[c.c]; (* Assign the second basis vector to {0,1,0} unless that is too close to being parallel to c *) If[ Abs[cnorm.b] > 0.7, b = {1,0,0} ]; b = b - cnorm cnorm.b; (* orthogonalize b w.r.t. c *) b = b/Sqrt[b.b]; a = b[Cross]cnorm; {a, b, cnorm} // N ] >, Input, InitializationCell->True, FontFamily->Courier New, FontWeight->Bold, FontColor->GrayLevel[0], Background->GrayLevel[1]] }, Open ]], Cell[CellGroupData[{ Cell[Local tests, Subsubsection], Cell[< basis[{0,0,0}] basis[{0,0,10}] basis[{0,10,0}] basis[{0,-1.5,0}] basis[{3,2,1}] >, Input, FontFamily->Courier New, FontSize->10, FontWeight->Bold, FontColor->GrayLevel[0], Background->GrayLevel[1]], Cell[BoxData[ (monitorReset[])], Input] }, Open ]] }, Open ]], Cell[CellGroupData[{ Cell[Orthotropic beam basis functions, Subsection], Cell[< Second case, orthotropic beam. This function is also used by the orthotropic plate, specified by first material direction and plate normal direction. >, Text], Cell[TextData[{ The third principal direction of the beam is assumed to align with vector , StyleBox[c, FontSlant->Italic], . Vector a points in the first principal direction. It will be orthogonalized against , StyleBox[c, FontSlant->Italic], just be sure. }], Text], Cell[CellGroupData[{ Cell[Code, Subsubsection], Cell[< v. 030 (7/24/96) Force numerical return (// N) v. 055 (9/21/97) Orthogonalize a w.r.t. c instead of c w.r.t a v. 057 (1/8/98) Abort on exceptions >, Text], Cell[BoxData[ (basis[a_List, 0, c_List] := Module[{anorm, b, ao, cnorm}, nttIf[ a . a c . c == 0, nttt Message[ basis::, , a, , c]; ntttAbort[]ntt]; nttIf[ a[Cross]c == {0, 0, 0}, nttt Message[ basis::, , a, , c]; ntttAbort[]ntt]; nttcnorm = c/@(c . c); ao = a - cnorm cnorm . a; anorm = ao/@(ao . ao); b = cnorm[Cross]anorm; N[{anorm, b, cnorm}]])], Input, InitializationCell->True], Cell[< v. 057 (12/24/97) new function v. 057 (1/8/98) Abort on exceptions >, Text], Cell[BoxData[ (basis[0, b_List, c_List] := Module[{a, bnorm, bo, cnorm}, nttIf[ b . b c . c == 0, ntttMessage[ basis::, , b, , c]; ntttAbort[]ntt]; nttIf[ b[Cross]c == {0, 0, 0}, ntttMessage[ basis::, , b, , c]; ntttAbort[]ntt]; nttcnorm = c/@(c . c); bo = b - cnorm cnorm . b; bnorm = bo/@(bo . bo); a = bnorm[Cross]cnorm; N[{a, bnorm, cnorm}]])], Input, InitializationCell->True] }, Open ]], Cell[CellGroupData[{ Cell[Local tests, Subsubsection], Cell[< basis[{0,0,3},0,{0,0,0}] basis[{0,0,0},0,{0,0,4}] basis[{0,0,3},0,{0,4,100}] basis[{3,0,0},0,{3,0,1}] basis[{0,0,3},0,{100,4,0}] >, Input], Cell[< basis[0,{0,0,3},{0,0,2}] basis[0,{0,0,0},{0,0,4}] basis[0,{0,0,3},{0,4,100}] basis[0,{3,0,0},{3,0,1}] basis[0,{0,0,3},{100,4,0}] >, Input] }, Closed]] }, Open ]], Cell[CellGroupData[{ Cell[Basis of a line segment, Subsection], Cell[TextData[{ The general shape of a line junction is a piecewise-straight line in 3-space. The local , StyleBox[x, FontSlant->Italic], -axes of one straight segment of a line junction and all of its connections are aligned with each other and with the segment itself. The , StyleBox[AutoSEA, FontSlant->Italic], engine characterizes the orientation of a segment of a line connection in terms of the angle [Beta] that the local , StyleBox[y, FontSlant->Italic], -axis of the connection's segment makes with that of the junction's segment. Then the orientation of the connection as a whole is the average of [Beta] over the connection, weighted by arclength. (Look , ButtonBox[here, ButtonData:>{Globals.nb, cxn basis}, ButtonStyle->Hyperlink], for futher details.) This approach requires that the local basis of every segment of every line junction be uniquely defined. This section lays out one such definition. Other possible definitions would yield the same results, provided that they are also unique. }], Text], Cell[TextData[{ The local row-basis {, StyleBox[X, FontWeight->Bold], , , StyleBox[Y, FontWeight->Bold], , , StyleBox[Z, FontWeight->Bold], } of a straight segment of line junction will be unique if it is defined unambiquously in relation to a single global row-basis {Xg,Yg, Zg}. Without loss of generality, we can choose {Xg,Yg, Zg}=, Cell[BoxData[ RowBox[{(, GridBox[{ {1, 0, 0}, {0, 1, 0}, {0, 0, 1} }], )}]]], . Note that , StyleBox[X, FontWeight->Bold], is fixed; only , StyleBox[Y, FontWeight->Bold], and , StyleBox[Z, FontWeight->Bold], need be determined. Then here is the unique definition that we have chosen: }], Text], Cell[CellGroupData[{ Cell[Usage, Subsubsection], Cell[BoxData[ ((basisLine:: = ;))], Input, InitializationCell->True] }, Open ]], Cell[CellGroupData[{ Cell[Code, Subsubsection], Cell[v. 057 (12/13/97) new function, Text], Cell[BoxData[ RowBox[{ RowBox[{basisLine, =, RowBox[{Compile, [, RowBox[{({{a, _Real, 1}}), ,, RowBox[{Module, [, RowBox[{({X = a/@(a . a), Xg, Yg, Zg, b, c, bb, cc}), ,, n, tt, RowBox[{ RowBox[{({Xg, Yg, Zg}), =, RowBox[{(, GridBox[{ {1, 0, 0}, {0, 1, 0}, {0, 0, 1} }], )}]}], ;, (b = Zg[Cross]X), ;, (c = X[Cross]Yg), ;, (bb = b . b), ;, (cc = c . c), ;, n, tt, (If[bb > cc, ntttY = b/@bb; Z = X[Cross]Y, ntttZ = c/@cc; Y = Z[Cross]Xntt]), ;, n, tt, ({X, Y, Z})}]}], n, t, ]}]}], ]}]}], ;}]], Input, InitializationCell->True], Cell[< Here are four pictures showing the bases generated for sequences of line arranged in circles of four different orientations. Bases are represented by trials with {black, red, blue} representing {X,Y,Z}. Note that, in each case, the black lines (X vectors) form a circle. >, Text], Cell[BoxData[ RowBox[{ RowBox[{Show, [, RowBox[{ RowBox[{GraphicsArray, [, n, tt, RowBox[{Apply, [, n, ttt, RowBox[{(With[{pts = Partition[ Table[#1 Cos[[Theta] Degree] + #2 Sin[ [Theta] Degree], {[Theta], 0. , 360. , 20. }], 2, 1]}, nttttWith[{d = (0.6 @( # . #) &)[pts[LeftDoubleBracket]1, 2[RightDoubleBracket] - pts[LeftDoubleBracket]1, 1[RightDoubleBracket]]}, nttttt Graphics3D[Function[{pq}, {p, q} = pq; ntttttttTranspose[{{black, red, blue}, (Line[{p, p + d #}] &) /@ basisLine[q - p]}]] /@ pts]]] &), ,, n, ttt, RowBox[{(, GridBox[{ {({{1, 0, 0}, {0, 1, 0}}), ({{0, 1, 0}, {0, 0, 1}})}, {({{0, 0, 1}, {1, 0, 0}}), ({{1, 1, 1}, {1, 0, (-1)}})} }], )}], ,, n, ttt, ({2})}], ]}], ]}], ,, n, t, (ImageSize [Rule] {500, 400})}], ]}], ;}]], Input], Cell[< In the left-hand pair of diagrams, the triad moves smoothly around the circle. But in the right-hand pair, the trial rotates abruptly. This kind of abrupt rotation is hard to or impossible to avoid in general, but is acceptable if it happens consistently and repeatably. >, Text] }, Open ]] }, Closed]] }, Closed]], Cell[CellGroupData[{ Cell[Utilities, Section], Cell[CellGroupData[{ Cell[Fit a circle or arc, Subsection], Cell[Ths algorithm is copied from Phil Shorter's write-up, Text], Cell[CellGroupData[{ Cell[Development, Subsubsection], Cell[< Create a short arc, subtending only 0.1 radians, with some random noise added: >, Text], Cell[BoxData[{ ((SeedRandom[13635];)), n, (With[{r = 2.5, [Theta]max = 0.1}, nt pts = Table[ 0.001 {Random[], Random[]} + r {Cos[[Theta]], Sin[[Theta]]}, {[Theta], 0, [Theta]max, [Theta]max/10}]nt])}], Input], Cell[Andrew's standard set of points:, Text, CellFrame->True, Background->GrayLevel[0.849989]], Cell[BoxData[ (((pts = Apply[List, {ntttCCoord2[2.500808187077034, 0.000409525514320146921], n CCoord2[ 2.50026966411025508, 0.0259292878483009303], n CCoord2[ 2.50042472482903033, 0.0508763415574513366], n CCoord2[ 2.49910906111301711, 0.0752985655492096661], n CCoord2[ 2.49864696034605238, 0.100355640101474574], n CCoord2[ 2.49786166694523803, 0.125264329212367719], n CCoord2[ 2.49609194124531175, 0.150305018311495768], n CCoord2[ 2.494713634521176, 0.175452784976034914], n CCoord2[ 2.49224330793735049, 0.200644989029249565], n CCoord2[ 2.49013568036344823, 0.224734495163988201], n CCoord2[ 2.48800283087653806, 0.250381842081321881]ntt}, 1])(n) ))], Input, CellFrame->True, FontSize->10, Background->GrayLevel[0.849989]], Cell[Expand each coordinate pair into the biquadratric form:, Text], Cell[BoxData[ (P = pts /. {x_, y_} [RuleDelayed] {x^2 + y^2, x, y, 1})], Input], Cell[Form the inverse of the matrix of constraint:, Text], Cell[BoxData[ RowBox[{ RowBox[{CC, =, RowBox[{(, GridBox[{ {0, 0, 0, (1/2)}, {0, (-(1/4)), 0, 0}, {0, 0, (-(1/4)), 0}, {(1/2), 0, 0, 0} }], )}]}], ;}]], Input], Cell[To save inverting this matrix at run time, we invert it now:, Text], Cell[BoxData[ (CI = Inverse[CC])], Input], Cell[Just for reference,, Text, Background->RGBColor[0, 1, 0]], Cell[BoxData[ (Eigenvalues[CI])], Input, Background->RGBColor[0, 1, 0]], Cell[TextData[{ Although , StyleBox[CI, Input], is symmetric, and , StyleBox[Transpose[P].P, Input], is symmetric, }], Text, Background->RGBColor[0, 1, 0]], Cell[BoxData[ (Transpose[P] . P)], Input, Background->RGBColor[0, 1, 0]], Cell[their product is not., Text, Background->RGBColor[0, 1, 0]], Cell[BoxData[ (CI . ((Transpose[P] . P)))], Input, Background->RGBColor[0, 1, 0]], Cell[TextData[{ However, because we know that both CI and , StyleBox[Transpose[P].P, Input], have real eigenvalues, we also know that their product also does. }], Text, Background->RGBColor[0, 1, 0]], Cell[< The crux of the minimization is to find eigenvalues and vectors as follows: >, Text], Cell[BoxData[ (({values, vectors} = Eigensystem[CI . ((Transpose[P] . P))];))], Input], Cell[< As stated above, we know a priori that these values and vectors are real. For reference, >, Text], Cell[BoxData[ (values)], Input], Cell[BoxData[ (vectors)], Input], Cell[< Find the position in the list of eigenvalues of the one with the smalled absolute value: >, Text], Cell[BoxData[ (With[{a = Abs[values]}, nt pos = (Position[a, Min[a]])[LeftDoubleBracket]1, 1[RightDoubleBracket]nt])], Input], Cell[Save the corresponding vector:, Text], Cell[BoxData[ (v = vectors[LeftDoubleBracket]pos[RightDoubleBracket])], Input], Cell[For reference,, Text], Cell[BoxData[ (v . CC . v)], Input], Cell[Then the normalization constant is, Text], Cell[BoxData[ (k = @((-1)/v . CC . v))], Input], Cell[< The fitted coefficients of the polynomial form the circle are >, Text], Cell[BoxData[ ({a, b, c, d} = v/k)], Input], Cell[BoxData[ ({xc, yc} = (-{b, c})/(2 a))], Input], Cell[and the radius., Text], Cell[BoxData[ (r = @((b^2 + c^2)/(4 a^2) - d/a))], Input], Cell[BoxData[ (Clear[pts, P, CC, values, vectors, a, v, k, b, c, d, xc, yc, r])], Input] }, Open ]], Cell[CellGroupData[{ Cell[Usage, Subsubsection], Cell[BoxData[ ((fitCircle::usage = *;))], Input, InitializationCell->True] }, Open ]], Cell[CellGroupData[{ Cell[Code, Subsubsection], Cell[BoxData[ RowBox[{(fitCircle[pts : {{_, _} .. }]), :=, RowBox[{Module, [, RowBox[{({P, C, values, vectors, a, v, k, b, c, d, xc, yc, r}), ,, n, tt, RowBox[{(P = pts /. {x_, y_} [RuleDelayed] {x^2 + y^2, x, y, 1}), ;, RowBox[{C, =, RowBox[{(, GridBox[{ {0, 0, 0, (1/2)}, {0, (-(1/4)), 0, 0}, {0, 0, (-(1/4)), 0}, {(1/2), 0, 0, 0} }], )}]}], ;, RowBox[{CI, =, RowBox[{(, GridBox[{ {0, 0, 0, 2}, {0, (-4), 0, 0}, {0, 0, (-4), 0}, {2, 0, 0, 0} }, ColumnAlignments->{Decimal}], )}]}], ;, ({values, vectors} = Eigensystem[CI . ((Transpose[P] . P))]), ;, n, tt, (With[{a = Abs[values]}, ntttpos = (Position[a, Min[a]])[LeftDoubleBracket]1, 1[RightDoubleBracket]ntt]), ;, n, tt, (v = vectors[LeftDoubleBracket]pos[RightDoubleBracket]), ;, (k = @((-1)/v . C . v)), ;, ({a, b, c, d} = v/k), ;, ({xc, yc} = (-{b, c})/(2 a)), ;, (r = @((b^2 + c^2)/(4 a^2) - d/a)), ;, n, tt, ({{xc, yc}, r})}]}], n, t, ]}]}]], Input, InitializationCell->True] }, Open ]], Cell[CellGroupData[{ Cell[Local tests, Subsubsection], Cell[BoxData[ (fitCircle[pts])], Input] }, Open ]] }, Closed]], Cell[CellGroupData[{ Cell[isSlightlyCurved, Subsection, CellTags->isSlightlyCurved], Cell[BoxData[ (Clear[isSlightlyCurved])], Input], Cell[< Given a facetted shell, this function returns true if the shell is slightly curved. A facetted shell is slightly curved if a plane is a good enough fit to the facetted shell. >, Text], Cell[CellGroupData[{ Cell[Usage, Subsubsection], Cell[BoxData[ ((isSlightlyCurved::usage = ;))], Input, InitializationCell->True], Cell[< where the returns mean tTruetthe cylinder is open and nearly flat; use the slightly-curved fitting function tFalsetthe cylinder is more than a little curved. Use the standard fitting function t$Failedt represents a nearly flat closed cylinder. We can't deal with this. >, Text], Cell[BoxData[ ((Options[isSlightlyCurved] = debugLevel [Rule] 0;))], Input, InitializationCell->True] }, Open ]], Cell[CellGroupData[{ Cell[Code, Subsubsection], Cell[< v. 125 (1/6/00) Incorporate area A and perim P into varPlane criterion >, SmallText, FontSize->10], Cell[BoxData[ (isSlightlyCurved[pts_, A_, P_, topo : | , opts___?OptionQ] := Module[{ptsF = Flatten[pts, 1], centroids, bounds, varPlane, small = 0.1, big = 10^6}, nttdbg = (debugLevel /. Flatten[{opts}]) /. Options[isSlightlyCurved]; centroids = Map[Function[{oneEnd}, ntttttWith[{n = Length[oneEnd]}, (1/n) ([Sum]+(i = 1)%n oneEnd[LeftDoubleBracket] i[RightDoubleBracket])]ntttt], ptsnttt]; nttbounds = 2 {[Sqrt]Max[(((# - centroids[LeftDoubleBracket]1 [RightDoubleBracket])) . ((# - centroids[LeftDoubleBracket]1 [RightDoubleBracket])) &) /@ pts[LeftDoubleBracket]1[RightDoubleBracket]], [Sqrt]Max[(((# - centroids[LeftDoubleBracket]2 [RightDoubleBracket])) . ((# - centroids[LeftDoubleBracket]2 [RightDoubleBracket])) &) /@ pts[LeftDoubleBracket]2[RightDoubleBracket]]}; t Off[fitSmooth::]; varPlane = Catch[(fitPlane[ptsF, A, P, Rectangle [Rule] False])[LeftDoubleBracket]2[RightDoubleBracket], , big]; On[fitSmooth::]; nttret = Which[ntttvarPlane > ((small Min[Max[bounds], 4 A/P]))^2, False, nttttopo == , True, ntttTrue, Message[ fitSmooth::flat]; $Failedntt]; [IndentingNewLine]If[ dbg > 0, [IndentingNewLine]Print[]; Print[{ret, A, P, bounds, varPlane}][IndentingNewLine]]; [IndentingNewLine]retn t])], Input, InitializationCell->True] }, Open ]], Cell[CellGroupData[{ Cell[Programming notes, Subsubsection], Cell[< fitPlane expects to be given something that is roughly planar. So it throws an exception when the object is is given is not so: that is, when the Sqrt[variance] exceeds 1/4 of the max[bounds] as described above. >, Text], Cell[< isSlightlyCurved deliberately hands fitPlane objects that might not be remotely planar: nearly closed circular cylinders, for example. So it Catches the Throw of fitPlane in this case, and substitutes big for the variance fitPlate computes. (The variance computed by fitPlane would be fine, but Mathematica does throw the variance itself along with the exception, so isSlightlyCurved doesn't know what it is; only that it is big.) >, Text], Cell[< If an exception is not thrown, then isSlighlyCurved compares the variance returned from fitPlane to (small Min[Max[bounds], A])^2, where bounds is a vector of length 2, computed as follows: >, Text], Cell[< First component: Twice the maximum of the magnitudes of the vectors from the centroid of end 1 to the various points around end 1. >, Text], Cell[Second component: same thing for end 2., Text], Cell[< Hmmm... This bounds estimate is a lot more expensive that the one I use in fitPlane. Oh, well... >, Text], Cell[< ...and A is the supplied area of the shell. We incorporate area into varPlane criterion to avoid being fooled by a very short cylinder (ring), which otherwise might be a good fit to a plane through the centerline of the ring. >, Text], Cell[Note the Which statement at the end:, Text], Cell[< First, if the variance is large, return False: not slightly curved. Next, if the topology is open, turn True, is slightly curved open shell. Otherwise, throw an exception: we apparently have a closed cylinder that is flat; that is nearly planar. Not good! >, Text] }, Open ]] }, Open ]], Cell[CellGroupData[{ Cell[findCylinderAxis, Subsection], Cell[< Given the points of the facetted cylinder a signed radius of the fitted cylinder, find the axis of the fitted cylinder. >, Text], Cell[BoxData[ (Clear[findCylinderAxis])], Input], Cell[CellGroupData[{ Cell[Usage, Subsubsection], Cell[BoxData[ ((findCylinderAxis::usage = ;))], Input, InitializationCell->True] }, Open ]], Cell[CellGroupData[{ Cell[Main function, Subsubsection], Cell[TextData[{ Find the two centroids of the two clusters of endpoints of the cylinder.nChoose from between the two algorithms below using function , ButtonBox[isSlightlyCurved, ButtonData:>isSlightlyCurved, ButtonStyle->Hyperlink], .n }], Text], Cell[BoxData[ (findCylinderAxis[pts_, A_, P_, topo : | , r_] := nt With[{slightlyCurvedQ = isSlightlyCurved[pts, A, P, topo], nttcentroids = Map[Function[{oneEnd}, nttttttWith[{n = Length[ oneEnd]}, (1/n) ([Sum]+(i = 1)%n oneEnd[LeftDoubleBracket] i[RightDoubleBracket])]ntttt], ptsnttt]}, nttfindCylinderAxis[pts, centroids, slightlyCurvedQ, r]ntt])], Input, InitializationCell->True] }, Open ]], Cell[CellGroupData[{ Cell[Slightly curved, Subsubsection], Cell[TextData[{ nFind a crude plane approximation to the slightly-curved cylinder. Use function , ButtonBox[directedArea, ButtonData:>directedArea, ButtonStyle->Hyperlink], .nTranslate the centroids a distance , StyleBox[r, FontSlant->Italic], along the directed area.nt[Bullet] Take account of the sign of , StyleBox[r, FontSlant->Italic], nConstruct the axis through these two translated points. }], Text], Cell[BoxData[ (findCylinderAxis[pts_, centroids_, slightlyCurvedQ : True, r_] := nt With[{ptsF = Flatten[pts, 1]}, With[{vec = (#/@(# . #) &)[ directedArea[ ptsF]]}, ttnttt {centroids[LeftDoubleBracket]1[RightDoubleBracket] - r vec, centroids[LeftDoubleBracket]2[RightDoubleBracket] - centroids[LeftDoubleBracket]1[RightDoubleBracket]}nt t]nt])], Input, InitializationCell->True] }, Open ]], Cell[CellGroupData[{ Cell[Not slightly curved (or closed), Subsubsection], Cell[< Construct the axis through the two centroids of the two clusters of endpoints of the cylinder. >, Text], Cell[BoxData[ (findCylinderAxis[pts_, centroids_, slightlyCurvedQ : False | $Failed, r_] := ntt{centroids[LeftDoubleBracket]1 [RightDoubleBracket], centroids[LeftDoubleBracket]2[RightDoubleBracket] - centroids[LeftDoubleBracket]1[RightDoubleBracket]})], Input, InitializationCell->True] }, Open ]], Cell[CellGroupData[{ Cell[Local tests, Subsubsection], Cell[Shallow, slightly-curved cylinder:, Text], Cell[BoxData[ (bump := Random[Real, {(- .005), .005}])], Input, PageWidth->WindowWidth], Cell[BoxData[{ ((SeedRandom[36354];)), n, ((pts = Map[Function[{angles}, {c, [Theta], [Phi]} = angles; ntttTable[ c + {nttttCos[[Theta]1 - [Theta]] Cos[[Phi]] + bump, nttttSin[[Theta]1 - [Theta]] Cos[[Phi]] + bump, nttttSin[[Theta]1 - [Theta]] Sin[[Phi]] + bump}, {[Theta]1, 2.5, 3, .05}]], ntt{{{0, 0, 0}, 1, 2}, {{ .1, .2, .3}, 1, 2}}];))}], Input, PageWidth->WindowWidth], Cell[BoxData[ ((pdata = ScatterPlot3D[Flatten[pts, 1]];))], Input], Cell[< The shell is quite shallow, and will be classified slightly curved if open, >, Text], Cell[BoxData[ (findCylinderAxis[pts, 1, 1, , r])], Input], Cell[but not so if closed,, Text], Cell[BoxData[ (findCylinderAxis[pts, 1, 1, , r])], Input] }, Open ]] }, Closed]], Cell[CellGroupData[{ Cell[Directed area, Subsection, CellTags->directedArea], Cell[< The following function finds the directed area of a loop of points. It is used to distinguish the positive face from the negative face of a flat or slightly-curved shell. >, Text], Cell[CellGroupData[{ Cell[Usage, Subsubsection], Cell[BoxData[ ((directedArea::usage = ;))], Input, InitializationCell->True] }, Open ]], Cell[CellGroupData[{ Cell[Code, Subsubsection], Cell[BoxData[ (directedArea[pts_] := Module[{closedPts, edges}, nttclosedPts = Append[pts, First[pts]]; edges = (-Apply[Subtract, Partition[closedPts, 2, 1], 1]); ((1/2)) Plus @@ Apply[#1[Cross]#2 &, Transpose[{pts, edges}], 1]nt])], Input, InitializationCell->True], Cell[Algebraic example:, Text], Cell[BoxData[ (directedArea[{p_1, p_2, p_3, p_4}])], Input] }, Open ]], Cell[CellGroupData[{ Cell[Local tests, Subsubsection], Cell[Numerical examples:, Text], Cell[BoxData[ (directedArea[{ntt{0, 0, 0}, {0, 1, 0}, {1, 1, 0}, {1, 0, 0}nt}])], Input], Cell[BoxData[ (directedArea[{ntt{0, 0, 0}, {0, 1, 0}, {0, 1, 1}, {0, 0, 1}nt}])], Input] }, Open ]] }, Closed]], Cell[CellGroupData[{ Cell[rectangleLW, Subsection], Cell[< Assuming the shape of a rectangle, this function computes length and width of this rectangle given its area and perimeter. The length by definition is no shorter than the width. >, Text], Cell[BoxData[ ((rectangleLW::usage = ;))], Input, InitializationCell->True], Cell[BoxData[ (rectangleLW[A_, P_] := nt If[ P^2 > 16 A, ntt{(1/4) ((P + @(P^2 - 16 A))) , (1/4) ((P - @(P^2 - 16 A)))}, ntt{@A, @A}nt])], Input, InitializationCell->True] }, Closed]] }, Closed]], Cell[CellGroupData[{ Cell[Fit a slightly curved shell, Section, CellTags->s.fitSlightlyCurved], Cell[< A flat open cylinder is defined here to be one which is nearly planar. In other words, it is a nearly flat shell to be fitted with one radius of curvature. An open cylinder which is not flat should be fitted with the algorithm in the previous section. If the shell is extremely flat, however, this function will throw an error, because the shell should have been created instead as a flat plate. >, Text], Cell[CellGroupData[{ Cell[Development, Subsection], Cell[CellGroupData[{ Cell[Define points for a flat open cylinder, Subsubsection, PageWidth->WindowWidth], Cell[TextData[{ Define two sets of end-points of the cylinder along two similarly oriented bumpy circles of approximately unit radius, whose centers are at separate points , StyleBox[c, FontSlant->Italic], . }], Text, PageWidth->WindowWidth], Cell[First define a random bump in the range, Text, PageWidth->WindowWidth], Cell[BoxData[ (bump = 0)], Input], Cell[BoxData[ (bump := Random[Real, {(- .005), .005}])], Input, PageWidth->WindowWidth], Cell[BoxData[{ ((SeedRandom[86390];)), n, ((pts = N@Map[Function[{angles}, {c, [Theta], [Phi]} = angles; ntttTable[ c + {nttttCos[[Theta]1 - [Theta]] Cos[[Phi]] + bump, nttttCos[[Theta]1 - [Theta]] Sin[[Phi]] + bump, nttttSin[[Theta]1 - [Theta]] Sin[[Phi]] + bump}, {[Theta]1, (-[Pi])/ 10, [Pi]/10, [Pi]/50}]], ntt{{{0, 0, 0}, 0, [Pi]/2}, {{1, 0, 0}, 0, [Pi]/2}}];))}], Input, PageWidth->WindowWidth], Cell[< These two sets of end-points should ordered realistically, such that they could have come from a single loop. Now they are not; we need to reverse the order of one set or the other. We need realistic ordering to choose the sign of the radius. We arbitrarily choose to reverse the first set >, Text], Cell[BoxData[ ((pts = MapAt[Reverse, pts, 1];))], Input], Cell[< Here is a plot of all these points. Note the anisotropic stretching of coordinates to emphasize the curvature of the facetted shell. >, Text], Cell[BoxData[ (Needs[])], Input], Cell[BoxData[ ((plotData = ScatterPlot3D[Flatten[pts, 1], PlotStyle [Rule] PointSize[ .02], AxesLabel [Rule] {, , }, BoxRatios [Rule] {1, 1, 1}];))], Input] }, Closed]], Cell[CellGroupData[{ Cell[Centroids and bounds, Subsubsection], Cell[Compute the centroid of each end., Text], Cell[BoxData[ (centroids = (Plus @@ #/Length@# &) /@ pts)], Input], Cell[< Find the approximate size of the bounding box at each end, calculated as twice the maximum distance of any point from the centroid computed above. >, Text], Cell[BoxData[ (((t)(bounds = 2 {[Sqrt]Max[(((# - centroids[LeftDoubleBracket]1 [RightDoubleBracket])) . ((# - centroids[LeftDoubleBracket]1 [RightDoubleBracket])) &) /@ pts[LeftDoubleBracket]1[RightDoubleBracket]], [Sqrt]Max[(((# - centroids[LeftDoubleBracket]2 [RightDoubleBracket])) . ((# - centroids[LeftDoubleBracket]2 [RightDoubleBracket])) &) /@ pts[LeftDoubleBracket]2[RightDoubleBracket]]})))] , Input] }, Closed]], Cell[CellGroupData[{ Cell[Fit a plane, Subsubsection], Cell[BoxData[ ((?fitPlane))], Input], Cell[BoxData[ ({{{x0, y0, z0}, {a, b, c}}, variance} = (fitPlane[Flatten[pts, 1], 1, 1])[LeftDoubleBracket]{1, 2}[RightDoubleBracket])], Input], Cell[TextData[{ This calculation should be stopped if the relative error is too large. (How large is that?) The function , StyleBox[fitCylinder, Input], , intended for closed cylinders and nonflat open cylinders, should be used instead. What we shall do, however, is to assume that this check has been made already before this function is called, and than the plane fit is now presumed to be relatively good. }], Text] }, Closed]], Cell[CellGroupData[{ Cell[Centroids on plane, Subsubsection], Cell[< Project the centroids of the two ends of the open cylinder onto the plane >, Text], Cell[BoxData[ ({p1, p2} = pointsOnPlane[{{x0, y0, z0}, {a, b, c}}, centroids])], Input] }, Closed]], Cell[CellGroupData[{ Cell[Project points onto end-planes, Subsubsection], Cell[< Each end-plane passes through a projected centroids perpendicular to a line between these two centroids. A basis or the plane is >, Text], Cell[BoxData[ (g = basis[{a, b, c}, 0, p2 - p1])], Input], Cell[< For end 1, we shall translate so that point p1 is at (0,0,0) >, Text], Cell[BoxData[ ((((# - p1)) &) /@ pts[LeftDoubleBracket]1[RightDoubleBracket])], Input], Cell[and then rotate:, Text], Cell[BoxData[ ((g . ((# - p1)) &) /@ pts[LeftDoubleBracket]1[RightDoubleBracket])], Input], Cell[TextData[{ and finally project the points onto the rotated , StyleBox[x, FontSlant->Italic], -, StyleBox[y, FontSlant->Italic], plane by dropping the rotated , StyleBox[z, FontSlant->Italic], -coordinate: }], Text], Cell[BoxData[ (circle1 = (Drop[#, (-1)] &) /@ (((g . ((# - p1)) &) /@ pts[LeftDoubleBracket]1[RightDoubleBracket])))], Input], Cell[Similarly, at the other end,, Text], Cell[BoxData[ (circle2 = (Drop[#, (-1)] &) /@ (((g . ((# - p2)) &) /@ pts[LeftDoubleBracket]2[RightDoubleBracket])))], Input] }, Closed]], Cell[CellGroupData[{ Cell[Fitted circles, Subsubsection], Cell[BoxData[ ((?fitCircle))], Input], Cell[BoxData[ ({{x1, y1}, r1} = fitCircle[circle1])], Input], Cell[BoxData[ ({{x2, y2}, r2} = fitCircle[circle2])], Input], Cell[BoxData[ ((ListPlot[Append[circle1, {x1, y1}]];))], Input], Cell[BoxData[ ((ListPlot[Append[circle2, {x2, y2}]];))], Input], Cell[Return the mean fitted radius, Text], Cell[BoxData[ (r = (r1 + r2)/2)], Input] }, Closed]], Cell[CellGroupData[{ Cell[Transform fitted centers back into global coordinates, Subsubsection], Cell[< Note that the transpose, same as inverse, of the forward transformation will reverse the transformation. >, Text], Cell[BoxData[{ (With[{gt = Transpose[g]}, ntc1 = gt . {x1, y1, 0} + p1; nt c2 = gt . {x2, y2, 0} + p2;nt]), n, ({c1, c2})}], Input], Cell[Plot fitted centers along with supplied points:, Text], Cell[BoxData[ ((plotCenters = ScatterPlot3D[{c1, c2}, PlotStyle [Rule] PointSize[0.05], DisplayFunction [Rule] Identity];))], Input], Cell[BoxData[ ((Show[plotData, plotCenters, PlotRange [Rule] All, AxesLabel [Rule] {, , }];))], Input] }, Closed]], Cell[CellGroupData[{ Cell[Convex side versus positive side, Subsubsection], Cell[TextData[{ The convex side is the side of the shell from which its surface appears to be convex; appearing concave from the other side. The fitted centers , Cell[BoxData[ (TraditionalForm`c_1)]], and , Cell[BoxData[ (TraditionalForm`c_2)]], should be on the concave side of the shell. Therefore, one vector pointing in the convex direction runs from a point midway between these two centers to the mid-centroid of the shallow shell: }], Text], Cell[BoxData[ (centroids)], Input], Cell[BoxData[ (Plus @@ centroids)], Input], Cell[BoxData[ (Plus @@ centroids - Plus @@ {c1, c2})], Input], Cell[< The positive side of the shallow shell is the one into which points a normal vector constructed from the right-hand rule from the circulation of points defining the loop. We use the concatenation of the points of the two ends, ignoring any midpoints along the side of the flat shell. The directed area is constructed to point always to the positive side. >, Text], Cell[BoxData[ (Flatten[pts, 1])], Input], Cell[BoxData[ (directedArea[Flatten[pts, 1]])], Input], Cell[TextData[{ The symbol , StyleBox[t, FontSlant->Italic], is +1|-1 depending upon the convex side of the shell being its positive|negative side. }], Text], Cell[BoxData[ (t = Sign[((Plus @@ centroids - Plus @@ {c1, c2})) . directedArea[Flatten[pts, 1]]])], Input], Cell[TextData[{ This function returns signed radii[LongDash]each radius multiplied by , StyleBox[t, FontSlant->Italic], [LongDash]encoding in these radii whether or not the positive side is the same as the convex side. This awkward convection allows the user the ability to indicate, by the sign of an overriding radius, whether the positive or negative side of the face is to be convex. }], Text] }, Closed]] }, Closed]], Cell[CellGroupData[{ Cell[Software, Subsection], Cell[CellGroupData[{ Cell[Usage, Subsubsection, PageWidth->WindowWidth], Cell[BoxData[ ((fitSlightlyCurved:: = ;))], Input, PageWidth->WindowWidth, InitializationCell->True], Cell[TextData[{ Arguments:nt, StyleBox[pts, FontFamily->Courier], is a pair of lists of Cartesian triples representing pointsntat the two ends of the cylinderntA & P are area and perimeter, used only for L & Wntopen==singly curved shell; closed==closed circular cylindernReturns:nt, Cell[BoxData[ (TraditionalForm`((x_o, y_o, z_o)))]], is a point on centerline of the fitted cylindernt, Cell[BoxData[ (TraditionalForm`((a, b, c)))]], is a vector parallel to the centerline of the fitted cylindernt , StyleBox[r, FontSlant->Italic], is the , ButtonBox[signed, ButtonData:>{globals.nb, s.curvature sign defined}, ButtonStyle->Hyperlink], radius of the fitted cylindernt, StyleBox[variance, FontFamily->Courier], is the average of the squares of the distances of the points from the planentL & W are dimensions of equivalent rectangle, used only for mode countingntdirL is a unit vector parallel to side L }], Text, PageWidth->WindowWidth] }, Open ]], Cell[CellGroupData[{ Cell[Code, Subsubsection], Cell[< v. 106 (5/5/99) Sign the radii positive iff >, Text], Cell[BoxData[ (fitSlightlyCurved[pts_, A_, P_] := Module[{a, b, c, bounds, c1, c2, centroids, circle1, circle2, g, t, L, W, p1, p2, r, r1, r2, variance, x0, y0, z0, x1, x2, y1, y2}, [IndentingNewLine]centroids = (Plus @@ #/Length@# & ) /@ pts; [IndentingNewLine]bounds = 2 {[Sqrt]Max[(((# - centroids[LeftDoubleBracket]1 [RightDoubleBracket])) . ((# - centroids[LeftDoubleBracket]1 [RightDoubleBracket])) &) /@ pts[LeftDoubleBracket]1[RightDoubleBracket]], [Sqrt]Max[(((# - centroids[LeftDoubleBracket]2 [RightDoubleBracket])) . ((# - centroids[LeftDoubleBracket]2 [RightDoubleBracket])) &) /@ pts[LeftDoubleBracket]2[RightDoubleBracket]]}; {{{x0, y0, z0}, {a, b, c}}, variance} = (fitPlane[Flatten[pts, 1], 1, 1])[LeftDoubleBracket]{1, 2}[RightDoubleBracket]; {p1, p2} = pointsOnPlane[{{x0, y0, z0}, {a, b, c}}, centroids]; g = basis[{a, b, c}, 0, p2 - p1]; circle1 = (Drop[#, (-1)] &) /@ (((g . ((# - p1)) &) /@ pts[LeftDoubleBracket]1[RightDoubleBracket])); circle2 = (Drop[#, (-1)] &) /@ (((g . ((# - p2)) &) /@ pts[LeftDoubleBracket]2[RightDoubleBracket])); {{x1, y1}, r1} = fitCircle[circle1]; {{x2, y2}, r2} = fitCircle[circle2]; r = (r1 + r2)/2; nttWith[{gt = Transpose[g]}, ntttc1 = gt . {x1, y1, 0} + p1; ntttc2 = gt . {x2, y2, 0} + p2ntt]; nttt = Sign[((Plus @@ centroids - Plus @@ {c1, c2})) . directedArea[Flatten[pts, 1]]]; {L, W} = rectangleLW[A, P]; ntt{{c1, c2 - c1, t r}, variance = (-1), {L, W, c2 - c1}}nt])], Input, InitializationCell->True] }, Open ]] }, Open ]], Cell[CellGroupData[{ Cell[Local tests, Subsection], Cell[This test uses the data set up for development., Text], Cell[BoxData[ (fitSlightlyCurved[pts, 1, 1])], Input] }, Closed]] }, Closed]], Cell[CellGroupData[{ Cell[Fit an open or closed cylinder, Section, PageWidth->WindowWidth, CellTags->{fitCylinder, s.fitCylinder}], Cell[< This function was designed for both closed and open cylinders, but it is used only for closed cylinders and for open cylinders which are not flat. An open cylinder should first be tested for flatness in the algorithm of the previous section. Only those open cylinders failing the flatness test should be sent here. >, Text], Cell[< A closed cylinder is defined by two loops of points, one for each end of the cylinder. An open cylinder is defined by two set of points, but these sets do not define loops. The chosen algorithm will work for both closed and open cylinders. >, Text, PageWidth->WindowWidth], Cell[CellGroupData[{ Cell[Development, Subsection, PageWidth->WindowWidth], Cell[BoxData[ (Clear[pts, a, b, c, [Kappa], a1, b1, c1, d, x, y, z, x0, y0, z0, x1, y1, z1, xp, yp, zp, r, r1, lineParam, plotData, n, centroids, bounds, t1, t2, t, distRule, posMin, distPlane, pointProj, pointsProj, idir, varElim1, varElim2, initCond, distRule, distLine2, distFunc, answer, variance, plotFit, plotProjected, plotCentroids])], Input, PageWidth->WindowWidth], Cell[BoxData[ (Clear[bump, [Theta], [Theta]1, uMin])], Input, PageWidth->WindowWidth], Cell[TextData[{ Some of this development contrasts radius , StyleBox[r, FontSlant->Italic], and curvature [Kappa] as variables in alternate formulations. The latter formulation, as so far attempted, yields biased results, so it cannot be used as formulated. The associated formulae and text are therefore marked by , StyleBox[green color, FontColor->RGBColor[0, 1, 0]], . }], Text], Cell[CellGroupData[{ Cell[Define points for a closed cylinder, Subsubsection, PageWidth->WindowWidth], Cell[TextData[{ Define two sets of points along two differently oriented bumpy circles of approximately unit radius, whose centers are at separate points , StyleBox[c, FontSlant->Italic], . }], Text, PageWidth->WindowWidth], Cell[TextData[{ First define a random bump in the range , Cell[BoxData[ (TraditionalForm`{(- .05), .05})]], : }], Text, PageWidth->WindowWidth], Cell[BoxData[ (bump := Random[Real, {(- .05), .05}])], Input, PageWidth->WindowWidth], Cell[BoxData[{ ((SeedRandom[33741];)), n, ((pts = Map[Function[{angles}, {c, [Theta], [Phi]} = angles; ntttTable[ c + {nttttCos[[Theta]1 - [Theta]] Cos[[Phi]] + bump, nttttSin[[Theta]1 - [Theta]] Cos[[Phi]] + bump, nttttSin[[Theta]1 - [Theta]] Sin[[Phi]] + bump}, {[Theta]1, .5, 2 [Pi], .5}]], ntt{{{0, 0, 0}, 1, 2}, {{1, 2, 3}, 3, (-4)}}];))}], Input, PageWidth->WindowWidth], Cell[< These two sets of end-points should ordered realistically, such that they could have come from a single loop. Now they are not; we need to reverse the order of one set or the other. We need realistic ordering to choose the sign of the radius. We arbitrarily choose to reverse the first set >, Text], Cell[BoxData[ ((pts = MapAt[Reverse, pts, 1];))], Input], Cell[Here is a plot of all these points:, Text, PageWidth->WindowWidth], Cell[BoxData[ (Needs[])], Input, PageWidth->WindowWidth], Cell[BoxData[ ((plotData = ScatterPlot3D[Flatten[pts, 1]];))], Input, PageWidth->WindowWidth] }, Closed]], Cell[CellGroupData[{ Cell[Compute centroids and bounds, Subsubsection, PageWidth->WindowWidth], Cell[BoxData[ (centroids = Map[Function[{oneEnd}, With[{n = Length[ oneEnd]}, ([Sum]+(i = 1)%n oneEnd [LeftDoubleBracket]i[RightDoubleBracket])/n]], pts])], Input, PageWidth->WindowWidth], Cell[Build a display of these centroids, but don't show it now., Text, PageWidth->WindowWidth], Cell[BoxData[ ((Block[{$DisplayFunction = Identity}, plotCentroids = ScatterPlot3D[centroids, PlotStyle [Rule] {GrayLevel[ .3], PointSize[0.05]}]];))], Input, PageWidth->WindowWidth], Cell[Here are the centroids along with the original points., Text, PageWidth->WindowWidth], Cell[BoxData[ ((Show[plotData, plotCentroids];))], Input, PageWidth->WindowWidth], Cell[< Separate bounds are defined for the two ends of the cylinder. Each bound is defined as twice the maximum distance of any point from that end's centroid: >, Text, PageWidth->WindowWidth], Cell[BoxData[ (bounds = 2 Table[[Sqrt]Max[(((# - centroids[LeftDoubleBracket] i[RightDoubleBracket])) . ((# - centroids[LeftDoubleBracket] i[RightDoubleBracket])) &) /@ pts[LeftDoubleBracket]i[RightDoubleBracket]], {i, 2}])], Input, PageWidth->WindowWidth] }, Closed]], Cell[CellGroupData[{ Cell[Convex side vs. positive side, Subsubsection], Cell[< It can be seen by inspection that the right-hand normal of a cylinder points outward if and only if the right-hand normals of the two end-caps both point in. An approximate measure of the direction of an end-cap normal is a dot product of the directed area of the cap with the a vector from the cap's centroid to the centroid of the other end: >, Text], Cell[BoxData[ (pts[LeftDoubleBracket]1[RightDoubleBracket])], Input], Cell[BoxData[ (directedArea[ pts[LeftDoubleBracket]1[RightDoubleBracket]])], Input], Cell[BoxData[ (t1 = directedArea[ pts[LeftDoubleBracket]1[RightDoubleBracket]] . ((centroids[LeftDoubleBracket]2[RightDoubleBracket] - centroids[LeftDoubleBracket]1[RightDoubleBracket])))], Input], Cell[BoxData[ (t2 = directedArea[ pts[LeftDoubleBracket]2[RightDoubleBracket]] . ((centroids[LeftDoubleBracket]1[RightDoubleBracket] - centroids[LeftDoubleBracket]2[RightDoubleBracket])))], Input], Cell[< These dot products are postive if the right-hand normal of the end-cap points inward, implying that the right-hand normal of the cylinder points outward: >, Text], Cell[BoxData[ (Which[ntt1 > 0 && t2 > 0, t = 1, ntt2 < 0 && t2 < 0, t = (-1), ntTrue, Abort[]n])], Input], Cell[TextData[{ We cannot accept differing signs of t1 and t2, because that would indicate that our scheme to compute , StyleBox[t, FontSlant->Italic], has failed, probably because the cylinder is too distorted for this simple algorithm to determine inside from outside. }], Text], Cell[TextData[{ A more robust, general scheme to compute , StyleBox[t, FontSlant->Italic], could be based on the sign of the volume inside the shell. (The shell need not be closed for this scheme to work.) }], Text, CellFrame->True, Background->GrayLevel[0.833326]] }, Closed]], Cell[CellGroupData[{ Cell[Distance to centerline, Subsubsection, PageWidth->WindowWidth], Cell[BoxData[ (Clear[a, b, c, x0, y0, z0, xp, yp, zp, u, v, uMin, [Theta]])], Input, PageWidth->WindowWidth], Cell[A parametric equation of a line is, Text, PageWidth->WindowWidth], Cell[BoxData[ (lineParam = {x, y, z} == {x0, y0, z0} + {a, b, c} u)], Input, PageWidth->WindowWidth], Cell[TextData[{ The square of the distance from a point , StyleBox[p, FontSlant->Italic], to a point this line is }], Text, PageWidth->WindowWidth], Cell[BoxData[ (distRule = First@Solve[{dist == ((x - xp))^2 + ((y - yp))^2 + ((z - zp))^2, lineParam}, dist, {x, y, z}])], Input, PageWidth->WindowWidth], Cell[< The distance to the line is the minimum distance to any point on the line: >, Text, PageWidth->WindowWidth], Cell[BoxData[ (uMin = u /. First[Solve[D[dist /. distRule, u] == 0, u]])], Input, PageWidth->WindowWidth], Cell[Here is the square of this minimum distance:, Text, PageWidth->WindowWidth], Cell[BoxData[ (distLine2 = dist /. ((distRule /. u [Rule] uMin)) // FullSimplify)], Input, PageWidth->WindowWidth], Cell[A variation will use the inverse square distance instead, Text], Cell[BoxData[ (distLineM2 = 1/dist /. ((distRule /. u [Rule] uMin)) // FullSimplify)], Input, PageWidth->WindowWidth], Cell[TextData[{ This form has six free parameters, of which only four are independent. So we must eliminate two of these when fitting a line to a cloud of points. But which two? No , StyleBox[a priori, FontSlant->Italic], choice is completely general. We shall use a technique similar to that used above for fitting a plane to eliminate some of the variables. }], Text, PageWidth->WindowWidth] }, Closed]], Cell[CellGroupData[{ Cell[Best-fit cylinder, Subsubsection, PageWidth->WindowWidth], Cell[TextData[{ The best-fit cylinder is defined by its axis {, StyleBox[a, FontSlant->Italic], ,, StyleBox[b, FontSlant->Italic], ,, StyleBox[c, FontSlant->Italic], } and its radius , StyleBox[r, FontSlant->Italic], or curvature [Kappa]. }], Text, PageWidth->WindowWidth], Cell[Guessed initial conditions:, Text, PageWidth->WindowWidth], Cell[BoxData[ ({x1, y1, z1} = centroids[LeftDoubleBracket]1[RightDoubleBracket])], Input, PageWidth->WindowWidth], Cell[BoxData[ ({a1, b1, c1} = centroids[LeftDoubleBracket]2[RightDoubleBracket] - centroids[LeftDoubleBracket]1[RightDoubleBracket])], Input, PageWidth->WindowWidth], Cell[BoxData[ (r1 = (1/4) ([Sum]+(i = 1)%2 bounds[LeftDoubleBracket] i[RightDoubleBracket]))], Input, PageWidth->WindowWidth], Cell[BoxData[ ([Kappa]1 = 1/r1)], Input, FontColor->RGBColor[0, 1, 0]], Cell[< As state above, we must eliminate two parameters to a mutually independent set. The ensuing nonlinear regression problem is posed better if we eliminate variables corresponding to the axis closest to parallel to the orientation of the cylinder, which is >, Text, PageWidth->WindowWidth], Cell[BoxData[ (idir = ((Position[#, Max[#]] &)[ Abs /@ {a1, b1, c1}])[LeftDoubleBracket]1, 1[RightDoubleBracket])], Input, PageWidth->WindowWidth], Cell[< Choose the best variables to eliminate based on the approximate orientation of the cylinder based on the centroids of the ends. >, Text, PageWidth->WindowWidth], Cell[BoxData[ (varElim1 = Switch[idir, ntt1, {a [Rule] a1, x0 [Rule] x1}, ntt2, {b [Rule] b1, y0 [Rule] y1}, ntt3, {c [Rule] c1, z0 [Rule] z1}nt])], Input, PageWidth->WindowWidth], Cell[< Here is the form we need to modify the arguments to FindMinimum: >, Text, PageWidth->WindowWidth], Cell[BoxData[ (varElim2 = Alternatives @@ varElim1 /. ((v_ [Rule] n_)) [Rule] {v, n})], Input, PageWidth->WindowWidth], Cell[< Here are initial conditions for variables not eliminated, first in terms of radius, and then in terms of curvature: >, Text, PageWidth->WindowWidth], Cell[BoxData[ (initCond = DeleteCases[{{a, a1}, {b, b1}, {c, c1}, {x0, x1}, {y0, y1}, {z0, z1}, {r, r1}}, varElim2])], Input, PageWidth->WindowWidth], Cell[CellGroupData[{ Cell[BoxData[ (initCond = DeleteCases[{{a, a1}, {b, b1}, {c, c1}, {x0, x1}, {y0, y1}, {z0, z1}, {[Kappa], [Kappa]1}}, varElim2])], Input, PageWidth->WindowWidth, Evaluatable->False, FontColor->RGBColor[0, 1, 0]], Cell[BoxData[ FormBox[ RowBox[{(, [NoBreak], GridBox[{ {a, 0.9421130711178602`}, {b, 2.0048756077748573`}, {x0, 0.015203902395455307`}, {y0, (-0.013883110570249449`)}, {[Kappa], 0.9712464351274009`} }], [NoBreak], )}], TraditionalForm]], Output] }, Open ]], Cell[< The location and radius of the cylinder will minimize the sum of the square of the difference between r and the distance to the axis: >, Text, PageWidth->WindowWidth], Cell[BoxData[ (distFunc[{x_, y_, z_}] := (((@distLine2 - r))^2 /. {xp [Rule] x, yp [Rule] y, zp [Rule] z}) /. varElim1)], Input, PageWidth->WindowWidth], Cell[TextData[{ over all the points , StyleBox[p, FontSlant->Italic], . , StyleBox[In the variation using curvature, we have instead, FontColor->RGBColor[0, 1, 0]] }], Text, PageWidth->WindowWidth], Cell[BoxData[ (distFunc[{x_, y_, z_}] := (((@distLineM2 - [Kappa]))^2 /. {xp [Rule] x, yp [Rule] y, zp [Rule] z}) /. varElim1)], Input, PageWidth->WindowWidth, Evaluatable->False, FontColor->RGBColor[0, 1, 0]], Cell[< For example, here this the square of the difference to one point: >, Text, PageWidth->WindowWidth], Cell[BoxData[ (distFunc[{1, 2, 3}])], Input, PageWidth->WindowWidth], Cell[< Solve the reduced problem, then put back the eliminated variables for a full solution: >, Text, PageWidth->WindowWidth], Cell[BoxData[ (Timing[ answer = (FindMinimum[Plus @@ (distFunc /@ Flatten[pts, 1]), Evaluate[ Sequence @@ initCond]])[LeftDoubleBracket]2 [RightDoubleBracket] [Union] varElim1])], Input, PageWidth->WindowWidth] }, Open ]], Cell[CellGroupData[{ Cell[The cylinder's parameter space, Subsubsection, PageWidth->WindowWidth], Cell[BoxData[ (Clear[bx, by, bz, pointXYZ, plotCylinder])], Input, PageWidth->WindowWidth], Cell[TextData[{ This section is used only to display the fitted cylinder. The functions defined here are not intended to be transcribed into , StyleBox[AutoSEA, FontSlant->Italic], . }], SmallText, PageWidth->WindowWidth], Cell[An arbitrary basis for the cylinder is, Text, PageWidth->WindowWidth], Cell[BoxData[ ({bx, by, bz} = basis[{a, b, c} /. answer])], Input, PageWidth->WindowWidth], Cell[TextData[{ Use the parameter space , Cell[BoxData[ (TraditionalForm`{u, v})]], , where u is , Cell[BoxData[ (TraditionalForm`2 [Pi] [Theta])]], and , Cell[BoxData[ (TraditionalForm`v)]], is normalized distance along the length of the cylinder. A point on the cylinder is }], Text, PageWidth->WindowWidth], Cell[BoxData[ (pointXYZ = {x0, y0, z0} + v {a, b, c} + r bx Cos[2 [Pi] u] + r by Sin[2 [Pi] u] /. answer)], Input, PageWidth->WindowWidth], Cell[In the version using curvature, we have, Text, FontColor->RGBColor[0, 1, 0]], Cell[CellGroupData[{ Cell[BoxData[ (pointXYZ = {x0, y0, z0} + v {a, b, c} + 1/[Kappa] bx Cos[2 [Pi] u] + 1/[Kappa] by Sin[2 [Pi] u] /. answer)], Input, PageWidth->WindowWidth, Evaluatable->False, FontColor->RGBColor[0, 1, 0]], Cell[BoxData[ (TraditionalForm`{0.9368629160163979` v + (0.953887386654585` (cos(2 [Pi] u)))/[Kappa] - (0.15715976986728544` (sin(2 [Pi] u)))/[Kappa] + 0.030442799412237584`, 1.9180947379561128` v + (4.908260916700377`*^-18 (cos(2 [Pi] u)))/[Kappa] + (0.851977476882578` (sin(2 [Pi] u)))/[Kappa] + 0.07489966248161103`, 2.977237785119174` v - (0.300164710752757` (cos(2 [Pi] u)))/[Kappa] - (0.4994348662438959` (sin(2 [Pi] u)))/ [Kappa] + 0.029832427959650777`})], Output] }, Open ]], Cell[< Construct a plot of the cylinder, trimmed to the range 0 [LessEqual]v[LessEqual]1: >, Text, PageWidth->WindowWidth], Cell[BoxData[ ((plotCylinder = Block[{$DisplayFunction = Identity}, ParametricPlot3D[ Evaluate@pointXYZ, {u, 0, 1}, {v, 0, 1}]];))], Input, PageWidth->WindowWidth], Cell[BoxData[ ((Show[plotCylinder, plotData];))], Input, PageWidth->WindowWidth], Cell[TextData[{ As may be obvious from the figure above, this mapping of parameter space does , StyleBox[not, FontSlant->Italic], guarantee that the projection of every point onto the cylinder lies on the trimmed cylinder. }], Text, PageWidth->WindowWidth], Cell[BoxData[ (Clear[x1, y1, z1, bx, by, bz, pointXYZ, plotCylinder])], Input, PageWidth->WindowWidth] }, Open ]], Cell[CellGroupData[{ Cell[Checks for goodness of fit, Subsubsection, PageWidth->WindowWidth], Cell[< Besides the code developed above, the function checks for excessive flatness and goodness fit. There are two flatness checks, both based on the variance yielded by a fit of all points to a plane. First, if this variance is small compared to either bound, then at least one end of the cylinder is too flat to fit, using this function. If the cylinder is open, then control is transferred to fitSlightlyCurved; otherwise an error reported. >, Text, PageWidth->WindowWidth], Cell[BoxData[ ((If[varPlane < ((small Max[bounds]))^2, nt If[topo == , nttReturn[ fitSlightlyCurved[pts, A, P]], nttMessage[ fitSmooth::flat]; Throw[varPlane/((small Max[bounds]))^2]nt]n];))], Input, Evaluatable->False], Cell[< The remaining checks described here are, of course, bypassed in this case. >, Text, PageWidth->WindowWidth], Cell[< Second, if this variance is almost as good as the variance of the fit to the cylinder, then the latter fit is rejected. In either case, an exception is thrown which, if not caught, will stop the program. >, Text, PageWidth->WindowWidth], Cell[BoxData[ ((If[varPlane/variance < margin^2, nt Message[fitSmooth::bumpy]; Throw[varPlane/variance]n];))], Input, Evaluatable->False], Cell[< Also, the fit to a cylinder is rejected if its variance is too large: >, Text], Cell[BoxData[ ((With[{spread = Max[bounds], sd = Sqrt[variance]}, If[sd > 0.15 spread, Message[fitSmooth::lousy, sd, spread, ]; Throw[sd/spread, ]]n];))], Input, Evaluatable->False] }, Closed]], Cell[CellGroupData[{ Cell[Equivalent rectangle, Subsubsection, PageWidth->WindowWidth, CellTags->equivRect], Cell[< The open cylinder has the same topology as the flat plate, and therefore it makes sense to reuse the formulas for length and width given area and perimeter that were introduced above for the flat plate. Not so for the closed cylinder. If we associate the length with the axial direction of the cylinder, then we can estimate the length from the distance between the two centroids, the general formula being: >, Text, PageWidth->WindowWidth], Cell[BoxData[ (With[{centroids = {{x1, y1, z1}, {x2, y2, z2}}}, L = (@(# . #) &)[Subtract @@ centroids]])], Input, PageWidth->WindowWidth], Cell[In our example:, Text, PageWidth->WindowWidth], Cell[BoxData[ (L = (@(# . #) &)[Subtract @@ centroids])], Input, PageWidth->WindowWidth], Cell[< Then we compute the width from this length and the supplied area, ignoring the perimeter: >, Text, PageWidth->WindowWidth], Cell[BoxData[ (W = A/L)], Input, PageWidth->WindowWidth], Cell[< We can combine these formulas for open and closed cylinders as follows: >, Text, PageWidth->WindowWidth], Cell[BoxData[ ((Which[[IndentingNewLine]topo == , L = (@(# . #) &)[Subtract @@ centroids]; W = A/L, [IndentingNewLine] P^2 > 16 A, L = (1/4) ((P + @(P^2 - 16 A))) ; W = (1/4) ((P - @(P^2 - 16 A))), [IndentingNewLine]True, L = (W = @A)[IndentingNewLine]];))], Input, PageWidth->WindowWidth], Cell[< To save development time, we make the assumption that the unrolled shape of the cylinder is a rectangle[LongDash]that is, the cylinder has square-cut ends and the additional boundaries of an open cylinder (singly curved shell) are parallel to the generator. Under these conditions, we may assume that side L is parallel to a generator, and is therefore specified by the same unit vector {a,b,c} derived above to orient the cylinder. >, Text, PageWidth->WindowWidth] }, Open ]], Cell[CellGroupData[{ Cell[Clean up, Subsubsection, PageWidth->WindowWidth], Cell[BoxData[ (Clear[pts, a, b, c, [Kappa], a1, b1, c1, d, x, y, z, x0, y0, z0, x1, y1, z1, xp, yp, zp, r, r1, lineParam, plotData, n, centroids, bounds, t1, t2, t, distRule, posMin, distPlane, pointProj, pointsProj, idir, varElim1, varElim2, initCond, distRule, distLine2, distFunc, answer, variance, plotFit, plotProjected, plotCentroids])], Input, PageWidth->WindowWidth], Cell[BoxData[ (Clear[bump, [Theta], [Theta]1, uMin])], Input, PageWidth->WindowWidth] }, Closed]] }, Open ]], Cell[CellGroupData[{ Cell[Software, Subsection, PageWidth->WindowWidth, CellTags->hide], Cell[CellGroupData[{ Cell[Usage, Subsubsection, PageWidth->WindowWidth], Cell[BoxData[ ((fitCylinder:: = ;))], Input, PageWidth->WindowWidth, InitializationCell->True], Cell[TextData[{ Arguments:nt, StyleBox[pts, FontFamily->Courier], is a pair of lists of Cartesian triples representing pointsntat the two ends of the cylinderntA & P are area and perimeter, used only for L & Wntopen==singly curved shell; closed==closed circular cylindernReturns:nt, Cell[BoxData[ (TraditionalForm`((x_o, y_o, z_o)))]], is a point on centerline of the fitted cylindernt, Cell[BoxData[ (TraditionalForm`((a, b, c)))]], is a vector parallel to the centerline of the fitted cylindernt , StyleBox[r, FontSlant->Italic], is the signed radius of the fitted cylinder, positive iff ButtonBox[convex, ButtonData:>{globals.nb, s.curvature sign defined}, ButtonStyle->Hyperlink], nt, StyleBox[variance, FontFamily->Courier], is the average of the squares of the distances of the points from the planentL & W are dimensions of equivalent rectangle, used only for mode countingntdirL is a unit vector parallel to side L }], Text, PageWidth->WindowWidth] }, Open ]], Cell[CellGroupData[{ Cell[Code[LongDash]radius formulation, Subsubsection, PageWidth->WindowWidth], Cell[< v. 057 (12/11/97) Add A, P, open|closed to arg list; add {L,W,dirL} to return list v. 057 (1/16/98) Correct inconsistent use of Abs in determination of idir v. 064 (6/13/98) Add option Rectangle[Rule]False to call to fitPlane v. 091 (1/25/99) Hand control to new function fitSlightlyCurved if the shell is open and flat v. 092 (1/26/99) Comment out the above change (actually release 91) v. 106 (3/4/99) Reinstate changes listed above under v. 091 v. 137 (12/27/00) Increase MaxIterations in FindMinimum from default (30) to 40 >, Text], Cell[BoxData[ (Clear[fitCylinder])], Input, PageWidth->WindowWidth], Cell[BoxData[ (fitCylinder[pts_, A_, P_, topo : | ] := nt Module[{ptsF = Flatten[pts, 1], centroids, bounds, t1, t2, t, distLine2, xp, yp, zp, x0, y0, z0, a, b, c, r, x1, y1, z1, a1, b1, c1, r1, varElim1, varElim2, initCond, res, ans, answer, variance, varPlane, small = (*0.1*) 0.01, margin = 1.5, big = 10^6, L, W}, [IndentingNewLine]centroids = Map[Function[{oneEnd}, [IndentingNewLine]With[{n = Length[ oneEnd]}, [IndentingNewLine](1/n) ([Sum]+(i = 1)%n oneEnd[LeftDoubleBracket] i[RightDoubleBracket])]], pts[IndentingNewLine]]; [IndentingNewLine]bounds = 2 {[Sqrt]Max[(((# - centroids[LeftDoubleBracket]1 [RightDoubleBracket])) . ((# - centroids[LeftDoubleBracket]1 [RightDoubleBracket])) &) /@ pts[LeftDoubleBracket]1[RightDoubleBracket]], [Sqrt]Max[(((# - centroids[LeftDoubleBracket]2 [RightDoubleBracket])) . ((# - centroids[LeftDoubleBracket]2 [RightDoubleBracket])) &) /@ pts[LeftDoubleBracket]2[RightDoubleBracket]]}; [IndentingNewLine]Switch[ isSlightlyCurved[pts, A, P, topo], [IndentingNewLine]True, Return[fitSlightlyCurved[pts, A, P]], [IndentingNewLine]False, Null, [IndentingNewLine]_, Print[isSlightlyCurved[pts, A, P, topo]]; Abort[][IndentingNewLine]]; [IndentingNewLine]t1 = directedArea[ pts[LeftDoubleBracket]1[RightDoubleBracket]] . ((centroids[LeftDoubleBracket]2[RightDoubleBracket] - centroids[LeftDoubleBracket]1[RightDoubleBracket])) ; t2 = directedArea[ pts[LeftDoubleBracket]2[RightDoubleBracket]] . ((centroids[LeftDoubleBracket]1[RightDoubleBracket] - centroids[LeftDoubleBracket]2[RightDoubleBracket])) ; [IndentingNewLine]Which[[IndentingNewLine]t1 > 0 && t2 > 0, t = 1, [IndentingNewLine]t2 < 0 && t2 < 0, t = (-1), [IndentingNewLine]True, Print[{<{t1,t2}>, {t1, t2}}]; Abort[][IndentingNewLine]]; [IndentingNewLine]distLine2 = (1/(a^2 + b^2 + c^2)) ((c^2 ((((x0 - xp))^2 + ((y0 - yp) )^2)) + b^2 ((((x0 - xp))^2 + ((z0 - zp))^2)) + a^2 ((((y0 - yp))^2 + ((z0 - zp))^2)) + 2 a c ((x0 - xp)) (((-z0) + zp)) + 2 b ((y0 - yp)) ((a (((-x0) + xp)) + c (((-z0) + zp)))))); {x1, y1, z1} = centroids[LeftDoubleBracket]1[RightDoubleBracket]; [IndentingNewLine]{a1, b1, c1} = centroids[LeftDoubleBracket]2[RightDoubleBracket] - centroids[LeftDoubleBracket]1[RightDoubleBracket]; r1 = (1/4) ([Sum]+(i = 1)%2 bounds[LeftDoubleBracket]i[RightDoubleBracket]); idir = ((Position[#, Max[#]] &)[ Abs /@ {a1, b1, c1}])[LeftDoubleBracket]1, 1[RightDoubleBracket]; [IndentingNewLine]varElim1 = Switch[idir, [IndentingNewLine]1, {a [Rule] a1, x0 [Rule] x1}, [IndentingNewLine]2, {b [Rule] b1, y0 [Rule] y1}, [IndentingNewLine]3, {c [Rule] c1, z0 [Rule] z1}[IndentingNewLine]]; [IndentingNewLine]varElim2 = Alternatives @@ varElim1 /. ((v_ [Rule] v1_)) [RuleDelayed] {v, v1}; [IndentingNewLine]initCond = Sequence @@ DeleteCases[{{a, a1}, {b, b1}, {c, c1}, {x0, x1}, {y0, y1}, {z0, z1}, {r, r1}}, varElim2]; [IndentingNewLine]distFunc[{x_, y_, z_}] := (((@distLine2 - r))^2 /. {xp [Rule] x, yp [Rule] y, zp [Rule] z}) /. varElim1; [IndentingNewLine]{answer, variance} = With[{n = Length[ ptsF]}, [IndentingNewLine]Check[[IndentingNewLine]FindMinimum[[Sum]+(i = 1)%n distFunc[ptsF[LeftDoubleBracket]i[RightDoubleBracket]], Evaluate@initCond, MaxIterations [Rule] 40], Message[fitSmooth::failed, ]; Abort[][IndentingNewLine]] /. {res_, ans_} [RuleDelayed] {ans [Union] varElim1, res/n}[IndentingNewLine]]; [IndentingNewLine]If[ varPlane/variance < margin^2, [IndentingNewLine]Message[ fitSmooth::bumpy]; Throw[varPlane/variance][IndentingNewLine]]; [IndentingNewLine]With[{spread = Max[bounds], sd = Sqrt[variance]}, If[sd > 0.15 spread, [IndentingNewLine]Message[ fitSmooth::lousy, sd, spread, ]; Throw[sd/ spread, ][IndentingNewLine]] [IndentingNewLine]]; [IndentingNewLine]If[ topo == , [IndentingNewLine]L = (@(# . #) &)[Subtract @@ centroids]; W = A/L, [IndentingNewLine]{L, W} = rectangleLW[A, P][IndentingNewLine]]; [IndentingNewLine]{{{x0, y0, z0}, {a, b, c}, t r} /. answer, variance, {L, W, {a, b, c} /. answer}}[IndentingNewLine]])], Input, InitializationCell->True] }, Open ]], Cell[CellGroupData[{ Cell[< Code[LongDash]curvature formulation, not used >, Subsubsection, PageWidth->WindowWidth, FontColor->RGBColor[0, 1, 0]], Cell[< v. 057 (12/11/97) Add A, P, open|closed to arg list; add {L,W,dirL} to return list v. 057 (1/16/98) Correct inconsistent use of Abs in determination of idir v. 064 (6/13/98) Add option Rectangle[Rule]False to call to fitPlane >, Text, PageWidth->WindowWidth, FontColor->RGBColor[0, 1, 0]], Cell[BoxData[ (Clear[fitCylinder])], Input, PageWidth->WindowWidth, Evaluatable->False, FontColor->RGBColor[0, 1, 0]], Cell[BoxData[ RowBox[{(fitCylinder[pts_, A_, P_, topo : | ]), :=, n, t, RowBox[{Module, [, RowBox[{({ptsF = Flatten[pts, 1], centroids, bounds, distLineM2, xp, yp, zp, x0, y0, z0, a, b, c, [Kappa], r, x1, y1, z1, a1, b1, c1, [Kappa]1, varElim1, varElim2, initCond, res, ans, answer, variance, varPlane, tiny = 0.01, margin = 1.5, big = 10^6, L, W}), ,, n, tt, RowBox[{(centroids = Map[Function[{oneEnd}, ntttttWith[{n = Length[ oneEnd]}, (1/n) ([Sum]+(i = 1)%n oneEnd[LeftDoubleBracket] i[RightDoubleBracket])]], pts]), ;, n, tt, (bounds = 2 {[Sqrt]Max[(((# - centroids[LeftDoubleBracket]1 [RightDoubleBracket])) . ((# - centroids[LeftDoubleBracket]1 [RightDoubleBracket])) &) /@ pts[LeftDoubleBracket]1[RightDoubleBracket]] , [Sqrt]Max[(((# - centroids[LeftDoubleBracket]2 [RightDoubleBracket])) . ((# - centroids[LeftDoubleBracket]2 [RightDoubleBracket])) &) /@ pts[LeftDoubleBracket]2[RightDoubleBracket]] }), ;, (Off[fitSmooth::]), ;, (varPlane = Catch[(fitPlane[ptsF, A, P, Rectangle [Rule] False])[LeftDoubleBracket]2 [RightDoubleBracket], , big]), ;, (On[fitSmooth::]), ;, n, tt, (If[varPlane < ((tiny Max[bounds]))^2, Message[fitSmooth::flat]; Throw[varPlane/((tiny Max[bounds]))^2]ntt]), ;, n, tt, StyleBox[(distLineM2 = ((a^2 + b^2 + c^2))/((c^2 ((((x0 - xp))^2 + ((y0 - yp))^2)) + b^2 ((((x0 - xp))^2 + ((z0 - zp))^2)) + a^2 ((((y0 - yp))^2 + ((z0 - zp))^2)) + 2 a c ((x0 - xp)) (((-z0) + zp)) + 2 b ((y0 - yp)) ((a (((-x0) + xp)) + c (((-z0) + zp))))))), FontColor->RGBColor[1, 0, 0]], ;, ({x1, y1, z1} = centroids[LeftDoubleBracket]1[RightDoubleBracket]), ;, ({a1, b1, c1} = centroids[LeftDoubleBracket]2[RightDoubleBracket] - centroids[LeftDoubleBracket]1[RightDoubleBracket]), ;, StyleBox[([Kappa]1 = 4/([Sum]+(i = 1)%2 bounds[LeftDoubleBracket]i[RightDoubleBracket] )), FontColor->RGBColor[1, 0, 0]], ;, (idir = ((Position[#, Max[#]] &)[ Abs /@ {a1, b1, c1}])[LeftDoubleBracket]1, 1[RightDoubleBracket]), ;, n, tt, (varElim1 = Switch[idir, ntttt1, {a [Rule] a1, x0 [Rule] x1}, ntttt2, {b [Rule] b1, y0 [Rule] y1}, ntttt3, {c [Rule] c1, z0 [Rule] z1}nttt]), ;, n, tt, (varElim2 = Alternatives @@ varElim1 /. ((v_ [Rule] v1_)) [RuleDelayed] {v, v1}), ;, (initCond = DeleteCases[{{a, a1}, {b, b1}, {c, c1}, {x0, x1}, {y0, y1}, {z0, z1}, {[Kappa], [Kappa]1}}, varElim2]), ;, n, ttt, RowBox[{(distFunc[{x_, y_, z_}]), :=, RowBox[{ RowBox[{ SuperscriptBox[ RowBox[{(, StyleBox[(@distLineM2 - [Kappa]), FontColor->RGBColor[1, 0, 0]], )}], 2], /., ({xp [Rule] x, yp [Rule] y, zp [Rule] z})}], /., varElim1}]}], ;, n, tt, RowBox[{({answer, variance}), =, RowBox[{With, [, RowBox[{({n = Length[ptsF]}), ,, n, tttt, RowBox[{(Check[ FindMinimum[[Sum]+(i = 1)%n distFunc[ ptsF[LeftDoubleBracket]i [RightDoubleBracket]], Evaluate[Sequence @@ initCond]], Message[fitSmooth::failed, ]; Abort[]]), /., RowBox[{({res_, ans_}), [RuleDelayed], RowBox[{{, RowBox[{(ans [Union] varElim1), ,, StyleBox[(res/(n [Kappa]^4)), FontColor->RGBColor[1, 0, 0]]}], }}]}]}]}], ]}]}], ;, n, tt, (If[varPlane/variance < margin^2, Message[ fitSmooth::bumpy]; (*Throw[ varPlane/variance]*) ntt]), ;, n, tt, (With[{spread = Max[bounds], sd = Sqrt[variance]}, If[sd > 0.15 spread, Message[fitSmooth::lousy, sd, spread, ]; Throw[sd/spread, ]]ntt]), ;, n, tt, (If[ topo == , ntttL = (@(# . #) &)[ Subtract @@ centroids]; W = A/L, nt {L, W} = rectangleLW[A, P]ntt]), ;, n, tt, ({{{x0, y0, z0}, {a, b, c}, r} /. answer, variance, {L, W, {a, b, c} /. answer}})}]}], n, t, ]}]}]], Input, PageWidth->WindowWidth, Evaluatable->False, FontColor->RGBColor[0, 1, 0]] }, Closed]] }, Closed]], Cell[CellGroupData[{ Cell[Local tests, Subsection, PageWidth->WindowWidth], Cell[BoxData[ (Clear[bump, pts, pointXYZ, plotData, ptsP, plotProjected, plotCylinder, myFit, variance, equivRect, c, [Theta], [Phi], A, P, firstEdge])], Input, PageWidth->WindowWidth], Cell[CellGroupData[{ Cell[Closed cylinder, Subsubsection, PageWidth->WindowWidth], Cell[BoxData[ (bump := Random[Real, {(- .05), .05}])], Input, PageWidth->WindowWidth], Cell[BoxData[{ ((SeedRandom[74125];)), n, ((pts = Map[Function[{angles}, {c, [Theta], [Phi]} = angles; ntttTable[ c + {nttttCos[[Theta]1 - [Theta]] Cos[[Phi]] + bump, nttttSin[[Theta]1 - [Theta]] Cos[[Phi]] + bump, nttttSin[[Theta]1 - [Theta]] Sin[[Phi]] + bump}, {[Theta]1, .5, 2 [Pi], .5}]], ntt{{{0, 0, 0}, 1, 2}, {{1, 2, 3}, 3, (-4)}}];))}], Input, PageWidth->WindowWidth], Cell[BoxData[ (firstEdge = pts[LeftDoubleBracket]2, 1[RightDoubleBracket] - pts[LeftDoubleBracket]1, 1[RightDoubleBracket])], Input], Cell[The area and perimeter are not necessarily realistic:, Text, PageWidth->WindowWidth], Cell[BoxData[ (({A, P} = {10, 4};))], Input, PageWidth->WindowWidth], Cell[BoxData[ (Needs[])], Input, PageWidth->WindowWidth], Cell[BoxData[ ((plotData = ScatterPlot3D[Flatten[pts, 1]];))], Input, PageWidth->WindowWidth], Cell[BoxData[ ({myFit, variance, equivRect} = fitCylinder[pts, A, P, ])], Input, PageWidth->WindowWidth], Cell[< The dot product of the direction vector with the first edge is positive, >, Text], Cell[BoxData[ (firstEdge . myFit[LeftDoubleBracket]2[RightDoubleBracket])], Input], Cell[but if it isn't, one can change it's sign:, Text], Cell[BoxData[ (If[ firstEdge . myFit[LeftDoubleBracket]2[RightDoubleBracket] < 0, myFit[LeftDoubleBracket]2[RightDoubleBracket] = (-myFit [LeftDoubleBracket]2[RightDoubleBracket])])], Input], Cell[BoxData[ (Clear[u, v])], Input, PageWidth->WindowWidth], Cell[Here is a parametric equation for the fitted cylinder:, Text, PageWidth->WindowWidth], Cell[BoxData[ (Module[{e1, v12, r, bx, by, bz}, ntt{e1, v12, r} = myFit; nt{bx, by, bz} = basis[v12]; nt pointXYZ = e1 + v v12 + r bx Cos[2 [Pi] u] + r by Sin[2 [Pi] u]])], Input, PageWidth->WindowWidth], Cell[BoxData[ ((plotCylinder = Block[{$DisplayFunction = Identity}, ParametricPlot3D[ Evaluate@pointXYZ, {u, 0, 1}, {v, 0, 1}]];))], Input, PageWidth->WindowWidth], Cell[BoxData[ ((Show[plotCylinder, plotData];))], Input, PageWidth->WindowWidth] }, Open ]], Cell[CellGroupData[{ Cell[Open cylinder, Subsubsection, PageWidth->WindowWidth], Cell[TextData[{ Define two sets of points along two similarly oriented bumpy arcs whose centers are at separate points , StyleBox[c, FontSlant->Italic], . }], Text, PageWidth->WindowWidth], Cell[BoxData[ (Needs[])], Input, PageWidth->WindowWidth], Cell[First define a random bump in the range {-.05,.05}:, Text, PageWidth->WindowWidth], Cell[BoxData[ (bump := Random[Real, {(- .05), .05}])], Input, PageWidth->WindowWidth], Cell[BoxData[{ ((SeedRandom[12558];)), n, ((pts = Map[Function[{angles}, {c, [Theta], [Phi]} = angles; ntttTable[ c + {nttttCos[[Theta]1 - [Theta]] Cos[[Phi]] + bump, nttttSin[[Theta]1 - [Theta]] Cos[[Phi]] + bump, nttttSin[[Theta]1 - [Theta]] Sin[[Phi]] + bump}, {[Theta]1, 2.5, 3, .05}]], ntt{{{0, 0, 0}, 1, 2}, {{ .1, .2, .3}, 1, 2}}];))}], Input, PageWidth->WindowWidth], Cell[< The arcs describing the two ends each have a unit radius. The planes of these arcs, however, are not perpendicular to the generator of the cylinder. Were these arcs to be projected onto such planes, then their effective radii would be different. >, Text, PageWidth->WindowWidth], Cell[< These points are difficult to fit to a cylinder for three reasons: (1) they cover an arclength of only 3-2.5=0.5 radians (2) Although each of the two sets of points roughly arcs of equal radius, these two arcs do not lie in parallel planes, so they conflict as to what the radius of the cylinder should be. (3) The arcs are contaminated with a randomness which[LongDash]it is obvious by inspection of the following plot[LongDash]will interfer with fitting. >, Text, PageWidth->WindowWidth], Cell[Here is a plot of all these points:, Text, PageWidth->WindowWidth], Cell[BoxData[ ((plotData = ScatterPlot3D[Flatten[pts, 1]];))], Input, PageWidth->WindowWidth], Cell[BoxData[ ({myFit, variance, equivRect} = fitCylinder[pts, A, P, ])], Input, PageWidth->WindowWidth], Cell[< We should be able to fit a cylinder with this arc if the points are more precisely chosen. Next, define a random bump in the range {-.005,.+.005}: >, Text, PageWidth->WindowWidth], Cell[BoxData[ (bump := Random[Real, {(- .005), .005}])], Input, PageWidth->WindowWidth], Cell[BoxData[{ ((SeedRandom[55863];)), n, ((pts = Map[Function[{angles}, {c, [Theta], [Phi]} = angles; ntttTable[ c + {nttttCos[[Theta]1 - [Theta]] Cos[[Phi]] + bump, nttttSin[[Theta]1 - [Theta]] Cos[[Phi]] + bump, nttttSin[[Theta]1 - [Theta]] Sin[[Phi]] + bump}, {[Theta]1, 2.5, 3, .05}]], ntt{{{0, 0, 0}, 1, 2}, {{ .1, .2, .3}, 1, 2}}];))}], Input, PageWidth->WindowWidth], Cell[Here is a plot of all these points:, Text, PageWidth->WindowWidth], Cell[BoxData[ ((plotData = ScatterPlot3D[Flatten[pts, 1]];))], Input, PageWidth->WindowWidth], Cell[BoxData[ ({myFit, variance, equivRect} = fitCylinder[pts, A, P, ])], Input, PageWidth->WindowWidth], Cell[BoxData[ (firstEdge = pts[LeftDoubleBracket]2, 1[RightDoubleBracket] - pts[LeftDoubleBracket]1, 1[RightDoubleBracket])], Input], Cell[< The dot product of the direction vector with the first edge is positive, >, Text], Cell[BoxData[ (firstEdge . myFit[LeftDoubleBracket]2[RightDoubleBracket])], Input], Cell[but if it isn't, one can change it's sign:, Text], Cell[BoxData[ (If[ firstEdge . myFit[LeftDoubleBracket]2[RightDoubleBracket] < 0, myFit[LeftDoubleBracket]2[RightDoubleBracket] = (-myFit [LeftDoubleBracket]2[RightDoubleBracket])])], Input], Cell[< The radius of the cylinder exceeds the spread of the points; this will be a shallow shell. >, Text, PageWidth->WindowWidth], Cell[BoxData[ (Clear[u, v])], Input, PageWidth->WindowWidth], Cell[BoxData[ (Module[{e1, v12, r, bx, by, bz}, ntt{e1, v12, r} = myFit; nt{bx, by, bz} = basis[v12]; nt pointXYZ = e1 + v v12 + r bx Cos[2 [Pi] u] + r by Sin[2 [Pi] u]])], Input, PageWidth->WindowWidth], Cell[BoxData[ ((plotCylinder = Block[{$DisplayFunction = Identity}, ParametricPlot3D[ Evaluate@pointXYZ, {u, 0, 1}, {v, 0, 1}]];))], Input, PageWidth->WindowWidth], Cell[BoxData[ ((Show[plotCylinder, plotData];))], Input, PageWidth->WindowWidth], Cell[< This took a long time to fit. What happens if we try to fit a cylinder to what is really a flat plate. Let's see in the next section. >, Text, PageWidth->WindowWidth] }, Open ]], Cell[CellGroupData[{ Cell[Flat plate masquerading as cylinder, Subsubsection, PageWidth->WindowWidth], Cell[A radius cannot possibly be fitted to a flat plate., Text, PageWidth->WindowWidth], Cell[BoxData[ ((pts = (Table[# + {1, 2, 3} u, {u, 0, 1, .1}] &) /@ {{0, 0, 0}, {(-1), 2, .1}};))], Input, PageWidth->WindowWidth], Cell[< Here is a crude check that the two lines are parallel [LongDash]the ratio of the vectors connecting the two ends of each line: >, Text, PageWidth->WindowWidth], Cell[BoxData[ ((pts[([1, 1])] - pts[([1, (-1)])])/(pts[([2, 1])] - pts[([2, (-1)])]))], Input, PageWidth->WindowWidth], Cell[BoxData[ ((plotData = ScatterPlot3D[Flatten[pts, 1], AxesLabel -> {, , }];))], Input, PageWidth->WindowWidth], Cell[BoxData[ ({myFit, variance, equivRect} = fitCylinder[pts, A, P, ])], Input, PageWidth->WindowWidth] }, Open ]], Cell[CellGroupData[{ Cell[Clean up, Subsubsection, PageWidth->WindowWidth], Cell[BoxData[ (Clear[bump, pts, pointXYZ, plotData, ptsP, plotProjected, plotCylinder, myFit, variance, equivRect, firstEdge])], Input, PageWidth->WindowWidth] }, Open ]] }, Closed]], Cell[CellGroupData[{ Cell[Unused algorithm: Fitting indirectly, Subsection, PageWidth->WindowWidth], Cell[< This is a multistep process to fit a cylinder. It may be faster than the direct method, but it is definitely clumsy! >, Text, PageWidth->WindowWidth], Cell[CellGroupData[{ Cell[The plan, Subsubsection, PageWidth->WindowWidth], Cell[Find the centroid of the two ends., Text, PageWidth->WindowWidth], Cell[< Construct a line through these two centroids. This line will be parallel to the axis of the fitted cylinder. >, Text, PageWidth->WindowWidth], Cell[< Construct planes perpendicular to this line through the two centroids. These planes define the ends of an equivalent right cylinder. >, Text, PageWidth->WindowWidth], Cell[Project the points of each end onto its respective plane., Text, PageWidth->WindowWidth], Cell[< Fit either a circular arc or a circle to each set of projected points. Fit circular arcs for an open cylinder; fit circle for a closed cylinder. >, Text, PageWidth->WindowWidth], Cell[< The radius of the fitted cylinder is the arithmetic average of the radii of the two fitted circles or arc. The curvature of the fitted cylinder is the reciprocal of the fitted radius. >, Text, PageWidth->WindowWidth] }, Open ]], Cell[CellGroupData[{ Cell[Construct planes through centroids, Subsubsection, PageWidth->WindowWidth], Cell[< The two planes pass through the respective centroids, perpedicular to a line connecting the two centroids: >, Text, PageWidth->WindowWidth], Cell[BoxData[ (twoPlanes = nt With[{normal = coeff ((centroids[LeftDoubleBracket]2 [RightDoubleBracket] - centroids[LeftDoubleBracket]1[RightDoubleBracket]) )}, nttnormal /. nt Map[Function[{point}, First@Solve[point . normal == 1, coeff]], centroids]])], Input, PageWidth->WindowWidth], Cell[BoxData[ (twoPlanes[LeftDoubleBracket]1[RightDoubleBracket]/twoPlanes [LeftDoubleBracket]2[RightDoubleBracket])], Input, PageWidth->WindowWidth], Cell[< That the components are in a fixed ratio confirms that these two planes are parallel. >, Text, PageWidth->WindowWidth] }, Open ]], Cell[CellGroupData[{ Cell[Project the points onto respective planes, Subsubsection, PageWidth->WindowWidth], Cell[Construct the projected points:, Text, PageWidth->WindowWidth], Cell[BoxData[ ((projPoints = {nttpointsOnPlane[ twoPlanes[LeftDoubleBracket]1[RightDoubleBracket], pts[LeftDoubleBracket]1[RightDoubleBracket]], ntt pointsOnPlane[twoPlanes[LeftDoubleBracket]2[RightDoubleBracket], pts[LeftDoubleBracket]2[RightDoubleBracket]]nt };))], Input, PageWidth->WindowWidth], Cell[< Prepare but do not show a plot of these projected points in red. >, Text, PageWidth->WindowWidth], Cell[BoxData[ ((Block[{$DisplayFunction = Identity}, plotProjected = ScatterPlot3D[Flatten[projPoints, 1], PlotStyle [Rule] {Hue[1], PointSize[0.018]}]];))], Input, PageWidth->WindowWidth], Cell[< Show these projected points (red) along with the original points (black): >, Text, PageWidth->WindowWidth], Cell[BoxData[ ((Show[plotData, plotProjected, AxesLabel -> {, , }, ViewPoint -> {(-300.65), 140.16, (-100.29)}];))], Input, PageWidth->WindowWidth], Cell[< This doesn't look right. Do these points lie on the respective planes? Here are the residuals from plugging in the projected points in the equations for the respective planes: >, Text, PageWidth->WindowWidth], Cell[BoxData[ ((twoPlanes[LeftDoubleBracket]1[RightDoubleBracket] . # - 1 &) /@ projPoints[LeftDoubleBracket]1[RightDoubleBracket])], Input, PageWidth->WindowWidth], Cell[BoxData[ ((twoPlanes[LeftDoubleBracket]2[RightDoubleBracket] . # - 1 &) /@ projPoints[LeftDoubleBracket]2[RightDoubleBracket])], Input, PageWidth->WindowWidth], Cell[< These are indeed quite small, so the points lie on their respective planes. I guess that I don't understand the perspective effects in the preceding graph. >, Text, PageWidth->WindowWidth] }, Open ]], Cell[CellGroupData[{ Cell[Fit radii, Subsubsection, PageWidth->WindowWidth], Cell[For a circular arc, , Text, PageWidth->WindowWidth], Cell[BoxData[ (centroids)], Input, PageWidth->WindowWidth], Cell[Open cylinder, Text, PageWidth->WindowWidth], Cell[BoxData[ (datao = {r, {x, y, z}} /. Function[{oneEnd}, Module[{cx, cy, cz, pts}, ntt{{cx, cy, cz}, pts, bound} = oneEnd; n = Length[ pts]; ntt(FindMinimum[[Sum]+(i = 1)%n((r - [Sqrt]((((pts[LeftDoubleBracket]i[RightDoubleBracket] - {x, y, z})) . ((pts [LeftDoubleBracket]i[RightDoubleBracket] - {x, y, z}))))))^2, {r, bound/2}, {x, cx}, {y, cy}, {z, cz}])[LeftDoubleBracket]2[RightDoubleBracket]n t]] /@ Transpose[{centroids, projPoints, bounds}])], Input, PageWidth->WindowWidth], Cell[Closed cylinder, Text, PageWidth->WindowWidth], Cell[BoxData[ (datac = ntt{r, {x, y, z}} /. Function[{oneEnd}, Module[{cx, cy, cz, pts, bound}, ntt{{cx, cy, cz}, pts, bound} = oneEnd; n = Length[ pts]; nttCheck[nttttt (FindMinimum[[Sum]+(i = 1)%n((r - [Sqrt]((((pts [LeftDoubleBracket]i[RightDoubleBracket] - {x, y, z})) . ((pts [LeftDoubleBracket]i[RightDoubleBracket] - {x, y, z}))))))^2, {r, bound/2, 0, bound}, {x, cx}, {y, cy}, {z, cz}])[LeftDoubleBracket]2[RightDoubleBracket] , nttPrint[]; {r -> 0, x -> 0, y -> 0, z -> 0}nt]nt]] /@ Transpose[{centroids, projPoints, bounds}])], Input, PageWidth->WindowWidth], Cell[Select the data from the open-cylinder calculation for now:, Text, PageWidth->WindowWidth], Cell[BoxData[ (centers = datao /. {r_, {x_, y_, z_}} :> {x, y, z})], Input, PageWidth->WindowWidth], Cell[BoxData[ (radius = (1/2) Apply[Plus, datao /. {r_, {x_, y_, z_}} :> r])], Input, PageWidth->WindowWidth], Cell[The points at end 2 are indeed very badly spaced:, Text, PageWidth->WindowWidth], Cell[BoxData[ ((plotCenters = Block[{$DisplayFunction = Identity}, ScatterPlot3D[centers, PlotStyle [Rule] {PointSize[ .05], Hue[ .6]}]];))], Input, PageWidth->WindowWidth], Cell[BoxData[ ((Show[plotData, plotProjected, plotCentroids, plotCenters, ViewPoint -> {(-300.65), 140.16, (-100.29)}];))], Input, PageWidth->WindowWidth], Cell[BoxData[ (Clear[u, v])], Input, PageWidth->WindowWidth], Cell[BoxData[ (Module[{e1, v12, r, bx, by, bz}, ntt{e1, v12, r} = {centers[([1])], centers[([2])] - centers[([1])], radius}; nt{bx, by, bz} = basis[v12]; nt pointXYZ = e1 + v v12 + r bx Cos[2 [Pi] u] + r by Sin[2 [Pi] u]])], Input, PageWidth->WindowWidth], Cell[BoxData[ ((plotCylinder = Block[{$DisplayFunction = Identity}, ParametricPlot3D[ Evaluate@pointXYZ, {u, 0, 1}, {v, 0, 1}]];))], Input, PageWidth->WindowWidth], Cell[BoxData[ ((Show[plotCylinder, plotData];))], Input, PageWidth->WindowWidth] }, Open ]] }, Closed]] }, Closed]] }, Open ]] }, FrontEndVersion->5.0 for Macintosh, ScreenRectangle->{{0, 1876}, {0, 1178}}, AutoGeneratedPackage->Automatic, ScreenStyleEnvironment->Working, WindowSize->{794, 952}, WindowMargins->{{513, Automatic}, {54, Automatic}}, PageHeaders->{{Cell[ TextData[ { CounterBox[ Page]}], PageNumber], Inherited, Cell[ TextData[ { ValueBox[ FileName]}], Header]}, {Cell[ TextData[ { ValueBox[ FileName]}], Header], Inherited, Cell[ TextData[ { CounterBox[ Page]}], PageNumber]}}, PageFooters->{{ Inherited, Inherited, Inherited}, { Cell[ Vibro-Acoustic Sciences, Footer], Inherited, Cell[ TextData[ { ValueBox[ Time]}], Footer]}}, PageFooterLines->{Inherited, True}, CellElementSpacings->{ClosedCellHeight->0}, StyleDefinitions -> Notebook[{ Cell[CellGroupData[{ Cell[Style Definitions, Subtitle], Cell[< Modify the definitions below to change the default appearance of all cells in a given style. Make modifications to any definition using commands in the Format menu. >, Text], Cell[CellGroupData[{ Cell[Style Environment Names, Section], Cell[StyleData[All, Working], PageWidth->WindowWidth, ScriptMinSize->9], Cell[StyleData[All, Presentation], PageWidth->WindowWidth, ScriptMinSize->12, FontSize->16], Cell[StyleData[All, Condensed], PageWidth->WindowWidth, CellBracketOptions->{Margins->{1, 1}, Widths->{0, 5}}, ScriptMinSize->8, FontSize->11], Cell[StyleData[All, Printout], PageWidth->PaperWidth, ScriptMinSize->5, FontSize->10, PrivateFontOptions->{FontType->Outline}] }, Closed]], Cell[CellGroupData[{ Cell[Notebook Options, Section], Cell[< The options defined for the style below will be used at the Notebook level. >, Text], Cell[StyleData[Notebook], PageHeaders->{{Cell[ TextData[ { CounterBox[ Page]}], PageNumber], None, Cell[ TextData[ { ValueBox[ FileName]}], Header]}, {Cell[ TextData[ { ValueBox[ FileName]}], Header], None, Cell[ TextData[ { CounterBox[ Page]}], PageNumber]}}, CellFrameLabelMargins->6, StyleMenuListing->None] }, Closed]], Cell[CellGroupData[{ Cell[Styles for Headings, Section], Cell[CellGroupData[{ Cell[StyleData[Title], CellMargins->{{12, Inherited}, {20, 40}}, CellGroupingRules->{TitleGrouping, 0}, PageBreakBelow->False, CounterIncrements->Title, CounterAssignments->{{Section, 0}, {Equation, 0}, { Figure, 0}, {Subtitle, 0}, {Subsubtitle, 0}}, FontFamily->Helvetica, FontSize->36, FontWeight->Bold], Cell[StyleData[Title, Presentation], CellMargins->{{24, 10}, {20, 40}}, LineSpacing->{1, 0}, FontSize->44], Cell[StyleData[Title, Condensed], CellMargins->{{8, 10}, {4, 8}}, FontSize->20], Cell[StyleData[Title, Printout], CellMargins->{{2, 10}, {12, 30}}, FontSize->24] }, Closed]], Cell[CellGroupData[{ Cell[StyleData[Subtitle], CellMargins->{{12, Inherited}, {20, 15}}, CellGroupingRules->{TitleGrouping, 10}, PageBreakBelow->False, CounterIncrements->Subtitle, CounterAssignments->{{Section, 0}, {Equation, 0}, { Figure, 0}, {Subsubtitle, 0}}, FontFamily->Helvetica, FontSize->24], Cell[StyleData[Subtitle, Presentation], CellMargins->{{24, 10}, {20, 20}}, LineSpacing->{1, 0}, FontSize->36], Cell[StyleData[Subtitle, Condensed], CellMargins->{{8, 10}, {4, 4}}, FontSize->14], Cell[StyleData[Subtitle, Printout], CellMargins->{{2, 10}, {12, 8}}, FontSize->18] }, Closed]], Cell[CellGroupData[{ Cell[StyleData[Subsubtitle], ShowGroupOpenCloseIcon->True, CellMargins->{{12, Inherited}, {20, 15}}, CellGroupingRules->{TitleGrouping, 20}, PageBreakBelow->False, CounterIncrements->Subsubtitle, CounterAssignments->{{Section, 0}, {Equation, 0}, { Figure, 0}}, FontFamily->Helvetica, FontSize->14, FontSlant->Italic], Cell[StyleData[Subsubtitle, Presentation], CellMargins->{{24, 10}, {20, 20}}, LineSpacing->{1, 0}, FontSize->24], Cell[StyleData[Subsubtitle, Condensed], CellMargins->{{8, 10}, {8, 8}}, FontSize->12], Cell[StyleData[Subsubtitle, Printout], CellMargins->{{2, 10}, {12, 8}}, FontSize->14] }, Closed]], Cell[CellGroupData[{ Cell[StyleData[Section], CellDingbat->[FilledSquare], ShowGroupOpenCloseIcon->True, CellMargins->{{25, Inherited}, {8, 24}}, CellGroupingRules->{SectionGrouping, 30}, PageBreakBelow->False, CounterIncrements->Section, CounterAssignments->{{Subsection, 0}, {Subsubsection, 0}}, FontFamily->Helvetica, FontSize->16, FontWeight->Bold], Cell[StyleData[Section, Presentation], CellMargins->{{40, 10}, {11, 32}}, LineSpacing->{1, 0}, FontSize->24], Cell[StyleData[Section, Condensed], CellMargins->{{18, Inherited}, {6, 12}}, FontSize->12], Cell[StyleData[Section, Printout], CellMargins->{{13, 0}, {7, 22}}, FontSize->14] }, Closed]], Cell[CellGroupData[{ Cell[StyleData[Subsection], CellDingbat->[FilledSmallSquare], ShowGroupOpenCloseIcon->True, CellMargins->{{22, Inherited}, {8, 20}}, CellGroupingRules->{SectionGrouping, 40}, PageBreakBelow->False, CounterIncrements->Subsection, CounterAssignments->{{Subsubsection, 0}}, FontSize->14, FontWeight->Bold], Cell[StyleData[Subsection, Presentation], CellMargins->{{36, 10}, {11, 32}}, LineSpacing->{1, 0}, FontSize->22], Cell[StyleData[Subsection, Condensed], CellMargins->{{16, Inherited}, {6, 12}}, FontSize->12], Cell[StyleData[Subsection, Printout], CellMargins->{{9, 0}, {7, 22}}, FontSize->12] }, Closed]], Cell[CellGroupData[{ Cell[StyleData[Subsubsection], CellDingbat->[FilledSmallSquare], ShowGroupOpenCloseIcon->True, CellMargins->{{22, Inherited}, {8, 18}}, CellGroupingRules->{SectionGrouping, 50}, PageBreakBelow->False, CounterIncrements->Subsubsection, FontWeight->Bold], Cell[StyleData[Subsubsection, Presentation], CellMargins->{{34, 10}, {11, 26}}, LineSpacing->{1, 0}, FontSize->18], Cell[StyleData[Subsubsection, Condensed], CellMargins->{{17, Inherited}, {6, 12}}, FontSize->10], Cell[StyleData[Subsubsection, Printout], CellMargins->{{9, 0}, {7, 14}}, FontSize->11] }, Closed]] }, Closed]], Cell[CellGroupData[{ Cell[Styles for Body Text, Section], Cell[CellGroupData[{ Cell[StyleData[Text], CellMargins->{{12, 10}, {7, 7}}, LineSpacing->{1, 3}, CounterIncrements->Text], Cell[StyleData[Text, Presentation], CellMargins->{{24, 10}, {10, 10}}, LineSpacing->{1, 5}], Cell[StyleData[Text, Condensed], CellMargins->{{8, 10}, {6, 6}}, LineSpacing->{1, 1}], Cell[StyleData[Text, Printout], CellMargins->{{2, 2}, {6, 6}}] }, Closed]], Cell[CellGroupData[{ Cell[StyleData[Bulleted], CellDingbat->[FilledSmallCircle], CellMargins->{{36, 10}, {7, 7}}, LineSpacing->{1, 3}, CounterIncrements->Text], Cell[StyleData[Bulleted, Presentation], CellMargins->{{48, 10}, {10, 10}}, LineSpacing->{1, 5}], Cell[StyleData[Bulleted, Condensed], CellMargins->{{24, 10}, {6, 6}}, LineSpacing->{1, 1}], Cell[StyleData[Bulleted, Printout], CellMargins->{{18, 2}, {6, 6}}, FontSize->10] }, Closed]] }, Open ]], Cell[CellGroupData[{ Cell[Styles for Input/Output, Section], Cell[< The cells in this section define styles used for input and output to the kernel. Be careful when modifying, renaming, or removing these styles, because the front end associates special meanings with these style names. >, Text], Cell[CellGroupData[{ Cell[StyleData[Input], CellMargins->{{45, 10}, {5, 7}}, Evaluatable->True, CellGroupingRules->InputGrouping, CellHorizontalScrolling->True, PageBreakWithin->False, GroupPageBreakWithin->False, CellLabelMargins->{{11, Inherited}, {Inherited, Inherited}}, DefaultFormatType->DefaultInputFormatType, AutoItalicWords->{}, FormatType->InputForm, ShowStringCharacters->True, NumberMarks->True, CounterIncrements->Input, FontWeight->Bold], Cell[StyleData[Input, Presentation], CellMargins->{{72, Inherited}, {8, 10}}, LineSpacing->{1, 0}], Cell[StyleData[Input, Condensed], CellMargins->{{40, 10}, {2, 3}}], Cell[StyleData[Input, Printout], CellMargins->{{39, 0}, {4, 6}}, FontSize->9] }, Closed]], Cell[StyleData[InputOnly], Evaluatable->True, CellGroupingRules->InputGrouping, CellHorizontalScrolling->True, DefaultFormatType->DefaultInputFormatType, AutoItalicWords->{}, FormatType->InputForm, ShowStringCharacters->True, NumberMarks->True, CounterIncrements->Input, StyleMenuListing->None, FontWeight->Bold], Cell[CellGroupData[{ Cell[StyleData[Output], CellMargins->{{47, 10}, {7, 5}}, CellEditDuplicate->True, CellGroupingRules->OutputGrouping, CellHorizontalScrolling->True, PageBreakWithin->False, GroupPageBreakWithin->False, GeneratedCell->True, CellAutoOverwrite->True, CellLabelMargins->{{11, Inherited}, {Inherited, Inherited}}, DefaultFormatType->DefaultOutputFormatType, AutoItalicWords->{}, FormatType->InputForm, CounterIncrements->Output], Cell[StyleData[Output, Presentation], CellMargins->{{72, Inherited}, {10, 8}}, LineSpacing->{1, 0}], Cell[StyleData[Output, Condensed], CellMargins->{{41, Inherited}, {3, 2}}], Cell[StyleData[Output, Printout], CellMargins->{{39, 0}, {6, 4}}, FontSize->9] }, Closed]], Cell[CellGroupData[{ Cell[StyleData[Message], CellMargins->{{45, Inherited}, {Inherited, Inherited}}, CellGroupingRules->OutputGrouping, PageBreakWithin->False, GroupPageBreakWithin->False, GeneratedCell->True, CellAutoOverwrite->True, ShowCellLabel->False, CellLabelMargins->{{11, Inherited}, {Inherited, Inherited}}, DefaultFormatType->DefaultOutputFormatType, AutoItalicWords->{}, FormatType->InputForm, CounterIncrements->Message, StyleMenuListing->None, FontColor->RGBColor[0, 0, 1]], Cell[StyleData[Message, Presentation], CellMargins->{{72, Inherited}, {Inherited, Inherited}}, LineSpacing->{1, 0}], Cell[StyleData[Message, Condensed], CellMargins->{{41, Inherited}, {Inherited, Inherited}}], Cell[StyleData[Message, Printout], CellMargins->{{39, Inherited}, {Inherited, Inherited}}, FontSize->8, FontColor->GrayLevel[0]] }, Closed]], Cell[CellGroupData[{ Cell[StyleData[Print], CellMargins->{{45, Inherited}, {Inherited, Inherited}}, CellGroupingRules->OutputGrouping, CellHorizontalScrolling->True, PageBreakWithin->False, GroupPageBreakWithin->False, GeneratedCell->True, CellAutoOverwrite->True, ShowCellLabel->False, CellLabelMargins->{{11, Inherited}, {Inherited, Inherited}}, DefaultFormatType->DefaultOutputFormatType, AutoItalicWords->{}, FormatType->InputForm, CounterIncrements->Print, StyleMenuListing->None], Cell[StyleData[Print, Presentation], CellMargins->{{72, Inherited}, {Inherited, Inherited}}, LineSpacing->{1, 0}], Cell[StyleData[Print, Condensed], CellMargins->{{41, Inherited}, {Inherited, Inherited}}], Cell[StyleData[Print, Printout], CellMargins->{{39, Inherited}, {Inherited, Inherited}}, FontSize->8] }, Closed]], Cell[CellGroupData[{ Cell[StyleData[Graphics], CellMargins->{{4, Inherited}, {Inherited, Inherited}}, CellGroupingRules->GraphicsGrouping, CellHorizontalScrolling->True, PageBreakWithin->False, GeneratedCell->True, CellAutoOverwrite->True, ShowCellLabel->False, DefaultFormatType->DefaultOutputFormatType, FormatType->InputForm, CounterIncrements->Graphics, ImageMargins->{{43, Inherited}, {Inherited, 0}}, StyleMenuListing->None], Cell[StyleData[Graphics, Presentation], ImageMargins->{{62, Inherited}, {Inherited, 0}}], Cell[StyleData[Graphics, Condensed], ImageMargins->{{38, Inherited}, {Inherited, 0}}, Magnification->0.6], Cell[StyleData[Graphics, Printout], ImageMargins->{{30, Inherited}, {Inherited, 0}}, FontSize->9, Magnification->0.8] }, Closed]], Cell[CellGroupData[{ Cell[StyleData[CellLabel], StyleMenuListing->None, FontFamily->Helvetica, FontSize->9, FontColor->RGBColor[0, 0, 1]], Cell[StyleData[CellLabel, Presentation], FontSize->12], Cell[StyleData[CellLabel, Condensed], FontSize->9], Cell[StyleData[CellLabel, Printout], FontFamily->Courier, FontSize->8, FontSlant->Italic, FontColor->GrayLevel[0]] }, Closed]] }, Closed]], Cell[CellGroupData[{ Cell[More styles for Body Text, Section], Cell[CellGroupData[{ Cell[StyleData[SmallText], CellMargins->{{12, 10}, {6, 6}}, LineSpacing->{1, 3}, CounterIncrements->SmallText, FontFamily->Helvetica, FontSize->9], Cell[StyleData[SmallText, Presentation], CellMargins->{{24, 10}, {8, 8}}, LineSpacing->{1, 5}, FontSize->12], Cell[StyleData[SmallText, Condensed], CellMargins->{{8, 10}, {5, 5}}, LineSpacing->{1, 2}, FontSize->9], Cell[StyleData[SmallText, Printout], CellMargins->{{2, 2}, {5, 5}}, FontSize->7] }, Closed]], Cell[CellGroupData[{ Cell[StyleData[Caption], CellMargins->{{55, 50}, {5, 5}}, PageBreakAbove->False, Hyphenation->True, FontFamily->Ariel, FontSize->10, FontWeight->Bold], Cell[StyleData[Caption, Presentation], CellMargins->{{55, 50}, {5, 5}}, PageBreakAbove->False, Hyphenation->True, FontFamily->Ariel, FontSize->13, FontWeight->Bold], Cell[StyleData[Caption, Printout], CellMargins->{{55, 55}, {5, 2}}, FontSize->8] }, Closed]], Cell[CellGroupData[{ Cell[StyleData[Figure], CellMargins->{{55, 50}, {5, 5}}, PageBreakAbove->False, CellFrameLabels->{{Cell[ TextData[ {Figure , CounterBox[ Figure], . }]], None}, {None, None}}, Hyphenation->True, CounterIncrements->Figure, FontFamily->Ariel, FontSize->10, FontWeight->Bold], Cell[StyleData[Figure, Presentation], CellMargins->{{55, 50}, {5, 5}}, PageBreakAbove->False, Hyphenation->True, FontFamily->Ariel, FontSize->13, FontWeight->Bold], Cell[StyleData[Figure, Printout], CellMargins->{{55, 55}, {5, 2}}, FontSize->8] }, Closed]], Cell[CellGroupData[{ Cell[StyleData[Table], CellMargins->{{55, 50}, {5, 5}}, PageBreakAbove->False, CellFrameLabels->{{Cell[ TextData[ {Table , CounterBox[ Table], . }]], None}, {None, None}}, Hyphenation->True, CounterIncrements->Table, FontFamily->Ariel, FontSize->10, FontWeight->Bold], Cell[StyleData[Table, Presentation], CellMargins->{{55, 50}, {5, 5}}, PageBreakAbove->False, Hyphenation->True, FontFamily->Ariel, FontSize->13, FontWeight->Bold], Cell[StyleData[Table, Printout], CellMargins->{{55, 55}, {5, 2}}, FontSize->8] }, Closed]], Cell[CellGroupData[{ Cell[StyleData[Commentary], CellMargins->{{60, 20}, {2, 8}}, PageBreakBelow->False, TextJustification->1, Hyphenation->True, LineSpacing->{1, 2}, FontFamily->Helvetica, FontSize->10, FontColor->RGBColor[0, 0, 0.4]], Cell[StyleData[Commentary, Printout], CellMargins->{{9, 0}, {4, 4}}, LineSpacing->{1, 3}, FontSize->8] }, Closed]], Cell[CellGroupData[{ Cell[StyleData[DisplayText], CellFrame->0.5, CellMargins->{{60, 20}, {15, 5}}, LineSpacing->{0.2, 12}, ParagraphSpacing->{0, 6}, FontFamily->Helvetica, FontSize->12, FontWeight->Bold, FontSlant->Plain, Background->RGBColor[1, 1, 0.8]], Cell[StyleData[DisplayText, Printout], CellMargins->{{9, 0}, {4, 4}}, ParagraphSpacing->{0, 6}, FontSize->10, Background->GrayLevel[0.900008]] }, Closed]] }, Open ]], Cell[CellGroupData[{ Cell[Formulas and Programming, Section], Cell[CellGroupData[{ Cell[StyleData[InlineFormula], CellMargins->{{10, 4}, {0, 8}}, CellHorizontalScrolling->True, ScriptLevel->1, SingleLetterItalics->True], Cell[StyleData[InlineFormula, Presentation], CellMargins->{{24, 10}, {10, 10}}, LineSpacing->{1, 5}], Cell[StyleData[InlineFormula, Condensed], CellMargins->{{8, 10}, {6, 6}}, LineSpacing->{1, 1}], Cell[StyleData[InlineFormula, Printout], CellMargins->{{2, 0}, {6, 6}}] }, Closed]], Cell[CellGroupData[{ Cell[StyleData[DisplayFormula], CellMargins->{{42, Inherited}, {Inherited, Inherited}}, CellHorizontalScrolling->True, DefaultFormatType->DefaultInputFormatType, ScriptLevel->0, SingleLetterItalics->True, UnderoverscriptBoxOptions->{LimitsPositioning->True}], Cell[StyleData[DisplayFormula, Presentation], LineSpacing->{1, 5}], Cell[StyleData[DisplayFormula, Condensed], LineSpacing->{1, 1}], Cell[StyleData[DisplayFormula, Printout]] }, Closed]] }, Closed]], Cell[CellGroupData[{ Cell[Styles for Headers and Footers, Section], Cell[StyleData[Header], CellMargins->{{0, 0}, {4, 1}}, StyleMenuListing->None, FontSize->10, FontSlant->Italic], Cell[StyleData[Footer], CellMargins->{{0, 0}, {0, 4}}, StyleMenuListing->None, FontSize->9, FontSlant->Italic], Cell[StyleData[PageNumber], CellMargins->{{0, 0}, {4, 1}}, StyleMenuListing->None, FontFamily->Times, FontSize->10] }, Closed]], Cell[CellGroupData[{ Cell[Palette Styles, Section], Cell[< The cells below define styles that define standard ButtonFunctions, for use in palette buttons. >, Text], Cell[StyleData[Paste], StyleMenuListing->None, ButtonStyleMenuListing->Automatic, ButtonBoxOptions->{ButtonFunction:>(FrontEndExecute[ { FrontEnd`NotebookApply[ FrontEnd`InputNotebook[ ], #, After]}]&)}], Cell[StyleData[Evaluate], StyleMenuListing->None, ButtonStyleMenuListing->Automatic, ButtonBoxOptions->{ButtonFunction:>(FrontEndExecute[ { FrontEnd`NotebookApply[ FrontEnd`InputNotebook[ ], #, All], SelectionEvaluate[ FrontEnd`InputNotebook[ ], All]}]&)}], Cell[StyleData[EvaluateCell], StyleMenuListing->None, ButtonStyleMenuListing->Automatic, ButtonBoxOptions->{ButtonFunction:>(FrontEndExecute[ { FrontEnd`NotebookApply[ FrontEnd`InputNotebook[ ], #, All], FrontEnd`SelectionMove[ FrontEnd`InputNotebook[ ], All, Cell, 1], FrontEnd`SelectionEvaluateCreateCell[ FrontEnd`InputNotebook[ ], All]}]&)}], Cell[StyleData[CopyEvaluate], StyleMenuListing->None, ButtonStyleMenuListing->Automatic, ButtonBoxOptions->{ButtonFunction:>(FrontEndExecute[ { FrontEnd`SelectionCreateCell[ FrontEnd`InputNotebook[ ], All], FrontEnd`NotebookApply[ FrontEnd`InputNotebook[ ], #, All], FrontEnd`SelectionEvaluate[ FrontEnd`InputNotebook[ ], All]}]&)}], Cell[StyleData[CopyEvaluateCell], StyleMenuListing->None, ButtonStyleMenuListing->Automatic, ButtonBoxOptions->{ButtonFunction:>(FrontEndExecute[ { FrontEnd`SelectionCreateCell[ FrontEnd`InputNotebook[ ], All], FrontEnd`NotebookApply[ FrontEnd`InputNotebook[ ], #, All], FrontEnd`SelectionEvaluateCreateCell[ FrontEnd`InputNotebook[ ], All]}]&)}] }, Closed]], Cell[CellGroupData[{ Cell[Hyperlink Styles, Section], Cell[< The cells below define styles useful for making hypertext ButtonBoxes. The Hyperlink style is for links within the same Notebook, or between Notebooks. >, Text], Cell[CellGroupData[{ Cell[StyleData[Hyperlink], StyleMenuListing->None, ButtonStyleMenuListing->Automatic, FontColor->RGBColor[0, 0, 1], FontVariations->{Underline->True}, ButtonBoxOptions->{ButtonFunction:>(FrontEndExecute[ { FrontEnd`NotebookLocate[ #2]}]&), Active->True, ButtonNote->ButtonData}], Cell[StyleData[Hyperlink, Presentation]], Cell[StyleData[Hyperlink, Condensed]], Cell[StyleData[Hyperlink, Printout], FontColor->GrayLevel[0], FontVariations->{Underline->False}] }, Closed]], Cell[< The following styles are for linking automatically to the on-line help system. >, Text], Cell[CellGroupData[{ Cell[StyleData[MainBookLink], StyleMenuListing->None, ButtonStyleMenuListing->Automatic, FontColor->RGBColor[0, 0, 1], FontVariations->{Underline->True}, ButtonBoxOptions->{ButtonFunction:>(FrontEndExecute[ { FrontEnd`HelpBrowserLookup[ MainBook, #]}]&), Active->True, ButtonFrame->None}], Cell[StyleData[MainBookLink, Presentation]], Cell[StyleData[MainBookLink, Condensed]], Cell[StyleData[MainBookLink, Printout], FontColor->GrayLevel[0], FontVariations->{Underline->False}] }, Closed]], Cell[CellGroupData[{ Cell[StyleData[AddOnsLink], StyleMenuListing->None, ButtonStyleMenuListing->Automatic, FontFamily->Courier, FontColor->RGBColor[0, 0, 1], FontVariations->{Underline->True}, ButtonBoxOptions->{ButtonFunction:>(FrontEndExecute[ { FrontEnd`HelpBrowserLookup[ AddOns, #]}]&), Active->True, ButtonFrame->None}], Cell[StyleData[AddOnsLink, Presentation]], Cell[StyleData[AddOnsLink, Condensed]], Cell[StyleData[AddOnLink, Printout], FontColor->GrayLevel[0], FontVariations->{Underline->False}] }, Closed]], Cell[CellGroupData[{ Cell[StyleData[RefGuideLink], StyleMenuListing->None, ButtonStyleMenuListing->Automatic, FontFamily->Courier, FontColor->RGBColor[0, 0, 1], FontVariations->{Underline->True}, ButtonBoxOptions->{ButtonFunction:>(FrontEndExecute[ { FrontEnd`HelpBrowserLookup[ RefGuideLink, #]}]&), Active->True, ButtonFrame->None}], Cell[StyleData[RefGuideLink, Presentation]], Cell[StyleData[RefGuideLink, Condensed]], Cell[StyleData[RefGuideLink, Printout], FontColor->GrayLevel[0], FontVariations->{Underline->False}] }, Closed]], Cell[CellGroupData[{ Cell[StyleData[GettingStartedLink], StyleMenuListing->None, ButtonStyleMenuListing->Automatic, FontColor->RGBColor[0, 0, 1], FontVariations->{Underline->True}, ButtonBoxOptions->{ButtonFunction:>(FrontEndExecute[ { FrontEnd`HelpBrowserLookup[ GettingStarted, #]}]&), Active->True, ButtonFrame->None}], Cell[StyleData[GettingStartedLink, Presentation]], Cell[StyleData[GettingStartedLink, Condensed]], Cell[StyleData[GettingStartedLink, Printout], FontColor->GrayLevel[0], FontVariations->{Underline->False}] }, Closed]], Cell[CellGroupData[{ Cell[StyleData[OtherInformationLink], StyleMenuListing->None, ButtonStyleMenuListing->Automatic, FontColor->RGBColor[0, 0, 1], FontVariations->{Underline->True}, ButtonBoxOptions->{ButtonFunction:>(FrontEndExecute[ { FrontEnd`HelpBrowserLookup[ OtherInformation, #]}]&), Active->True, ButtonFrame->None}], Cell[StyleData[OtherInformationLink, Presentation]], Cell[StyleData[OtherInformationLink, Condensed]], Cell[StyleData[OtherInformationLink, Printout], FontColor->GrayLevel[0], FontVariations->{Underline->False}] }, Closed]] }, Closed]], Cell[CellGroupData[{ Cell[Placeholder Styles, Section], Cell[< The cells below define styles useful for making placeholder objects in palette templates. >, Text], Cell[CellGroupData[{ Cell[StyleData[Placeholder], Editable->False, Selectable->False, StyleBoxAutoDelete->True, Placeholder->True, StyleMenuListing->None], Cell[StyleData[Placeholder, Presentation]], Cell[StyleData[Placeholder, Condensed]], Cell[StyleData[Placeholder, Printout]] }, Closed]], Cell[CellGroupData[{ Cell[StyleData[SelectionPlaceholder], Editable->False, Selectable->False, StyleBoxAutoDelete->True, Placeholder->PrimaryPlaceholder, StyleMenuListing->None, DrawHighlighted->True], Cell[StyleData[SelectionPlaceholder, Presentation]], Cell[StyleData[SelectionPlaceholder, Condensed]], Cell[StyleData[SelectionPlaceholder, Printout]] }, Closed]] }, Closed]], Cell[CellGroupData[{ Cell[FormatType Styles, Section], Cell[< The cells below define styles that are mixed in with the styles of most cells. If a cell's FormatType matches the name of one of the styles defined below, then that style is applied between the cell's style and its own options. >, Text], Cell[StyleData[CellExpression], PageWidth->Infinity, CellMargins->{{6, Inherited}, {Inherited, Inherited}}, ShowCellLabel->False, ShowSpecialCharacters->False, AllowInlineCells->False, AutoItalicWords->{}, StyleMenuListing->None, FontFamily->Courier, FontSize->12, Background->GrayLevel[1]], Cell[StyleData[InputForm], AllowInlineCells->False, StyleMenuListing->None, FontFamily->Courier], Cell[StyleData[OutputForm], PageWidth->Infinity, TextAlignment->Left, LineSpacing->{0.6, 1}, StyleMenuListing->None, FontFamily->Courier], Cell[StyleData[StandardForm], LineSpacing->{1.25, 0}, StyleMenuListing->None, FontFamily->Courier], Cell[StyleData[TraditionalForm], LineSpacing->{1.25, 0}, SingleLetterItalics->True, TraditionalFunctionNotation->True, DelimiterMatching->None, StyleMenuListing->None], Cell[< The style defined below is mixed in to any cell that is in an inline cell within another. >, Text], Cell[StyleData[InlineCell], TextAlignment->Left, ScriptLevel->1, StyleMenuListing->None], Cell[StyleData[InlineCellEditing], StyleMenuListing->None, Background->RGBColor[1, 0.749996, 0.8]] }, Closed]] }, Open ]] }] ] (******************************************************************* Cached data follows. If you edit this Notebook file directly, not using Mathematica, you must remove the line containing CacheID at the top of the file. The cache data will then be recreated when you save this file from within Mathematica. *******************************************************************) (*CellTagsOutline CellTagsIndex->{ hide->{ Cell[3129, 99, 80, 2, 79, Section, CellTags->hide], Cell[73536, 2473, 76, 2, 65, Subsection, CellTags->hide]}, isSlightlyCurved->{ Cell[26406, 897, 70, 1, 39, Subsection, CellTags->isSlightlyCurved]}, directedArea->{ Cell[36039, 1203, 63, 1, 39, Subsection, CellTags->directedArea]}, s.fitSlightlyCurved->{ Cell[38243, 1287, 81, 1, 47, Section, CellTags->s.fitSlightlyCurved]}, fitCylinder->{ Cell[51715, 1732, 121, 2, 47, Section, CellTags->{fitCylinder, s.fitCylinder}]}, s.fitCylinder->{ Cell[51715, 1732, 121, 2, 47, Section, CellTags->{fitCylinder, s.fitCylinder}]}, equivRect->{ Cell[70727, 2386, 96, 2, 39, Subsubsection, CellTags->equivRect]} } *) (*CellTagsIndex CellTagsIndex->{ {hide, 134072, 4426}, {isSlightlyCurved, 134235, 4431}, {directedArea, 134339, 4434}, {s.fitSlightlyCurved, 134447, 4437}, {fitCylinder, 134551, 4440}, {s.fitCylinder, 134669, 4443}, {equivRect, 134783, 4446} } *) (*NotebookFileOutline Notebook[{ Cell[CellGroupData[{ Cell[1776, 53, 28, 0, 146, Title], Cell[1807, 55, 54, 0, 90, Subtitle], Cell[1864, 57, 223, 8, 75, Subsubtitle], Cell[2090, 67, 478, 13, 99, Text], Cell[2571, 82, 265, 5, 99, Text], Cell[2839, 89, 265, 6, 73, Text], Cell[CellGroupData[{ Cell[3129, 99, 80, 2, 79, Section, CellTags->hide], Cell[3212, 103, 54, 1, 39, Input], Cell[3269, 106, 177, 4, 62, Input, InitializationCell->True], Cell[3449, 112, 252, 5, 108, Input, InitializationCell->True], Cell[3704, 119, 381, 7, 154, Input, InitializationCell->True], Cell[4088, 128, 289, 6, 108, Input, InitializationCell->True], Cell[4380, 136, 521, 17, 99, Text], Cell[4904, 155, 129, 3, 39, Input, InitializationCell->True], Cell[CellGroupData[{ Cell[5058, 162, 45, 0, 65, Subsection], Cell[5106, 164, 231, 6, 131, Input, InitializationCell->True] }, Open ]] }, Closed]], Cell[CellGroupData[{ Cell[5386, 176, 34, 0, 47, Section], Cell[5423, 178, 699, 27, 186, Text], Cell[CellGroupData[{ Cell[6147, 209, 40, 0, 65, Subsection], Cell[6190, 211, 475, 10, 70, Input, InitializationCell->True], Cell[6668, 223, 639, 18, 70, Text], Cell[7310, 243, 165, 3, 70, Input, InitializationCell->True], Cell[7478, 248, 166, 3, 70, Input, InitializationCell->True] }, Closed]], Cell[CellGroupData[{ Cell[7681, 256, 66, 1, 39, Subsection, Evaluatable->False], Cell[7750, 259, 228, 7, 73, Text, Evaluatable->False], Cell[CellGroupData[{ Cell[8003, 270, 29, 0, 62, Subsubsection], Cell[8035, 272, 380, 14, 71, Text, Evaluatable->False], Cell[8418, 288, 655, 14, 364, Input, InitializationCell->True] }, Open ]], Cell[CellGroupData[{ Cell[9110, 307, 36, 0, 62, Subsubsection], Cell[9149, 309, 199, 8, 70, Input] }, Closed]] }, Open ]], Cell[CellGroupData[{ Cell[9397, 323, 58, 0, 65, Subsection], Cell[9458, 325, 527, 16, 96, Text, Evaluatable->False], Cell[CellGroupData[{ Cell[10010, 345, 29, 0, 62, Subsubsection], Cell[10042, 347, 246, 6, 99, Text], Cell[10291, 355, 585, 21, 370, Input, InitializationCell->True] }, Open ]], Cell[CellGroupData[{ Cell[10913, 381, 36, 0, 62, Subsubsection], Cell[10952, 383, 226, 11, 113, Input], Cell[11181, 396, 47, 1, 39, Input] }, Open ]] }, Open ]], Cell[CellGroupData[{ Cell[11277, 403, 54, 0, 65, Subsection], Cell[11334, 405, 177, 4, 73, Text], Cell[11514, 411, 306, 10, 73, Text], Cell[CellGroupData[{ Cell[11845, 425, 29, 0, 62, Subsubsection], Cell[11877, 427, 169, 4, 99, Text], Cell[12049, 433, 590, 11, 345, Input, InitializationCell->True], Cell[12642, 446, 90, 3, 73, Text], Cell[12735, 451, 582, 11, 350, Input, InitializationCell->True] }, Open ]], Cell[CellGroupData[{ Cell[13354, 467, 36, 0, 62, Subsubsection], Cell[13393, 469, 153, 6, 70, Input], Cell[13549, 477, 153, 6, 70, Input] }, Closed]] }, Open ]], Cell[CellGroupData[{ Cell[13751, 489, 45, 0, 65, Subsection], Cell[13799, 491, 1111, 25, 255, Text], Cell[14913, 518, 811, 30, 161, Text], Cell[CellGroupData[{ Cell[15749, 552, 30, 0, 62, Subsubsection], Cell[15782, 554, 196, 4, 85, Input, InitializationCell->True] }, Open ]], Cell[CellGroupData[{ Cell[16015, 563, 29, 0, 62, Subsubsection], Cell[16047, 565, 46, 0, 47, Text], Cell[16096, 567, 1039, 23, 349, Input, InitializationCell->True], Cell[17138, 592, 302, 6, 99, Text], Cell[17443, 600, 1420, 29, 378, Input], Cell[18866, 631, 302, 6, 99, Text] }, Open ]] }, Closed]] }, Closed]], Cell[CellGroupData[{ Cell[19229, 644, 28, 0, 47, Section], Cell[CellGroupData[{ Cell[19282, 648, 41, 0, 65, Subsection], Cell[19326, 650, 68, 0, 31, Text], Cell[CellGroupData[{ Cell[19419, 654, 36, 0, 49, Subsubsection], Cell[19458, 656, 104, 3, 36, Text], Cell[19565, 661, 280, 6, 109, Input], Cell[19848, 669, 102, 2, 57, Text], Cell[19953, 673, 1210, 27, 259, Input], Cell[21166, 702, 71, 0, 36, Text], Cell[21240, 704, 110, 3, 36, Input], Cell[21353, 709, 61, 0, 36, Text], Cell[21417, 711, 300, 8, 140, Input], Cell[21720, 721, 78, 1, 36, Text], Cell[21801, 724, 49, 1, 33, Input], Cell[21853, 727, 68, 1, 56, Text], Cell[21924, 730, 81, 2, 53, Input], Cell[22008, 734, 185, 7, 56, Text], Cell[22196, 743, 82, 2, 53, Input], Cell[22281, 747, 70, 1, 56, Text], Cell[22354, 750, 93, 2, 53, Input], Cell[22450, 754, 221, 6, 75, Text], Cell[22674, 762, 101, 3, 36, Text], Cell[22778, 767, 107, 2, 33, Input], Cell[22888, 771, 115, 3, 36, Text], Cell[23006, 776, 39, 1, 33, Input], Cell[23048, 779, 40, 1, 33, Input], Cell[23091, 782, 114, 3, 36, Text], Cell[23208, 787, 158, 3, 71, Input], Cell[23369, 792, 46, 0, 36, Text], Cell[23418, 794, 95, 2, 33, Input], Cell[23516, 798, 30, 0, 36, Text], Cell[23549, 800, 43, 1, 33, Input], Cell[23595, 803, 50, 0, 36, Text], Cell[23648, 805, 61, 1, 79, Input], Cell[23712, 808, 87, 3, 36, Text], Cell[23802, 813, 52, 1, 55, Input], Cell[23857, 816, 69, 0, 36, Text], Cell[23929, 818, 65, 1, 58, Input], Cell[23997, 821, 31, 0, 36, Text], Cell[24031, 823, 78, 1, 79, Input], Cell[24112, 826, 103, 2, 33, Input] }, Open ]], Cell[CellGroupData[{ Cell[24252, 833, 30, 0, 49, Subsubsection], Cell[24285, 835, 165, 3, 33, Input, InitializationCell->True] }, Open ]], Cell[CellGroupData[{ Cell[24487, 843, 29, 0, 49, Subsubsection], Cell[24519, 845, 1715, 38, 548, Input, InitializationCell->True] }, Open ]], Cell[CellGroupData[{ Cell[26271, 888, 36, 0, 49, Subsubsection], Cell[26310, 890, 47, 1, 33, Input] }, Open ]] }, Closed]], Cell[CellGroupData[{ Cell[26406, 897, 70, 1, 39, Subsection, CellTags->isSlightlyCurved], Cell[26479, 900, 56, 1, 39, Input], Cell[26538, 903, 202, 4, 73, Text], Cell[CellGroupData[{ Cell[26765, 911, 30, 0, 62, Subsubsection], Cell[26798, 913, 218, 4, 85, Input, InitializationCell->True], Cell[27019, 919, 308, 8, 125, Text], Cell[27330, 929, 123, 3, 39, Input, InitializationCell->True] }, Open ]], Cell[CellGroupData[{ Cell[27490, 937, 29, 0, 62, Subsubsection], Cell[27522, 939, 117, 4, 39, SmallText], Cell[27642, 945, 1981, 42, 796, Input, InitializationCell->True] }, Open ]], Cell[CellGroupData[{ Cell[29660, 992, 42, 0, 62, Subsubsection], Cell[29705, 994, 241, 5, 99, Text], Cell[29949, 1001, 473, 9, 151, Text], Cell[30425, 1012, 219, 5, 73, Text], Cell[30647, 1019, 158, 4, 73, Text], Cell[30808, 1025, 55, 0, 47, Text], Cell[30866, 1027, 122, 3, 47, Text], Cell[30991, 1032, 255, 5, 99, Text], Cell[31249, 1039, 52, 0, 47, Text], Cell[31304, 1041, 289, 7, 125, Text] }, Open ]] }, Open ]], Cell[CellGroupData[{ Cell[31642, 1054, 38, 0, 65, Subsection], Cell[31683, 1056, 147, 4, 31, Text], Cell[31833, 1062, 56, 1, 33, Input], Cell[CellGroupData[{ Cell[31914, 1067, 30, 0, 49, Subsubsection], Cell[31947, 1069, 231, 4, 71, Input, InitializationCell->True] }, Open ]], Cell[CellGroupData[{ Cell[32215, 1078, 38, 0, 49, Subsubsection], Cell[32256, 1080, 278, 8, 74, Text], Cell[32537, 1090, 620, 12, 226, Input, InitializationCell->True] }, Open ]], Cell[CellGroupData[{ Cell[33194, 1107, 40, 0, 49, Subsubsection], Cell[33237, 1109, 472, 14, 112, Text], Cell[33712, 1125, 503, 11, 158, Input, InitializationCell->True] }, Open ]], Cell[CellGroupData[{ Cell[34252, 1141, 56, 0, 49, Subsubsection], Cell[34311, 1143, 120, 3, 36, Text], Cell[34434, 1148, 346, 8, 52, Input, InitializationCell->True] }, Open ]], Cell[CellGroupData[{ Cell[34817, 1161, 36, 0, 49, Subsubsection], Cell[34856, 1163, 50, 0, 36, Text], Cell[34909, 1165, 100, 2, 33, Input], Cell[35012, 1169, 593, 12, 147, Input], Cell[35608, 1183, 76, 1, 33, Input], Cell[35687, 1186, 105, 3, 36, Text], Cell[35795, 1191, 75, 1, 33, Input], Cell[35873, 1194, 37, 0, 36, Text], Cell[35913, 1196, 77, 1, 33, Input] }, Open ]] }, Closed]], Cell[CellGroupData[{ Cell[36039, 1203, 63, 1, 39, Subsection, CellTags->directedArea], Cell[36105, 1206, 198, 4, 50, Text], Cell[CellGroupData[{ Cell[36328, 1214, 30, 0, 49, Subsubsection], Cell[36361, 1216, 236, 4, 71, Input, InitializationCell->True] }, Open ]], Cell[CellGroupData[{ Cell[36634, 1225, 29, 0, 49, Subsubsection], Cell[36666, 1227, 354, 8, 109, Input, InitializationCell->True], Cell[37023, 1237, 34, 0, 36, Text], Cell[37060, 1239, 71, 1, 33, Input] }, Open ]], Cell[CellGroupData[{ Cell[37168, 1245, 36, 0, 49, Subsubsection], Cell[37207, 1247, 35, 0, 36, Text], Cell[37245, 1249, 112, 2, 71, Input], Cell[37360, 1253, 112, 2, 71, Input] }, Open ]] }, Closed]], Cell[CellGroupData[{ Cell[37521, 1261, 33, 0, 39, Subsection], Cell[37557, 1263, 205, 4, 50, Text], Cell[37765, 1269, 188, 4, 52, Input, InitializationCell->True], Cell[37956, 1275, 238, 6, 157, Input, InitializationCell->True] }, Closed]] }, Closed]], Cell[CellGroupData[{ Cell[38243, 1287, 81, 1, 47, Section, CellTags->s.fitSlightlyCurved], Cell[38327, 1290, 431, 8, 125, Text], Cell[CellGroupData[{ Cell[38783, 1302, 33, 0, 65, Subsection], Cell[CellGroupData[{ Cell[38841, 1306, 89, 1, 62, Subsubsection], Cell[38933, 1309, 267, 8, 50, Text], Cell[39203, 1319, 81, 1, 36, Text], Cell[39287, 1322, 41, 1, 33, Input], Cell[39331, 1325, 100, 2, 33, Input], Cell[39434, 1329, 667, 14, 147, Input], Cell[40104, 1345, 321, 6, 74, Text], Cell[40428, 1353, 70, 1, 33, Input], Cell[40501, 1356, 160, 4, 55, Text], Cell[40664, 1362, 66, 1, 33, Input], Cell[40733, 1365, 232, 5, 52, Input] }, Closed]], Cell[CellGroupData[{ Cell[41002, 1375, 45, 0, 39, Subsubsection], Cell[41050, 1377, 49, 0, 31, Text], Cell[41102, 1379, 77, 1, 62, Input], Cell[41182, 1382, 174, 4, 55, Text], Cell[41359, 1388, 599, 14, 65, Input] }, Closed]], Cell[CellGroupData[{ Cell[41995, 1407, 36, 0, 39, Subsubsection], Cell[42034, 1409, 46, 1, 28, Input], Cell[42083, 1412, 186, 4, 33, Input], Cell[42272, 1418, 442, 8, 93, Text] }, Closed]], Cell[CellGroupData[{ Cell[42751, 1431, 43, 0, 39, Subsubsection], Cell[42797, 1433, 99, 3, 31, Text], Cell[42899, 1438, 102, 2, 33, Input] }, Closed]], Cell[CellGroupData[{ Cell[43038, 1445, 55, 0, 39, Subsubsection], Cell[43096, 1447, 156, 4, 50, Text], Cell[43255, 1453, 65, 1, 33, Input], Cell[43323, 1456, 87, 3, 36, Text], Cell[43413, 1461, 107, 2, 33, Input], Cell[43523, 1465, 32, 0, 36, Text], Cell[43558, 1467, 111, 2, 33, Input], Cell[43672, 1471, 268, 11, 36, Text], Cell[43943, 1484, 160, 3, 33, Input], Cell[44106, 1489, 44, 0, 36, Text], Cell[44153, 1491, 160, 3, 33, Input] }, Closed]], Cell[CellGroupData[{ Cell[44350, 1499, 39, 0, 39, Subsubsection], Cell[44392, 1501, 47, 1, 28, Input], Cell[44442, 1504, 68, 1, 33, Input], Cell[44513, 1507, 68, 1, 33, Input], Cell[44584, 1510, 73, 1, 33, Input], Cell[44660, 1513, 73, 1, 33, Input], Cell[44736, 1516, 45, 0, 36, Text], Cell[44784, 1518, 51, 1, 57, Input] }, Closed]], Cell[CellGroupData[{ Cell[44872, 1524, 80, 1, 39, Subsubsection], Cell[44955, 1527, 130, 3, 31, Text], Cell[45088, 1532, 161, 3, 109, Input], Cell[45252, 1537, 63, 0, 36, Text], Cell[45318, 1539, 164, 3, 52, Input], Cell[45485, 1544, 144, 2, 33, Input] }, Closed]], Cell[CellGroupData[{ Cell[45666, 1551, 57, 0, 39, Subsubsection], Cell[45726, 1553, 495, 12, 125, Text], Cell[46224, 1567, 42, 1, 39, Input], Cell[46269, 1570, 50, 1, 39, Input], Cell[46322, 1573, 69, 1, 39, Input], Cell[46394, 1576, 388, 7, 125, Text], Cell[46785, 1585, 48, 1, 39, Input], Cell[46836, 1588, 62, 1, 39, Input], Cell[46901, 1591, 180, 6, 47, Text], Cell[47084, 1599, 135, 3, 62, Input], Cell[47222, 1604, 429, 10, 125, Text] }, Closed]] }, Closed]], Cell[CellGroupData[{ Cell[47700, 1620, 30, 0, 39, Subsection], Cell[CellGroupData[{ Cell[47755, 1624, 56, 1, 62, Subsubsection], Cell[47814, 1627, 377, 7, 154, Input, InitializationCell->True], Cell[48194, 1636, 1091, 28, 333, Text] }, Open ]], Cell[CellGroupData[{ Cell[49322, 1669, 29, 0, 62, Subsubsection], Cell[49354, 1671, 88, 3, 47, Text], Cell[49445, 1676, 2009, 39, 680, Input, InitializationCell->True] }, Open ]] }, Open ]], Cell[CellGroupData[{ Cell[51503, 1721, 33, 0, 65, Subsection], Cell[51539, 1723, 63, 0, 31, Text], Cell[51605, 1725, 61, 1, 33, Input] }, Closed]] }, Closed]], Cell[CellGroupData[{ Cell[51715, 1732, 121, 2, 47, Section, CellTags->{fitCylinder, s.fitCylinder}], Cell[51839, 1736, 349, 7, 125, Text], Cell[52191, 1745, 295, 6, 99, Text], Cell[CellGroupData[{ Cell[52511, 1755, 59, 1, 65, Subsection], Cell[52573, 1758, 420, 7, 154, Input], Cell[52996, 1767, 97, 2, 39, Input], Cell[53096, 1771, 421, 11, 99, Text], Cell[CellGroupData[{ Cell[53542, 1786, 86, 1, 62, Subsubsection], Cell[53631, 1789, 249, 8, 73, Text], Cell[53883, 1799, 169, 6, 47, Text], Cell[54055, 1807, 98, 2, 39, Input], Cell[54156, 1811, 598, 12, 200, Input], Cell[54757, 1825, 321, 6, 99, Text], Cell[55081, 1833, 70, 1, 39, Input], Cell[55154, 1836, 77, 1, 47, Text], Cell[55234, 1839, 92, 2, 39, Input], Cell[55329, 1843, 105, 2, 39, Input] }, Closed]], Cell[CellGroupData[{ Cell[55471, 1850, 79, 1, 39, Subsubsection], Cell[55553, 1853, 261, 7, 98, Input], Cell[55817, 1862, 102, 2, 47, Text], Cell[55922, 1866, 245, 6, 85, Input], Cell[56170, 1874, 96, 1, 47, Text], Cell[56269, 1877, 93, 2, 39, Input], Cell[56365, 1881, 206, 5, 73, Text], Cell[56574, 1888, 419, 9, 118, Input] }, Closed]], Cell[CellGroupData[{ Cell[57030, 1902, 54, 0, 39, Subsubsection], Cell[57087, 1904, 377, 7, 125, Text], Cell[57467, 1913, 78, 1, 39, Input], Cell[57548, 1916, 99, 2, 39, Input], Cell[57650, 1920, 246, 6, 39, Input], Cell[57899, 1928, 246, 6, 39, Input], Cell[58148, 1936, 181, 4, 73, Text], Cell[58332, 1942, 129, 2, 131, Input], Cell[58464, 1946, 305, 7, 99, Text], Cell[58772, 1955, 296, 8, 97, Text] }, Closed]], Cell[CellGroupData[{ Cell[59105, 1968, 73, 1, 39, Subsubsection], Cell[59181, 1971, 126, 3, 39, Input], Cell[59310, 1976, 76, 1, 47, Text], Cell[59389, 1979, 112, 3, 39, Input], Cell[59504, 1984, 170, 6, 47, Text], Cell[59677, 1992, 181, 4, 87, Input], Cell[59861, 1998, 126, 4, 47, Text], Cell[60115, 2009, 86, 1, 47, Text], Cell[60204, 2012, 143, 4, 39, Input], Cell[60350, 2018, 74, 1, 47, Text], Cell[60427, 2021, 147, 4, 64, Input], Cell[60577, 2027, 424, 10, 125, Text] }, Closed]], Cell[CellGroupData[{ Cell[61038, 2042, 68, 1, 39, Subsubsection], Cell[61109, 2045, 338, 15, 47, Text], Cell[61450, 2062, 69, 1, 47, Text], Cell[61522, 2065, 134, 4, 39, Input], Cell[61659, 2071, 197, 5, 39, Input], Cell[61859, 2078, 159, 3, 96, Input], Cell[62021, 2083, 82, 2, 83, Input], Cell[62106, 2087, 311, 7, 99, Text], Cell[62420, 2096, 181, 4, 58, Input], Cell[62604, 2102, 181, 5, 73, Text], Cell[62788, 2109, 246, 6, 150, Input], Cell[63037, 2117, 116, 4, 47, Text], Cell[63156, 2123, 150, 4, 58, Input], Cell[63309, 2129, 169, 5, 73, Text], Cell[63481, 2136, 179, 4, 81, Input], Cell[CellGroupData[{ Cell[63685, 2144, 256, 7, 81, Input, Evaluatable->False], Cell[63944, 2153, 360, 8, 157, Output] }, Open ]], Cell[64319, 2164, 187, 5, 73, Text], Cell[64509, 2171, 195, 4, 97, Input], Cell[64707, 2177, 227, 8, 47, Text], Cell[64937, 2187, 261, 7, 97, Input, Evaluatable->False], Cell[65201, 2196, 117, 4, 47, Text], Cell[65321, 2202, 78, 2, 58, Input], Cell[65402, 2206, 138, 4, 47, Text], Cell[65543, 2212, 284, 7, 104, Input] }, Open ]], Cell[CellGroupData[{ Cell[65864, 2224, 81, 1, 62, Subsubsection], Cell[65948, 2227, 100, 2, 58, Input], Cell[66051, 2231, 245, 7, 62, SmallText], Cell[66299, 2240, 80, 1, 47, Text], Cell[66382, 2243, 100, 2, 58, Input], Cell[66485, 2247, 370, 13, 73, Text], Cell[66858, 2262, 179, 4, 81, Input], Cell[67040, 2268, 87, 1, 47, Text], Cell[CellGroupData[{ Cell[67152, 2273, 255, 6, 108, Input, Evaluatable->False], Cell[67410, 2281, 569, 9, 183, Output] }, Open ]], Cell[67994, 2293, 135, 4, 47, Text], Cell[68132, 2299, 207, 5, 104, Input], Cell[68342, 2306, 92, 2, 58, Input], Cell[68437, 2310, 283, 8, 73, Text], Cell[68723, 2320, 119, 3, 58, Input] }, Open ]], Cell[CellGroupData[{ Cell[68879, 2328, 77, 1, 62, Subsubsection], Cell[68959, 2331, 499, 9, 151, Text], Cell[69461, 2342, 310, 7, 232, Input, Evaluatable->False], Cell[69774, 2351, 126, 4, 47, Text], Cell[69903, 2357, 260, 6, 73, Text], Cell[70166, 2365, 172, 4, 150, Input, Evaluatable->False], Cell[70341, 2371, 95, 3, 47, Text], Cell[70439, 2376, 251, 5, 108, Input, Evaluatable->False] }, Closed]], Cell[CellGroupData[{ Cell[70727, 2386, 96, 2, 39, Subsubsection, CellTags->equivRect], Cell[70826, 2390, 473, 9, 151, Text], Cell[71302, 2401, 160, 3, 96, Input], Cell[71465, 2406, 57, 1, 47, Text], Cell[71525, 2409, 103, 2, 65, Input], Cell[71631, 2413, 141, 4, 47, Text], Cell[71775, 2419, 66, 2, 58, Input], Cell[71844, 2423, 123, 4, 47, Text], Cell[71970, 2429, 396, 8, 208, Input], Cell[72369, 2439, 499, 9, 151, Text] }, Open ]], Cell[CellGroupData[{ Cell[72905, 2453, 59, 1, 62, Subsubsection], Cell[72967, 2456, 420, 7, 85, Input], Cell[73390, 2465, 97, 2, 33, Input] }, Closed]] }, Open ]], Cell[CellGroupData[{ Cell[73536, 2473, 76, 2, 65, Subsection, CellTags->hide], Cell[CellGroupData[{ Cell[73637, 2479, 56, 1, 62, Subsubsection], Cell[73696, 2482, 407, 7, 154, Input, InitializationCell->True], Cell[74106, 2491, 1125, 29, 333, Text] }, Open ]], Cell[CellGroupData[{ Cell[75268, 2525, 84, 1, 62, Subsubsection], Cell[75355, 2528, 632, 13, 229, Text], Cell[75990, 2543, 77, 2, 39, Input], Cell[76070, 2547, 5580, 105, 1930, Input, InitializationCell->True] }, Open ]], Cell[CellGroupData[{ Cell[81687, 2657, 139, 5, 62, Subsubsection], Cell[81829, 2664, 323, 9, 99, Text], Cell[82155, 2675, 131, 4, 39, Input, Evaluatable->False], Cell[82289, 2681, 6117, 126, 1622, Input, Evaluatable->False] }, Closed]] }, Closed]], Cell[CellGroupData[{ Cell[88455, 2813, 59, 1, 39, Subsection], Cell[88517, 2816, 210, 4, 85, Input], Cell[CellGroupData[{ Cell[88752, 2824, 66, 1, 62, Subsubsection], Cell[88821, 2827, 98, 2, 39, Input], Cell[88922, 2831, 598, 12, 200, Input], Cell[89523, 2845, 160, 3, 39, Input], Cell[89686, 2850, 95, 1, 47, Text], Cell[89784, 2853, 80, 2, 39, Input], Cell[89867, 2857, 92, 2, 39, Input], Cell[89962, 2861, 105, 2, 39, Input], Cell[90070, 2865, 133, 3, 62, Input], Cell[90206, 2870, 98, 3, 47, Text], Cell[90307, 2875, 99, 2, 39, Input], Cell[90409, 2879, 58, 0, 47, Text], Cell[90470, 2881, 222, 4, 39, Input], Cell[90695, 2887, 70, 2, 39, Input], Cell[90768, 2891, 96, 1, 47, Text], Cell[90867, 2894, 266, 6, 108, Input], Cell[91136, 2902, 207, 5, 85, Input], Cell[91346, 2909, 92, 2, 39, Input] }, Open ]], Cell[CellGroupData[{ Cell[91475, 2916, 64, 1, 62, Subsubsection], Cell[91542, 2919, 212, 7, 73, Text], Cell[91757, 2928, 92, 2, 39, Input], Cell[91852, 2932, 93, 1, 47, Text], Cell[91948, 2935, 98, 2, 39, Input], Cell[92049, 2939, 593, 12, 200, Input], Cell[92645, 2953, 301, 6, 99, Text], Cell[92949, 2961, 519, 11, 177, Text], Cell[93471, 2974, 77, 1, 47, Text], Cell[93551, 2977, 105, 2, 39, Input], Cell[93659, 2981, 131, 3, 39, Input], Cell[93793, 2986, 200, 5, 73, Text], Cell[93996, 2993, 100, 2, 39, Input], Cell[94099, 2997, 593, 12, 200, Input], Cell[94695, 3011, 77, 1, 47, Text], Cell[94775, 3014, 105, 2, 39, Input], Cell[94883, 3018, 131, 3, 39, Input], Cell[95017, 3023, 160, 3, 39, Input], Cell[95180, 3028, 98, 3, 47, Text], Cell[95281, 3033, 99, 2, 39, Input], Cell[95383, 3037, 58, 0, 47, Text], Cell[95444, 3039, 222, 4, 39, Input], Cell[95669, 3045, 142, 4, 47, Text], Cell[95814, 3051, 70, 2, 39, Input], Cell[95887, 3055, 266, 6, 108, Input], Cell[96156, 3063, 207, 5, 85, Input], Cell[96366, 3070, 92, 2, 39, Input], Cell[96461, 3074, 187, 5, 73, Text] }, Open ]], Cell[CellGroupData[{ Cell[96685, 3084, 86, 1, 62, Subsubsection], Cell[96774, 3087, 93, 1, 47, Text], Cell[96870, 3090, 163, 3, 62, Input], Cell[97036, 3095, 180, 5, 73, Text], Cell[97219, 3102, 147, 3, 67, Input], Cell[97369, 3107, 167, 4, 62, Input], Cell[97539, 3113, 131, 3, 39, Input] }, Open ]], Cell[CellGroupData[{ Cell[97707, 3121, 59, 1, 62, Subsubsection], Cell[97769, 3124, 178, 4, 62, Input] }, Open ]] }, Closed]], Cell[CellGroupData[{ Cell[97996, 3134, 84, 1, 39, Subsection], Cell[98083, 3137, 170, 5, 73, Text], Cell[CellGroupData[{ Cell[98278, 3146, 59, 1, 62, Subsubsection], Cell[98340, 3149, 76, 1, 47, Text], Cell[98419, 3152, 160, 4, 73, Text], Cell[98582, 3158, 186, 5, 73, Text], Cell[98771, 3165, 101, 2, 47, Text], Cell[98875, 3169, 198, 5, 73, Text], Cell[99076, 3176, 237, 5, 73, Text] }, Open ]], Cell[CellGroupData[{ Cell[99350, 3186, 85, 1, 62, Subsubsection], Cell[99438, 3189, 158, 4, 73, Text], Cell[99599, 3195, 387, 10, 131, Input], Cell[99989, 3207, 165, 3, 68, Input], Cell[100157, 3212, 137, 4, 47, Text] }, Open ]], Cell[CellGroupData[{ Cell[100331, 3221, 92, 1, 62, Subsubsection], Cell[100426, 3224, 73, 1, 47, Text], Cell[100502, 3227, 366, 7, 108, Input], Cell[100871, 3236, 116, 4, 47, Text], Cell[100990, 3242, 251, 6, 85, Input], Cell[101244, 3250, 125, 4, 47, Text], Cell[101372, 3256, 219, 5, 62, Input], Cell[101594, 3263, 231, 6, 73, Text], Cell[101828, 3271, 200, 5, 39, Input], Cell[102031, 3278, 200, 5, 39, Input], Cell[102234, 3285, 209, 5, 73, Text] }, Open ]], Cell[CellGroupData[{ Cell[102480, 3295, 60, 1, 62, Subsubsection], Cell[102543, 3298, 62, 1, 47, Text], Cell[102608, 3301, 68, 2, 39, Input], Cell[102679, 3305, 55, 1, 47, Text], Cell[102737, 3308, 721, 14, 237, Input], Cell[103461, 3324, 57, 1, 47, Text], Cell[103521, 3327, 891, 17, 383, Input], Cell[104415, 3346, 103, 2, 47, Text], Cell[104521, 3350, 109, 2, 39, Input], Cell[104633, 3354, 131, 3, 64, Input], Cell[104767, 3359, 91, 1, 47, Text], Cell[104861, 3362, 235, 6, 85, Input], Cell[105099, 3370, 196, 4, 62, Input], Cell[105298, 3376, 70, 2, 39, Input], Cell[105371, 3380, 346, 8, 131, Input], Cell[105720, 3390, 207, 5, 85, Input], Cell[105930, 3397, 92, 2, 39, Input] }, Open ]] }, Closed]] }, Closed]] }, Open ]] } ] *) (******************************************************************* End of Mathematica Notebook file. *******************************************************************) === Subject: RE: Undo and Plot3D Thread-Topic: Undo and Plot3D >-----Original Message----- === >Subject: Undo and Plot3D >Hallo Mathgroup! >Here are two questions: >1. Is it possible to set somewhere the number of steps that >can be undone >(Edit/Undo) with Mathematica? >2. I have the following problem (see the inserted notebooks below): >I define a function h is derived from another function >calcuated by NDSolve. >Then this function h can very well be plotted with Plot using either >Compiled->False, or >Evaluate or definined h as a function of the variable a by h[a_]:=.... >The example in the notebook is for Compiled False. >However when I want to include another variable x, and plot >h/Sqrt[x] with Plot3D >nothing seems to work. I have tried several combinations with Compiled >->False or >h[a_,x_]:=... and Evaluate[] or Including Sqrt[x] in the integral but I >didn't get the result. >Does anyone no the answer? I use Mathematica version 4.2. >Notebook 1 with Plot >Notebook[{ >Cell[BoxData[ >((( (* >Example with Plot *) )([IndentingNewLine])( >[IndentingNewLine])((Clear[f, z, a, h];)[IndentingNewLine] >res = >NDSolve[{(f''')[z] + f[z]*(f'')[z] [Equal] 0, >f[0] == 0, (f')[0] == >1, (f'')[0] [Equal] (-0.627554883)}, {f}, {z, 0, >10^6}][IndentingNewLine] >(h = >1/([Integral]_0%20((Exp[(-a)*([Integral]_0%t((f[ >z] /. >res)) [DifferentialD]z)])) >[DifferentialD]t);)[IndentingNewLine] >Plot[h, {a, 0, 100}, PlotStyle [Rule] {RGBColor[1, 0, 0]}, >PlotRange [Rule] All, Frame [Rule] Automatic, >Compiled [Rule] False][IndentingNewLine][IndentingNewLine] >)))], Input] >FrontEndVersion->4.2 for Microsoft Windows, >ScreenRectangle->{{0, 1280}, {0, 951}}, >WindowSize->{922, 740}, >WindowMargins->{{Automatic, 158}, {-108, Automatic}} >Notebook 2 with Plot3D >Notebook[{ >Cell[BoxData[{ >((Clear[f, z, a, h];)), [IndentingNewLine], >(res = >NDSolve[{(f''')[z] + f[z]*(f'')[z] [Equal] 0, >f[0] == 0, (f')[0] == >1, (f'')[0] [Equal] (-0.627554883)}, {f}, {z, 0, >10^6}]), [IndentingNewLine], >((h = >1/([Integral]_0%20((Exp[(-a)*([Integral]_0%t((f[ >z] /. >res)) [DifferentialD]z)])) >[DifferentialD]t);)), [IndentingNewLine], >(Plot3D[h/Sqrt[x], {a, 0, 100}, {x, 0.1, 1}, >Compiled [Rule] False])}], Input] >FrontEndVersion->4.2 for Microsoft Windows, >ScreenRectangle->{{0, 1280}, {0, 951}}, >WindowSize->{922, 740}, >WindowMargins->{{Automatic, 65}, {Automatic, 47}} >Zsolt Feleki >Doktorand >Prof. Dr. Bruno Keller >Hochbautechnik/ Professur f=FCr Bauphysik >ETH H=F6nggerberg HIF C23.2, 8093 Z=FCrich >Tel: 01-633 26 70 >Fax: 01-633 10 41 >http://www.bph.hbt.arch.ethz.ch Simply debug: If you define h as a certain (the first and only one in your case) solution (not as a list of)... h = 1/Integrate[Exp[(-a)*Integrate[f[z] /. First[res], {z, 0, t}]], {t, 0, 20}] ...then... Plot3D[h/Sqrt[x], {a, 0, 100}, {x, 0.1, 1}, Compiled -> False] ...works. -- === Subject: Re: Dashing option and Plot Look at Dashing in the Help Browser. E.g. In[1]:= y = Plot[Sin[x], {x, 0, Pi}, PlotStyle -> Dashing[{0.1, 0.05}]]; Tomas Garza Mexico City ----- Original Message ----- === Subject: Dashing option and Plot > Hello! > Can I use Dashing directly with Plot? How can I plot a dashed > plot? For example, if I want to plot y=Sin[x], {x,0,Pi} completely === Subject: Re: Dashing option and Plot >Hello! >Can I use Dashing directly with Plot? How can I plot a dashed >plot? For example, if I want to plot y=Sin[x], {x,0,Pi} completely Plot[Sin[x], {x, 0, Pi}, PlotStyle -> Dashing[{0.02, .02}]] === Subject: Re: Dashing option and Plot Plot[Sin[x], {x, 0, Pi}, PlotStyle -> {Dashing[{0.02}]}] > Hello! > Can I use Dashing directly with Plot? How can I plot a dashed > plot? For example, if I want to plot y=Sin[x], {x,0,Pi} completely === Subject: RE: Subscript Variable I use the palette described at the following link. If you have trouble with the length of that link, go to Google Groups and search for Copy as InputForm. The result will look a lot like the text you don't like, for instance x subscripted by i is Subscript[x,i], but to see it the usual way all you have to do is copy it from e-mail and paste it into Mathematica. .mathematica&hl=en&lr=&ie=UTF-8&group=comp.soft-sys.math.mathematica&selm=br uqgf%24sv6%241%40smc.vnet.net&rnum=1 DrBob www.eclecticdreams.net -----Original Message----- === Subject: Subscript Variable superscript into my e-mails. 75 degrees for eg. the stuff below is for a programmer which I am not. Any help will be appreciated. Tks, M. >Michel, >A couple of months ago Carl Woll posted one solution to this problem. Essentially he >changed the Attributes of Subscript to HoldFirst, and added SubscriptInformation and >ClearSubscripts routines. I liked his routine so much I made a little package of it >and extended it slightly. Here are examples of it's use. >< Algebra`WollSubscripts` >?Algebra`WollSubscripts >WollSubscripts sets the attributes of Subscript to HoldFirst so that it can >be used like a symbol. Subscript definitions can be defined. The additional >routines ClearSubscripts and SubscriptInformation are also provided. >?ClearSubscripts >ClearSubscripts[sym1, sym2,...] will clear all Subscript definitions based >on the symbols. >?SubscriptInformation >SubscriptInformation[sym1, sym2,...] will print the Subscript definitions >based on the symbols. >Here I use InputFormat so it will be readable in email. >Subscript[f, 1][x_] = x^2 + 1; >Subscript[f, 2][x_] = x^3 - 1; >SubscriptInformation[f] >Subscript[f, 1][x_] = 1 + x^2 >Subscript[f, 2][x_] = -1 + x^3 >?? Subscript >Subscript has been given the Attribute HoldFirst so that it can be >used like a symbol and be given definitions. >Attributes[Subscript] = {HoldFirst} >Subscript[f, 1][x_] = 1 + x^2 >Subscript[f, 2][x_] = -1 + x^3 >Subscript[f, 2][y] - Subscript[f, 1][y] >-2 - y^2 + y^3 >ClearSubscripts[f] >SubscriptInformation[f] >(none) >?? Subscript >Subscript has been given the Attribute HoldFirst so that it can be >used like a symbol and be given definitions. >Attributes[Subscript] = {HoldFirst} >I am pasting the notebook that creates the package at the end of the email. The >package should be placed in the AddOns/ExtraPackages/Algebra directory. >David Park >djmp@earthlink.net href=http://home.earthlink.net/~djmp/>http://home.earthlink.net/~djmp/ >>I have a problem about subscript variables. >>First Question : >>If I use a variable named Subscript[x,1] , >>(typed in with Ctrl _) >>I can affect a value to this variable, get value of expressions >>involving this variable, clear this variable with . but not with Clear[] >>This variable is not given when I ask Names[x*] and I cannot get >>information on it with ?. >>Second Question : >>If I use such a variable in order to define a function with >> f1[x_]=x^2+1 >>I cannot clear the variable with f1=. >>(of course, just above f1 means Subscript[f,1]) >>J.Michel CORNIL >(*********************************************************************** > Mathematica-Compatible Notebook >This notebook can be used on any computer system with Mathematica 4.0, >MathReader 4.0, or any compatible application. The data for the notebook >starts with the line containing stars above. >To get the notebook into a Mathematica-compatible application, do one of >the following: >* Save the data starting with the line of stars above into a file > with a name ending in .nb, then open the file inside the application; >* Copy the data starting with the line of stars above to the > clipboard, then use the Paste menu command inside the application. >Data for notebooks contains only printable 7-bit ASCII and can be >sent directly in email or through ftp in text mode. Newlines can be >CR, LF or CRLF (Unix, Macintosh or MS-DOS style). >NOTE: If you modify the data for this notebook not in a Mathematica- >compatible application, you must delete the line below containing the >word CacheID, otherwise Mathematica-compatible applications may try to >use invalid cache data. >For more information on notebooks and Mathematica-compatible >applications, contact Wolfram Research: > web: http://www.wolfram.com > email: info@wolfram.com > phone: +1-217-398-0700 (U.S.) >Notebook reader applications are available free of charge from >Wolfram Research. >***********************************************************************) >(*CacheID: 232*) >(*NotebookFileLineBreakTest >NotebookFileLineBreakTest*) >(*NotebookOptionsPosition[ 5011, 143]*) >(*NotebookOutlinePosition[ 5736, 168]*) >(* CellTagsIndexPosition[ 5692, 164]*) >(*WindowFrame->Normal*) >Notebook[{ >Cell[CellGroupData[{ >Cell[Algebra`WollSubscripts` Package, Title], >Cell[CellGroupData[{ >Cell[Implementation, Section, > InitializationCell->True], >Cell[BoxData[{ > (ClearAll[Subscript]), [IndentingNewLine], > ((Subscript::usage = HoldFirst so that it can be used like a symbol and be given >definitions.>;)), [IndentingNewLine], > (SetAttributes[Subscript, {HoldFirst}])}], Input, > InitializationCell->True], >Cell[BoxData[ > (BeginPackage[])], Input, > InitializationCell->True], >Cell[BoxData[ > (Algebra`WollSubscripts::usage = of Subscript to HoldFirst so that it can be used like a symbol. Subscript >definitions can be defined. The additional routines ClearSubscripts and >SubscriptInformation are also provided.>)], Input, > InitializationCell->True], >Cell[BoxData[ > ((ClearSubscripts::usage = clear all Subscript definitions based on the symbols.>;))], Input, > InitializationCell->True], >Cell[BoxData[ > ((SubscriptInformation::usage = will print the Subscript definitions based on the symbols.>;))], Input, > InitializationCell->True], >Cell[BoxData[ > (Begin[<`Private`>])], Input, > InitializationCell->True], >Cell[BoxData[{ > ((SetAttributes[ > ClearSubscripts, {HoldAll}];)), [IndentingNewLine], > (ClearSubscripts[a__] := [IndentingNewLine] > Module[{b}, [IndentingNewLine]DownValues[Subscript] = > Cases[DownValues[Subscript], ((b_ :> _)) /; > FreeQ[b, > HoldPattern[ > Subscript[ > Alternatives[a], __]]]]; [IndentingNewLine]SubValues[ > Subscript] = > Cases[SubValues[Subscript], ((b_ :> _)) /; > FreeQ[b, > HoldPattern[ > Subscript[ > Alternatives[ > a], __]]]];[IndentingNewLine]])}], Input, > InitializationCell->True], >Cell[BoxData[{ > StyleBox[(SetAttributes[SubscriptInformation, {HoldAll}];), > FormatType->StandardForm], n, > StyleBox[(SubscriptInformation[syms__] := [IndentingNewLine] > Module[{PrintDownValue}, [IndentingNewLine]PrintDownValue[(Verbatim[ > HoldPattern])[a_] :> b_] := > Print[HoldForm[ > a = > b]]; [IndentingNewLine]PrintDownValue /@ ((DeleteCases[ > Join[DownValues[Subscript], > SubValues[Subscript]], ((b_ :> _)) /; > FreeQ[b, > HoldPattern[ > Subscript[ > Alternatives[ > syms], __]]]]));[IndentingNewLine]]), > FormatType->StandardForm]}], Input, > InitializationCell->True], >Cell[BoxData[ > (End[])], Input, > InitializationCell->True], >Cell[BoxData[ > (Protect[ClearSubscripts, SubscriptInformation])], Input, > InitializationCell->True], >Cell[BoxData[ > (EndPackage[])], Input, > InitializationCell->True] >}, Open ]] >}, Open ]] >FrontEndVersion->4.0 for Microsoft Windows, >ScreenRectangle->{{0, 1024}, {0, 683}}, >AutoGeneratedPackage->Automatic, >InitializationCellEvaluation->False, >WindowSize->{591, 571}, >WindowMargins->{{Automatic, 94}, {Automatic, 21}} >(*********************************************************************** >Cached data follows. If you edit this Notebook file directly, not using >Mathematica, you must remove the line containing CacheID at the top of >the file. The cache data will then be recreated when you save this file >from within Mathematica. >***********************************************************************) >(*CellTagsOutline >CellTagsIndex->{} >(*CellTagsIndex >CellTagsIndex->{} >(*NotebookFileOutline >Notebook[{ >Cell[CellGroupData[{ >Cell[1739, 51, 48, 0, 150, Title], >Cell[CellGroupData[{ >Cell[1812, 55, 61, 1, 53, Section, > InitializationCell->True], >Cell[1876, 58, 332, 6, 110, Input, > InitializationCell->True], >Cell[2211, 66, 104, 2, 30, Input, > InitializationCell->True], >Cell[2318, 70, 325, 5, 110, Input, > InitializationCell->True], >Cell[2646, 77, 189, 3, 70, Input, > InitializationCell->True], >Cell[2838, 82, 199, 3, 70, Input, > InitializationCell->True], >Cell[3040, 87, 83, 2, 30, Input, > InitializationCell->True], >Cell[3126, 91, 751, 17, 250, Input, > InitializationCell->True], >Cell[3880, 110, 848, 17, 210, Input, > InitializationCell->True], >Cell[4731, 129, 66, 2, 30, Input, > InitializationCell->True], >Cell[4800, 133, 107, 2, 30, Input, > InitializationCell->True], >Cell[4910, 137, 73, 2, 30, Input, > InitializationCell->True] >}, Open ]] >}, Open ]] >(*********************************************************************** >End of Mathematica Notebook file. === Subject: Trig identity oscillations Should it not be a more placid -1 ? Plot[Cos[t+5 Pi/6]/Sin[t+Pi/3],{t,0,2 Pi}] === Subject: RE: Simplify using custom function expr = -1 + 2*x + 2*E^x; f[x_] = x + E^x Off[Eliminate::ifun] Eliminate[{expr == y, f[x] == z}, x] Block[{f}, result = First[%] /. z -> f[x]]; resultE^x + x -1 + 2*z == y -1 + 2*(E^x + x) ?result Global`result result = -1 + 2*f[x] DrBob www.eclecticdreams.net -----Original Message----- === Subject: Simplify using custom function What I'm trying to achieve is to find a certain function in a more complicated expression: example: complicated expression: -1+2 x +2 e^x function: f[x_]=x+e^x Mathematica should return: -1+2 f[x] I've been looking at TransformationFunctions and FullSimplify, but did not succeed in defining a transformation function so far. How do I do that? (It's Mathematica 5.0) === Subject: RE: Dashing option and Plot Hi Jose, > Can I use Dashing directly with Plot? How can I plot a dashed > plot? For example, if I want to plot y=Sin[x], {x,0,Pi} completely This sounds very much like a homework question. In any case, I'm surprised that online help wasn't useful, particularly since section 2.10.3 answers your question. Plot[Sin[x], {x, 0, Pi}]; Plot[Sin[x], {x, 0, Pi}, PlotStyle -> Dashing[{.01, .01}]]; Plot[Sin[x], {x, 0, Pi}, PlotStyle -> Dashing[{.01, .01}], FrameTicks -> {PiScale, Automatic, None, None}]; Plot[Sin[x], {x, 0, Pi}, PlotStyle -> {Dashing[{.01, .01}], Thickness[.007], Red}, FrameTicks -> {PiScale, Automatic, None, None}]; Dave. Dr. David Annetts EM Modelling Analyst CSIRO DEM Tel: +612 9490 5416 North Ryde Fax: +612 9490 5467 Australia David.Annetts@csiro.au === Subject: MathJFrame, MathGraphicsJPanel question I have two questions concerning the use of MathJFrame and MathGraphicsJPanel, which basically arose while writing the graphic viewer at http://evolve.lse.ac.uk/jalex/misc/GraphicViewer.nb. (That notebook uses JLink to define a function called GraphicViewer which, when passed a list of graphics objects, allows one to view the graphics one at a time, using Next and Previous buttons to page through the list, or to jump to a specific point by typing an index into a text box.) If you download that notebook and try it out, you'll notice two problems: first, the MathJFrame doesn't open at the right size... you have to resize it at first. Second, the MathGraphicsJPanel doesn't automatically resize when the containing MathJFrame is resized. (1) How does one set a MathJFrame to open at a specific size? I've tried calling setSize on a MathJFrame and haven't had any success in getting it to actually cause the MathJFrame to open at the specified size. (2) How might one configure a MathGraphicsJPanel to be notified when its containing JFrame is resized (but only at the *end* of the resize process) so that recompute() can be called? One often needs to call recompute() on the MathGraphicsJPanel so that it is the right size. Jason === Subject: NIntegrate or For or Special Function? I am constructing filling entries in a matrix using For loops. The individual entries come from integrating Bessel, Hankel and Kelvin functions numerically with NIntegrate. A 100x100 matrix takes a few hours to run? Is my procedural way of doing things to blame? Is it the specialty functions (Bessel etc)? Is it simply NIntegrate? Would anyone be willing to look at my awful code? Any help would be greatly appreciated. Matt Swingle mss4@duke.edu === Subject: Re: Dashing option and Plot >Hello! Can I use Dashing directly with Plot? How can I plot a >dashed plot? For example, if I want to plot y=Sin[x], {x,0,Pi} Try Plot[Sin@x, {x, 0, Pi}, PlotStyle -> Dashing@{.02, .02}]; -- To reply via email subtract one hundred and four === Subject: Re: Revisited Added code to **run** the newly created .NET assembly: Showed TWO different ways to do this: 1. Using NET Reflection/Invoke function. 2. Using NETLink's LoadNETAssembly, after which can call as a Mathematica function: HelloWorldMsgApp'Main[] Paste the following Notebook Expression into any open notebook. - - - - - - - - - - Notebook[{ Cell[BoxData[ RowBox[{(*, , RowBox[{ RowBox[{ StyleBox[((--(--(- 01))) - NetLink + CodeDom - ((Tests --)--) - ), FontFamily->Arial, FontSize->16], , ;, [IndentingNewLine], (Makes an assembly), ;, [IndentingNewLine], (By : ToolMakerSteve at shawstudio . com)}], ,, NOTE : If you want to experiment with the different objects created along the way), ,, , (then comment out THREE (places : )), ,, , <]>, ,, , (and the module locals ; [IndentingNewLine]these are marked with (* . [IndentingNewLine]For example, notebook #02 - Net - Object - Reflection contains an Example[IndentingNewLine] , which requires access to those ((values)(.))))}], [IndentingNewLine], *)}]], Input], Cell[CellGroupData[{ Cell[BoxData[ (((FileType /. FileInformation[ ToFileName[ Environment[], ]])))], Input], Cell[BoxData[ (Directory)], Output] }, Open ]], Cell[BoxData[ ((( (* (--(- Quiet)) spell warnings + limit output (length --) - *) )(n)(Off[ General::spell]; Off[General::spell1];n ($PrePrint = Short[#, 50] &;))))], Input], Cell[CellGroupData[{ Cell[BoxData[{ (Needs[]), [IndentingNewLine], (((InstallNET[])([IndentingNewLine])([IndentingNewLine]) ) (* (((((--(--(- Print))) a NET Object normally &) as a Math' a ((expression --)--))(-));) *) ), [IndentingNewLine], ((NETObPrint[ netObject_ ] := {netObject, [IndentingNewLine]netObject // NETObjectToExpression} // Print;)), [IndentingNewLine], ((NETObPrint[ netObject_, message_ ] := message[ netObject, [IndentingNewLine]netObject // NETObjectToExpression ] // Print;)[IndentingNewLine][IndentingNewLine] (* *) ), [IndentingNewLine], (((NetBitOr[ net1_, net2_ ] := [IndentingNewLine]BitOr[ NETObjectToExpression[ net1 ], NETObjectToExpression[ net2 ] ];)([IndentingNewLine]) )), [IndentingNewLine], ((LoadNETType[ ];) [IndentingNewLine] (* Hard to decide when to switch back from Math' a to Net object; [IndentingNewLine]Here, or in ((NetBitOr)(?)); Decided ; [IndentingNewLine]*) ), [IndentingNewLine], (((MakeEnum[ mathValue_, netType_ ] := [IndentingNewLine]Enum`ToObject[ netType, MakeNETObject[ mathValue ] ];)([IndentingNewLine]) )), [IndentingNewLine], ((memberAttributesType = GetTypeObject[ LoadNETType[ ] ];) [IndentingNewLine][IndentingNewLine] (* for CodeDom . (MemberAttributes --); [IndentingNewLine]Work - Around . NET Bug (((missing Attribute on MemberAttributes))(.)) *) ), [IndentingNewLine], ((NetMergeAttributes[ net1_, net2_ ] := MakeEnum[ NetBitOr[ net1, net2 ], memberAttributesType ];)[IndentingNewLine] [IndentingNewLine] (* (--(--(- Csharp))) Compile - Assembly - csharp@(CreateCompiler[]@ compUnit ]);[IndentingNewLine]*) ), [IndentingNewLine], compUnit_ ] := [IndentingNewLine]Module[ {csharp, cscompiler, iCodeCompilerType, compileMethod}, [IndentingNewLine]csharp = NETNew[ ]; [IndentingNewLine]cscompiler = csharp@CreateCompiler[]; [IndentingNewLine]iCodeCompilerType = GetTypeObject[ LoadNETType[ ] ]; [IndentingNewLine]compileMethod = iCodeCompilerType@ [IndentingNewLine]compileMethod@ Invoke[ cscompiler, {compParams, compUnit} ][IndentingNewLine]];)[IndentingNewLine][IndentingNewLine] (* RETURN : A M' a list of Net Objects contained in a Net Collection; [IndentingNewLine]So can operate on the individual Net Objects;[IndentingNewLine]*) ), [IndentingNewLine], (((NetAsList[ netCollection_ ] := [IndentingNewLine]Module[ {expressions}, [IndentingNewLine]expressions = NETObjectToExpression[ netCollection ]; [IndentingNewLine]Map[ MakeNETObject, expressions ][IndentingNewLine]];)([IndentingNewLine]) )), [IndentingNewLine], ((AddImport[ importName1_String, netImports_ ] := [IndentingNewLine]netImports@ Add[ NETNew[ , importName1 ] ];)[IndentingNewLine] [IndentingNewLine] (* is a list of Strings; [IndentingNewLine]Each string is the path of an import; [IndentingNewLine]e . g . . [IndentingNewLine]*) ), [IndentingNewLine], ((AddImports[ imports_, netSpace1_ ] := [IndentingNewLine]Module[ {netImports}, [IndentingNewLine]netImports = netSpace1@Imports; [IndentingNewLine]Map[ AddImport[ #, netImports ] &, imports ];[IndentingNewLine]];))}], Input], Cell[BoxData[ TagBox[(LinkObject[ C:Program FilesWolfram ResearchMathematica5.0AddOnsNETLinkInstallableNET.exe, 2, 2]), (Short[ #, 50]&)]], Output] }, Open ]], Cell[BoxData[ ((([IndentingNewLine])( (* (--(--(--(--(-(--(--(-(- (((((((GLOBALS --)--)--)--)--)--)--))))))))))(-) *) )( [IndentingNewLine])([IndentingNewLine])((outputPath = ;)[IndentingNewLine] (assemblyName = ;)[IndentingNewLine] (className = ;)[IndentingNewLine] (fullClassPath = assemblyName <> <.> <> className;))))], Input], Cell[CellGroupData[{ Cell[BoxData[ (((result)(=)([IndentingNewLine])(NETBlock[ (*(<)( (--Comment) out to ((experiment)(.))) *) [IndentingNewLine]Module[ {[IndentingNewLine]netSpace1, netImports1, spaceTypes1, netType1, main, snippet1, statement1, compUnit1, compParams, refAssemblies, csharp, cscompiler, result, errors, nErrors (*(<)((--Comment) out to ((experiment)(.)))*) [IndentingNewLine]}, [IndentingNewLine] [IndentingNewLine] (* Load type ((s)) to call static ((members)(.))*) [IndentingNewLine]LoadNETType[ ]; [IndentingNewLine] [IndentingNewLine]netSpace1 = NETNew[ ]; [IndentingNewLine]netSpace1@Name = assemblyName; [IndentingNewLine][ netSpace1@Name ] // Print; [IndentingNewLine]spaceTypes1 = netSpace1@Types; [IndentingNewLine][ spaceTypes1 ] // Print; [IndentingNewLine][ spaceTypes1@Count ] // Print; [IndentingNewLine][IndentingNewLine]netImports1 = netSpace1@ Imports; [IndentingNewLine]AddImports[ [IndentingNewLine]{, }, [IndentingNewLine]netSpace1 ]; [IndentingNewLine] [IndentingNewLine]netType1 = NETNew[ ]; [IndentingNewLine]netType1@Name = className; [IndentingNewLine]netType1@IsClass = True; [IndentingNewLine]netType1@Attributes = MemberAttributes`Public; [IndentingNewLine]spaceTypes1@ Add[ netType1 ]; [IndentingNewLine][ spaceTypes1@Count ] // Print; [IndentingNewLine]<(spaceTypes1@Item[ 0 ])@Name:>[ ((spaceTypes1@Item[ 0 ]))@Name ] // Print; [IndentingNewLine][IndentingNewLine]main = NETNew[ ]; [IndentingNewLine]main@Name =
; [IndentingNewLine]main@ Attributes = NetMergeAttributes[ MemberAttributes`Public, MemberAttributes`Static ]; [IndentingNewLine]NETObPrint[ main@Attributes, ]; [IndentingNewLine]((netType1@Members))@ Add[ main ]; [IndentingNewLine]<# netType1@Members:>[ ((netType1@Members))@Count ] // Print; [IndentingNewLine][IndentingNewLine]snippet1 = NETNew[ , ]; [IndentingNewLine]statement1 = NETNew[ , snippet1 ]; [IndentingNewLine]((main@Statements))@ Add[ statement1 ]; [IndentingNewLine]<# Statements:>[ ((main@Statements))@Count ] // Print; [IndentingNewLine][ ((((main@ Statements))[ 0 ]@Expression))@ Value ] // Print; [IndentingNewLine][IndentingNewLine]compUnit1 = NETNew[ ]; [IndentingNewLine]((compUnit1@Namespaces))@ Add[ netSpace1 ]; [IndentingNewLine]compParams = NETNew[ ]; [IndentingNewLine]refAssemblies = compParams@ ReferencedAssemblies; [IndentingNewLine]refAssemblies@ Add[ ]; [IndentingNewLine]refAssemblies@ Add[ ]; [IndentingNewLine]refAssemblies@ Add[ ]; [IndentingNewLine]refAssemblies@ Add[ ]; [IndentingNewLine]<# refAssemblies:>[ refAssemblies@Count ] // Print; [IndentingNewLine]compParams@GenerateInMemory = False; [IndentingNewLine]compParams@GenerateExecutable = True; [IndentingNewLine]compParams@MainClass = fullClassPath; [IndentingNewLine] <> ((compParams@MainClass)) // ((compParams@OutputAssembly = outputPath)) // Print; [IndentingNewLine][IndentingNewLine] (* Code snippets were given in c #, so use c # ((compiler)(.)) *) [IndentingNewLine]result = compUnit1 ]; [IndentingNewLine][IndentingNewLine] (* Check for ((errors)(.)) *) [IndentingNewLine]nErrors = result@(Errors@Count); [IndentingNewLine]If[ nErrors > 0, [IndentingNewLine] (* Make list of error objects *) [IndentingNewLine]errors = NetAsList[ result@ Errors ]; [IndentingNewLine][IndentingNewLine]((<***Compilation Error(s): > <> ToString[ nErrors ])) @@ Map[ #@ErrorText &, errors ] // Print;[IndentingNewLine][IndentingNewLine], // Print[IndentingNewLine]]; [IndentingNewLine] [IndentingNewLine]result[IndentingNewLine]][IndentingNewLine]])( )( (*(<)((--Comment) out to ((experiment)(.)))*) )))], Input], Cell[BoxData[ (netSpace1@Name:[MyNamespace])], Print], Cell[BoxData[ RowBox[{, [, InterpretationBox[([LeftGuillemet]NETObject[ System.CodeDom.CodeTypeDeclarationCollection] [RightGuillemet]), NETLink`Objects`NETObject$100663297], ]}]], Print], Cell[BoxData[ (spaceTypes1@Count:[0])], Print], Cell[BoxData[ (spaceTypes1@Count:[1])], Print], Cell[BoxData[ ((spaceTypes1@Item[ 0 ])@Name:[ HelloWorldMsgApp])], Print], Cell[BoxData[ RowBox[{, [, RowBox[{ InterpretationBox[([LeftGuillemet]NETObject[ System.CodeDom.MemberAttributes] [RightGuillemet]), NETLink`Objects`NETObject$412367192066], ,, 24579}], ]}]], Print], Cell[BoxData[ (# netType1@Members:[1])], Print], Cell[BoxData[ (# Statements:[1])], Print], Cell[BoxData[ (Statement 1:[ Cell[BoxData[ (# refAssemblies:[4])], Print], Cell[BoxData[ (MainClass: MyNamespace.HelloWorldMsgApp)], Print], Cell[BoxData[ Cell[BoxData[ (NO ERRORS :-))], Print], Cell[BoxData[ TagBox[ InterpretationBox[([LeftGuillemet]NETObject[ System.CodeDom.Compiler.CompilerResults] [RightGuillemet]), NETLink`Objects`NETObject$402653185], (Short[ #, 50]&)]], Output] }, Open ]], Cell[CellGroupData[{ Cell[BoxData[ ((( (* (--(--(- Run))) the assembly, using NET Reflection/ Invoke . (--(---)) *) )([IndentingNewLine])(assembly1 = result@CompiledAssembly[IndentingNewLine] main1 = assembly1@EntryPoint[IndentingNewLine] nullOb = MakeNETObject[ Null ][IndentingNewLine] noParameters = MakeNETObject[ {}, ][IndentingNewLine] [IndentingNewLine] (* (-- Call) assembly' s main - class' es - this notebook stays until it is closed . -- *) [IndentingNewLine] main1@Invoke[ nullOb, noParameters ][IndentingNewLine] )))], Input], Cell[BoxData[ TagBox[ InterpretationBox[([LeftGuillemet]NETObject[ System.Reflection.Assembly] [RightGuillemet]), NETLink`Objects`NETObject$436207617], (Short[ #, 50]&)]], Output], Cell[BoxData[ TagBox[ InterpretationBox[([LeftGuillemet]NETObject[ System.Reflection.RuntimeMethodInfo] [RightGuillemet]), NETLink`Objects`NETObject$3990411500584961], (Short[ #, 50]&)]], Output], Cell[BoxData[ TagBox[ InterpretationBox[([LeftGuillemet]NETObject[ System.Object[]] [RightGuillemet]), NETLink`Objects`NETObject$452984833], (Short[ #, 50]&)]], Output] }, Open ]], Cell[CellGroupData[{ Cell[BoxData[ ((( (* (--(--(- Run))) the assembly, using NETLink functions . (--(---)) *) )( [IndentingNewLine])(LoadNETAssembly[ outputPath ][IndentingNewLine] LoadNETType[ fullClassPath ][IndentingNewLine][IndentingNewLine] (* ( this notebook stays until it is closed . -- *) [IndentingNewLine] HelloWorldMsgApp`Main[])))], Input], Cell[BoxData[ TagBox[(NETAssembly[01-HelloWorldMsg, 3]), (Short[ #, 50]&)]], Output], Cell[BoxData[ TagBox[(NETType[MyNamespace.HelloWorldMsgApp, 27]), (Short[ #, 50]&)]], Output] }, Open ]] }, FrontEndVersion->5.0 for Microsoft Windows, ScreenRectangle->{{0, 1280}, {0, 976}}, WindowSize->{688, 781}, WindowMargins->{{4, Automatic}, {4, Automatic}} ] === Subject: David's CombinatoricaGraphics functions Hello group and david. I love david's Package for improving Combinatorica graphics. and obviously by the looks of this email, and the fact that I'm writing, yes.. I have a few problems. please consider the following digraph. In[12]:= lg = Graph[{ {{1, 2}}, {{2, 3}}, {{3, 2}}, {{3, 1}}, {{1, 4}}, {{1, 4}}, {{1, 5}}, {{1, 5}}, {{4, 5}}, {{4, 2}}, {{4, 2}}, {{5, 2}}, {{5, 2}}, {{5, 4}}, {{5, 4}}}, {{{0.0, 1.5}, VertexLabel -> a1}, {{0.0, 0.0}, VertexLabel -> b2}, {{0.5, 0.75}, VertexLabel -> c3}, {{-0.5, 0.75}, VertexLabel -> d4}, {{-1.5, 0.75}, VertexLabel -> e5}}, EdgeDirection-> On] ShowGraph[lg] CombinatoricaPlot[ {DrawGraphEdges[lg][All], DrawGraphVertices[lg][All]}, Background -> White]; above will produce two graphics. onedefault and one produced by david's new package. 1. How come the CombinatoricaPlot isn't drawing the directed edges using DrawGraphBowArrow as a default? 2. As far as I understand it, a tour is a path in a digraph where you only cross every vertex once, before returning to the starting pt( in this case, a1) How do I show all tours that are possible withthe digraph above? 3. how do I show that all the tours are isomorphic? or is that an obvious question? === Subject: RE: Trig identity oscillations Thread-Topic: Trig identity oscillations >-----Original Message----- === >Subject: Trig identity oscillations >Should it not be a more placid -1 ? >Plot[Cos[t+5 Pi/6]/Sin[t+Pi/3],{t,0,2 Pi}] No, it shouldn't! I really would like here to see the numerical instabilities of the expression for machine sized real t (that is what plotting does, that's what you ordered). To make it more explicit, look at In[7]:= Plot[Cos[t + 5 Pi/6]/Sin[t + Pi/3], {t, 0, 2 Pi}, PlotRange -> All, Ticks -> {Range[12]/6 Pi, Automatic}] If you look at the positions of the glitches: In[8]:= Function[t, {Cos[t + 5 Pi/6], Sin[t + Pi/3]}] /@ {2/3 Pi, 5/3 Pi} Out[8]= {{0, 0}, {0, 0}} So, no wonder. Contrary to that In[9]:= Simplify[Cos[t + 5 Pi/6]/Sin[t + Pi/3]] Out[9]= -1 In[10]:= Plot[%, {t, 0, 2 Pi}, PlotRange -> All] appears much more boring ;-) --