Mathematica Pendulum Modeling Toolkit

If you're just getting started, download the master archive, which has the latest version of all the stuff you need. Otherwise you can review the release notes for the individual packages and update as needed. See the documentation page for installation instructions.

Compatibility Warning:

Mathematica 8 doesn't seem to introduce any new compatibility issues except that some calculation notebooks that contain the single-character form of the substitution operator are not correctly read. They look correct when first opened but the affected cells give errors such as the following when evaluated.

Several toolkit packages and all models had issues with Mathematica v6.0. (There were no additional issues with v7.0.) In particular the issue with the StatusWindow package was crippling: Mathematica would lock up. Don't even bother upgrading from Mathematica v5 until you've updated the toolkit. Then you should be able to muddle through with models developed under Mathematica v5 except that the plotting of 3D modeshapes won't work. Most models have now been updated to be compatible with Mathematica 5 through 7 (and will probably work in 4). Check the models page for status. Updated items will be flagged: Mathematica 6/7 OK. See the documentation page for more details.

Master Archive of All Required Packages AllPackages20101004.zip

10/04/2010: PendUtil updated to v5.1, IFOModel updated from 2004 to 2005(!). Mathematica 6/7 OK

Pendulum Model Utilities (PendUtil5.1.zip)

12/2/09 - v5.1: Fixed omission of preeqtermlist from potentialtermlist0NT. Fixed several places where chopsize was not defaulted to 0.

12/2/09 - v5.0: Fixed dopotentialtermlistWEcalc[] per T0900320-v1. Introduced dampingbugenable to bring back buggy old behaviour if it should ever be necessary. Folded in Julian's cable work. Added cablelist and index constants c$obj1 etc. Added safevarpattern, notsosafevarpattern and varpattern to test whether variable/float names will confuse Dt[]. Added setupsafevarnames[], which initializes safenames, notsosafenames, safernames, tosafevarnames and toorigvarnames to support temporary swapping out of variables that confuse Dt[]. Added timederivative[] as smarter version of Dt[x,t]. Changed omegaB[] to use timederivative[]. Expanded makevelocities[] and tovelocities to handle everything in allcoords. Defined cablevarlistgen[], cablespringlistgen[], cableconstraintgen[], cablekineticgen[] and cablestartposgen[]. Changed Calculate[allcoords] to archive original allvars as pendvars and add cable variables, to call setupsafevars[] and to define timederivative[]. Changed Calculate[startval] to do likewise for startpos (as pendstartpos). Changed Reset[Stage0A] to clear safenames, notsosafenames, safernames, tosafevarnames, toorigvarnames and timederivative[], and to restore before-cable versions of allvars, startpos, etc. Changed Calculate[potentialtermlist], Calculate[optval] and Calculate[kineticNN] to include cable stuff. Moved calculation of constval before that of allcoords to make cable-related constants accessible. Eliminated scalevec and used generalized form of Eigensystem[] instead. Defined copyvalue[]. Tweaked Calculate[optval] to save user-supplied e2ni, e2s and e2b, and extend for cables. Added ::usage tags for e2ni, e2b and e2s. For Mathematica v6+, defined AppendRows[], AppendColumns[], TakeRows[], TakeColumns[], TakeMatrix[], BlockMatrix[] and DiagonalBlockMatrix[], and eliminated load of LinearAlgebra`MatrixManipulation`. Changed Calculate[optval] to use NMinimize[] if useNMinimize is True, and to use a combination of constraints from hardconstraints and cableconstraintgen[] if usehardconstraints are True. (Note that this was added to the old FindMinimum[] version of the calculation as well, but this only works in v7.) Defined eigenplotc[] and prettyc[] to extend used-defined eigenplot[] and pretty[] for cables. Put Chop[] around Eigensystem[] to get rid of imaginary components of 0.*I that were showing up in some cases. Fixed a problem with nonoptcoords and cables by defining nonoptstart as subset of startval corresponding to nonoptcoords and applying after cableconstraintgen[].

