FloquetMatrix and FundamentalMatrix from Mathematica Journal article

I am refering to a document published in Mathematica Journal. The link is below

http://www.mathematica-journal.com/issue/v10i1/contents/Picard/Picard_1.html

This document illustrates the stability of vertical driven inverted pendulum. It has used certain functions like FloquetMatrix and FundamentalMatrix but I am unable to locate these function in the Mathematica.

I have the trial version for now. Can someone please help me how to use these function and from where I can read details about them or it is the issue with trial version.

Thanks.

These functions are not part of Mathematica, but of the author’s FastPicard` package, available on his web page.

Can you please suggest me any tutorial for how to include functions defined in this package.

Packages can be loaded using Get (<<) or Needs. They are typically saved to some directory on $Path, like Applications inside $UserBaseDirectory, so Mathematica can find them easily. See the documentation for more details.

It can even be loaded directly from the web, for example

Get["http://www.mat.ufmg.br/~aneves/papers/FastPicard.m"]

?FloquetMatrix

Thank you for your reply. I am working on mac os 10.6.8. The $Path command gives me the following output.

{“/Applications/Mathematica.app/SystemFiles/Links”, \“/Users/meetmadhvi/Library/Mathematica/Kernel”, \“/Users/meetmadhvi/Library/Mathematica/Autoload”, \“/Users/meetmadhvi/Library/Mathematica/Applications”, \“/Library/Mathematica/Kernel”, “/Library/Mathematica/Autoload”, \“/Library/Mathematica/Applications”, “.”, “/Users/meetmadhvi”, \“/Applications/Mathematica.app/AddOns/Packages”, \“/Applications/Mathematica.app/AddOns/LegacyPackages”, \“/Applications/Mathematica.app/SystemFiles/Autoload”, \“/Applications/Mathematica.app/AddOns/Autoload”, \“/Applications/Mathematica.app/AddOns/Applications”, \“/Applications/Mathematica.app/AddOns/ExtraPackages”, \“/Applications/Mathematica.app/SystemFiles/Kernel/Packages”, \“/Applications/Mathematica.app/Documentation/English/System”, \“/Applications/Mathematica.app/SystemFiles/Data/ICC”}

I am not very sure where should I keep my package to use it.

I have kept the package on the location /Users/meetmadhvi/Library/Mathematica. When I use Get [“FastPicard.m”] then it show me

FundamentalMatrix::shdw: Symbol FundamentalMatrix appears in multiple contexts {FastPicard`,Global`}; definitions in context FastPicard` may shadow or be shadowed by other definitions. >>

FloquetMatrix::shdw: Symbol FloquetMatrix appears in multiple contexts {FastPicard`,Global`}; definitions in context FastPicard` may shadow or be shadowed by other definitions. >>

I am new to Mathematica so can you please explain me if this is some error or warning.

Those warnings usually mean that the names FundamentalMatrix and FloquetMatrix were used before the package was loaded.
In Mathematica 8 and 9, the package definitions will take precedence.

To remove the unwanted definitions, use
Remove[ “Global`FloquetMatrix”, “Global`FundamentalMatrix” ]
or Quit the Kernel and start evaluating the notebook again. (The latter will
delete all definitions.)

Thank you for the reply.

I am just trying to use the code snipplets given in the document.

http://www.mathematica-journal.com/issue/v10i1/contents/Picard/Picard\_1.html
One of the code

  1. Get[“FastPicard.m”]
  2. p = TrigReduce[{{-1 + a Cos^2, 1 - a Sin Cos}, {-1 - a Sin Cos, -1 + a Sin^2}}];
  3. fms = FundamentalMatrix[p, 20];
  4. ((fms /. {a → 2., t → 2 Pi]}).{1, -2})

The expected output is {535.492,-0.00373489} and the output I am getting is {<<1>>, -138853. Pi] + 134829. Pi]^2 + <<85>> + <<24>> <<1>> - 2 (1 + <<89>> + 8.22064*10^-18 (-262144 Pi]^19 Cos[4 \] + 19/2 (131072 \^18 Sin[4 \] - 9 (-65536 \^17 Cos[4 \] + 17/2 (32768 \^16 Sin[4 \] - 8 (-16384 \^15 Cos[4 \] + 15/2 (8192 \^14 Sin[4 \] - 7 (-4096 \^13 Cos[4 \] + 13/2 (2048 \!\(\*SuperscriptBox[\(\\), \(\2\\\)]\) Sin[4 \] - <<1>>))))))))

I am not getting any error message also. Please tell what I am doing wrong here. I tried other codes in the file also but every time I get a different output.

Thanks In advance for help.

Maybe one or more variables already had values. Seems to work fine in a fresh session:

ClearAll["Global`*"]
Needs["FastPicard`"]
p[t_] = TrigReduce[{{-1 + a Cos[t]^2, 1 - a Sin[t] Cos[t]}, {-1 - a Sin[t] Cos[t], -1 + a Sin[t]^2}}];
fms = FundamentalMatrix[p, 20][t];
((fms /. {a -> 2., t -> 2 Pi}).{1, -2})

(* Out[24]= {535.492, -0.00373489} *)

Thank you so much for the reply. It worked for me now.

Can you please tell me how to find errors in mathematica. Sometime I do not get any error but at the same time not the required output.

For example I was trying the code:

ClearAll["Global`*"]
Needs["FastPicard`"]
ftmmathieu = FloquetMatrix[{{0, 1}, {-a - b Cos[#1], 0}} &, 20];
Timing[pend1 =   With[{matrix = ftmmathieu /. {a -> -3/2 v^2, b -> 3 h/2}},     ContourPlot[Tr[matrix], {h, 0, 0.5}, {v, 0.1, 100},      Contours -> {-2, 2}, ContourShading -> False, PlotPoints -> 120,      FrameLabel -> {StyleForm["\!\(\[Epsilon]/l\)", "TR",         FontSize -> 10],        StyleForm["\!\(w\_0\)\!\(\@\(l/g\)\)", "TR",         FontSize -> 10]}]];]

The expected output is a contour plot with the time {118.15 Seconds,Null}.
The output I am getting is {4.042254, Null}.

Thanks for the help.

In the last input, try removing the trailing semicolon from the end of ContourPlot[ … ]; which makes it evaluate to Null and thus suppresses the plot being output (this would have worked with the semicolon in place in old versions of Mathematica, but since V6 graphics no longer produce side effects), and also correcting the value for a:

Timing[pend1 = 
  With[{matrix = ftmmathieu /. {a -> -3/(2 v^2), b -> 3 h/2}}, 
   ContourPlot[Tr[matrix], {h, 0, 0.5}, {v, 0.1, 100}, 
     Contours -> {-2, 2}, ContourShading -> False, PlotPoints -> 120]]]

As for finding out what’s wrong when something doesn’t seem to work in general, I’d suggest going carefully through the documentation (reference pages, tutorials, etc.) for all the involved functions and working out the examples. Also see this discussion on StackExchange which nicely summarizes some of the more common issues new users may encounter.

Thank you so much for the reply. I have solved it.