1/6/09 - v4.0: Fixed bug introduced in v3.2 in eomcomplex[] (kineticmatrix terms were not added in allfloats=={} case). Added support for parallel processing under Mathematica v7 (defined parallel, mergetags and PossiblyParallelTable[]). Corrected error in springpotentialNT[] exposed by parallel stuff. Changes to allow substitutions of the form nb[quantity]->"comment text" to be given in defaultvalues or overrides and to be copied over to constval: made Recurse[] ignore comments, made Override[] process input of form nb[symbol]->prepend["text"] and nb[quantity]->append["text"] in override lists, and sort comments after the corresponding symbol->value substitution if any. Added fillincomments[], sortcomments[] and tablecomments[]. Fixed typo that had left wirepotential2M2 undefined and corrected errors in it and wirepotential2M1 (last line of each was missing). Allowed plotTN[] to take plotting options as optional last argument (bringing it in line with plotTF[] and plotTFf[]). Made scale argument to plotTN[] optional. Added comment for startdeltavel. Added lots of new functions for defining mode-shape plotting functions, plotpointspace[], plotpointbody[],.., plotopencylinderspace[]. Mathematica 6/7 OK

6/16/08 - v3.2: New feature: if the wire angular damping type is a two-element list, and either of the elements is a two-element list, the elements are applied to the first and second ends of the wire, e.g., {{ribbontopneckM1type,ribbonbottomneckM1type},{ribbontopneckM2type,ribbonbottomneckM2type}}. Change eomcomplex[] to use the same optimization as cmcomplex[] etc (putting off evaluation of the inverse of the float stiffness matrix until numerical values are available). Mathematica 6/7 OK

10/25/07 - v3.1: Added feature: if scalevec is defined, kineticmatrix is pre- and post-multiplied by DiagonalMatrix[scalevec] before application of Inverse[]. potentialmatrix* is then pre- and post-multiplied by DiagonalMatrix[1/scalevec] before the Eigensystem is solved. (This improves accuracy if some of the coefficients in the mass matrix are very small.) Mathematica 6/7 OK

06/14/07 - v3.0: Fixes for Mathematica v6.0: Rename Scale[] to ScaleSubs[] to avoid conflict with new function. Make loading of Graphics`Graphics` conditional on version. Add anti-warning message for spurious warning message about LinearAlgebra`MatrixManipulation`. Mathematica 6/7 OK

12/08/06 - v2.8: Added new functions smDC[] and smcomplex[] to take a potential matrix list and return the submatrix giving elastic coupling of params among themselves, with variables fixed and floats floating. They are analogous to pmcomplex[], pmDC[] which give the coupling of _variables_ among themselves with params held fixed and floats floating (i.e., the effective stiffness matrix). Added new functions ssCbr[] and ssDbr[] with extra outputs giving back-reaction forces and torques on the structure.

05/18/06 - v2.7: Added flag savedisabled to switch off saving precomputed results.

05/04/06 - v2.5: Assorted changes to Calculate[] to cover the previously unimplemented case of attachment vectors actually being given explicitly rather than being computed in Calculate[relaxval]: Introduced relaxvectors and nonrelaxvectors which produce lists of positions in wirelist corresponding to attachment vectors that respectively are and are not still dummy symbols after application of constval. Introduced relaxwires and nonrelaxwires which produce lists of positions in wirelist for wires that have, respectively, at least one, or no attachment vectors that are still dummy symbols after application of constval. Introduced potentialtermlistWBnr and potentialtermlistWEnr, which contain potential terms for wire bending and extra extension from wire endpoints in nonrelaxvectors. Introduced potentialtermlistWTnr which contains potential terms for torsion from wires in nonrelaxwires. If constval has a substitution wiretermsearly -> True, the wire stiffness terms from nonrelaxvectors are included in both the Stage0 equilibrium position and the Stage0 potential matrices (but not in potentialtermlistWT, potentialtermlistWB or potentialtermlistWE). If there is a substitution wiretermsearly -> EqOnly, the the wire stiffness terms from nonrelaxvectors are included only in the equilibrium position but deferred to the Stage1 or Stage2 potential matrices (and appear a second time in potentialtermlistWT, etc). If there is a substitution wiretermsearly -> False or no such substitution, the traditional order is used. Calculate[relaxval] calculates attachment vectors only if they are still symbolic after constval has been applied. Everywhere relaxval was used, constval is applied as well in case it contains substitutions for wire attachment vectors.

04/06/06 - v2.4: Added option to Override[] to allow some substitutions to be dropped entirely.

03/15/06 - v2.3: Added utility function summarize[] to do a text summary of the major inputs and outputs for easy cut'n'paste to other programs. Corrected handling of constraint forces for tensionoff->True case. Added code to Calculate[potentialmatrices*] to apply Chop[] to with threshold chopsize if that quantity is defined.

07/04/05 - v2.2: Applied Apart[] to coefficients of wirebendingPE[] to address issue reported by Ben where there was unnecessary rounding error for certain values of parameters. Modified wirepotential1[], wirepotential1M1[], and wirepotential1M2[] so that if the attachment vector is 0 (as opposed to an actual vector, or a symbol), the wire is treated as hinged. Moved the calculation of relaxval, potentialtermlistWB, potentialtermlistWT, and potentialtermlistWE from the end of Stage0 to the beginning of the corresponding later stage. Revised Stage 2 to recognize a list of different damping functions for the M1 and M2 directions as for Stage 1A.

04/12/05 - v2.1: Corrected sign of displacement input elements in ssB[], ssBr[], ssBs[]. Modified optspec[] and Calculate[optval] so that if startdelta is defined (as a list of substitutions slightly different from startpos), optimization using derivatives in FindMinimum[] is avoided. Optimized calculation of kineticmatrix by applying optval and nonoptval in kineticN rather than after calculation of derivatives.

02/28/05 - v2.0: Modified calculation to allow for variable-like quantities (to be called floats) that give the position of junctions between elastic elements connected in series. Introduced allfloats and allcoords=Join[allvars,allfloats,allparams]. Renamed optvars to optcoords. Renamed nonoptvars to nonoptcoords but with code to try old name if new one not found and to default to {} if neither found. Renamed usedvars[] to usedcoords[] and made it work from allcoords rather than allvars. Modified makepotentialmatrix[] to iterate w.r.t. allcoords instead of allvars. Per-term potential matrices in lists such as potentialmatices0T are now of dimensions {Length[allcoords], Length[allcoords]}, i.e., larger than before. Individual potential matrices, EOM matrices, and kineticmatrix are still of size {Length[allvars], Length[allvars]}, which may be smaller than before if any coordinates have been moved into allfloats. Eliminated makecouplingmatrix[] and couplingmatrices0T etc (info is now in potentialmatrices0T etc). Functions pmDC[] and pmcomplex[] now accept only large-size potential matrices and produce small ones. Introduced cmcomplex[] and cmDC[] which take large-size potential matrices and produce coupling matrices (of size {Length[allvars]*Length[allparams]}, also possibly smaller than before). Added submatricesDC[] for debugging. Added floatmatrix0A...floatmatrix2 and float0A...float2 to Calculate[]. Added optional float matrix argument to tosub[]. Eliminated all xxxxxxmatrixWB, xxxxxxmatrixWT and xxxxxxmatrixWE. Added ::usage notes for the model specification quantities (moved from one of the calculation notebooks). Corrected comment on ssD[], added ssBr[], ssDr, ssBs[] and ssDs. Updated SS functions to take potential matrix lists instead of coupling matrix lists. Removed unused argument cmlist from ssAfapprox[]. NOTE: this version introduces significant structural changes to the method of calculation. Models defined using previous versions should work without modification if recalculated from scratch, but old precomputed results have been invalidated. User input nonoptvars is deprecated - use nonoptcoords instead.

07/14/04 - v1.3: Changed Calculate[potentialtermlistWB] to allow for different damping types in different directions (such as and in particular, rectangular ribbon profiles, where the thermoelastic effect is different in the x and y directions). The wire structure element that defines the angular bending dampingtype (w$atype) can now be a list of two bending types {x direction bending type, y direction bending type}. If this element is a single element not in a list, (i.e. for models that were defined before this change), it works as before, with the same damping type being used in both bending directions. Added wirepotential1M1[] ,wirepotential1M2[] to allow for this. Overloaded wirebendingPE[] to do either one (wirebendingPE[T,l,EE,M,alpha,beta]) or two (wirebendingPE[T,l,EE,M1,M2,alpha1,beta1,alpha2,beta2]) directions at a time.

6/10/04 - v1.2: All the stuff from Ben Lee's versions "1.2", "1.3" and "1.4" plus some tidying up:
("1.2")
-Add optional extra plotting routines prettyplotTF[], prettyplotTFf[] and prettyplotTN[]. For plotting transfer functions and thermal noise with extra plotting options to more easily distinguish between lines when comparing plots.
-The Calculate and Reset general procedure definition has also been altered. Six terms have been missing from these procedures, Calculate[potentialmatricesWB], Calculate[couplingmatricesWB], Calculate[couplingmatrixWB], Calculate[potentialmatricesWE], Calculate[couplingmatricesWE], Calculate[couplingmatrixWE], as well as these terms in the corresponding Reset[] procedure definition. The consequence of this change is that now ALL terms are reset when Reset[Stage] is called, so a recalculation of Stage1 and Stage2 of a slightly different model will not have results corrupted by un-reset terms.
-The calculation of the angles alpha1, beta1, alpha2, beta2 in the functions wirepotential1[] and wirepotential2[] have been corrected. The definitions have changed from {alpha1=pv.(dwv - dsv), beta1=ov.(dwv-dsv), alpha2=pv.(dwv+dev), beta2=ov.(dwv+dev)} to the new definitions given in the functions.
-The function wirebendingdelta[] has been modified. A few terms that were missing from the beta1^2 contribution have now been added. The functions wirepotential1[] and wirepotential2[] have also been modified. The line "wv=normalize[wirevector[w]/.cval];" has been changed to "wv=normalize[wirevector[w]/.tmpsub/.cval/.tmpsubrev];", where tmpsub is a list of temporary substituions for allparams e.g. {x00temp[1], y00temp[2]...etc}, and tmpsubrev is a reverse of the substitution i.e. {temp[1]x00, temp[2]y00...etc}. This is so allparams remain non-numeric in wv and hence also remain non-numeric in potentialtermlistWE and potentialtermlistWB.  Thus when the makecouplingmatrix[] function is called, derivatives that are calculated with respect to these values are correct.
-The damping types for potentialtermlistWB and potentialtermlistWE have been changed. For potentialtermlistWB the damping type has changed from w$ltype to w$atype (longitudinal damping to angular damping type), and for potentialtermlistWE it has changed from w$atype to w$ltype (angular damping to longitudinal damping type).
("1.3")
-An extra stage, Stage1A has been added into the Calculate[] (and Reset[]) procedures. All previous Stage1 results (i.e. Hz1, eigenvalues1, eigenvectors1... e.t.c.) are now named 1A (i.e.  Hz1A, eigenvalues1A, eigenvectors1A... e.t.c.).  Stage1 (or Stage1B),  with results Hz1, eigenvalues1, eigenvectors1... e.t.c. now include a twisting potential contribution (potentialtermlistWT, potentialmatricesWT... e.t.c.). Calculate[Stage1] can be called without manually calling Calculate[Stage1A], as Calculate[Stage1] includes the call of Calculate[Stage1A] (as is done for other stages). The structure defining suspension wires (or ribbons) has been changed to allow for this extra twisting potential. The wire Shear Modulus now appears at position 8 (w$G=8) and polar moment of inertia appears at position 14 (w$J=14). All the previous term positions have been updated accordingly.
("1.4")
Two functions, wirepotential1T[] and wiretwistingPE[] have been changed. wirepotential1T has been changed to account for the extra inputs required by wiretwistingPE[]. wiretwistingPE[] has been changed to add a load dependent term which contributes to the wire twisting potential energy. The structure defining suspension wires (or ribbons) has had an extra term added at position 10, (w$A=10), which is the cross sectional area of the wire (or ribbon). Also, to avoid confusion and to be technically correct, the term in the wire structure that was previously defined as the polar moment of inertia (w$J=14), is now known as the polar stiffness term (w$C=15), (15 because of the extra w$A term). This is also needed because the function wiretwistingPE[] involves both the polar moment of inertia J, and polar stiffness term Je, which are only equivilant for a circular cross section.
(Tidying up by MB)
-Changed utilitiesversion back to 1.2.
-Changed description of Je and w$Je in comments from "polar stiffness term" to "torsional stiffness geometric factor".
-Renamed I1 and I2 to M1 and M2 throughout to conform to w$M1 and w$M2.
-Added a new field to the wirelist structure, w$ttype, representing a new damping type specifically for torsional motion and adjusted Calculate[potentialtermlistWT] to use it.
-Renumbered the w$xxx to make the first 14 fields in wirelist the same as for v1.1, with all the new fields at the end. Added a test on the length of wirelist[[i]] to Calculate[potentialtermlistWT] to use 0 for the potential term unless the extra fields are present.
-Added Preliminaries section with Needs[] statements for Graphics`Graphics`, LinearAlgebra`MatrixManipulation`, RotationsXYZ` and StatusWindow`, in case PendUtil is ever loaded independently of a model definition file.
-Defined Reset[All].

1/28/04 - v1.1: Add optional extra input arguments to the opt[] function to allow key internal magic numbers to be specified/overridden. Move exportmatlab[] and the like into a separate package, MatlabExport`. Add findQ[]. Incorporate wirefunctions.m. Added preeqtermlist, posteqtermlist and tensionoffswitch to allow more flexible overriding of the structure of the model. Moved usage string for useprecomputed, overrides and nonoptvars from case notebook. Added code to use empty list if user forgets to define overrides or nonoptvars.

2/1/03 - v1.0: Initial release based on major rework of model-independent parts of quad v2.5.

Status Window (StatusWindow1.4.zip)

Utilities to display progress and timing information in a status window.

1/6/09 v1.4: Added tag argument to Status[], Status1[], Done[] and Done1[] to allow for many parallel updates with different tags. (This was done with a view to supporting parallel computation in Mathematica v7, but it turns out that parallel sub-kernels can't communicate with the front end so it doesn't help.) Mathematica 6/7 OK

3/20/08 v1.3: Added MinimizeBox and ZoomBox elements to window. Mathematica 6 OK

6/14/07 - v1.2: Corrections for Mathematica v.6: Check for version and execute either Date and FromDate (v4, v5) or DateList and AbsoluteTime (v6). Changed WindowFrame option of status window to be "ModelessDialog" (had been "MoveableModalDialog" but in v6 this suddenly started doing what its name suggested and blocking access to other window). Added DoWithStatus[] and DoWithStatus1[] for convenient workaround to new behaviour of plotting commands in v6 (where graphic output is a result rather than a side-effect, so following them with ;Done[] suppresses output). Still backward compatible to Mathematica v4 and v5. Mathematica 6 OK

8/20/03 - v1.1: This version has two fixes for Mathematica 5.0. (It is still compatible with Mathematica 4.x.)

5/8/02 - v1.0: Initial release.

Yaw/Pitch/Roll Rotations (RotationsXYZ.zip)

A package similar to the standard Mathematica package Geometry`Rotations` except that it uses a yaw, pitch and roll convention for angles. Mathematica 6 OK

3D Graphics (MyShapes1.1.zip)

A package similar to the standard Mathematica package Graphics`Shapes` except that it responds more consistently to Translate[] and Rotate[] commands.

6/14/07 - v1.1: Obsolete in Mathematica v6 - updated to do nothing unless version number less than 6.0. Mathematica 6 OK

Interferometer Model from BENCH (IFOModel1.1.zip)

A Mathematica implementation of key parts of the Bench model of a generic LIGO interferometer, including all the physical and interferometer specific constants.

7/7/05 - v1.1 (but not included in AllPackages till 10/4/10!): Placed EndPackage[] statement earlier so most symbols would be created in Global` contest.

1/27/04 - v1.0: Initial release as independent Mathematica package. (Formerly there had been independent copies in each model directory.) Mathematica 6 OK

Export to Matlab (MatlabExport1.3.zip)

Utilities to export numbers, numerical vectors and matrices as Matlab ".m" files.

2/24/05 - v1.3: Minor tweak for Mathematica v6 compatibility: removed unnecessary load of LinearAlgebra`MatrixManipulation`, which was generating an obsolete message but was not actually being used. Still backward compatible to Mathematica v4 and v5. Mathematica 6 OK

2/24/05 - v1.2: Rudimentary support for symbolic output.

11/29/04 - v1.1: Fix for v5 of Mathematica (ExportString used to put a newline at the end of its output in v4, but not in v5).

1/27/04 - v1.0: Initial release as independent Mathematica package. (Formerly the functions had been in PendUtil`.)

Export to E2E (E2EExport1.1.zip)

Utilities to export matrices as text files suitable for cut'n'paste into E2E/Alfi blocks.

1/31/05 v1.1: - Initial release - based on v1.1 of MatlabExport Mathematica 6 OK

HOME