Re: problem with very slow matrix function

• To: mathgroup at smc.vnet.net
• Subject: [mg50940] Re: problem with very slow matrix function
• From: Paul Abbott <paul at physics.uwa.edu.au>
• Date: Tue, 28 Sep 2004 00:59:19 -0400 (EDT)
• Organization: The University of Western Australia
• References: <cj86j8\$782\$1@smc.vnet.net>
• Sender: owner-wri-mathgroup at wolfram.com

```In article <cj86j8\$782\$1 at smc.vnet.net>,
Roger Bagula <tftn at earthlink.net> wrote:

> Mathematica will do this function, but only very slowly...
> Thsat limits the number of values and how big I can make my critical point.
> I'd like a better , faster expression to do this kind of matrix
> switching function.
> I'm also looking for a way to make the switch depend on a random
> level as well (&& / And).
> I tried a version and it ignorred the second "and" implicit
> and did it on only the first implicit expression.
> As I want to do this on higher matrix level Bonacci/ Pisot
> systems, I would appreciate any help.
>
> (*  2by2 Markov sequence Critical Eigenvalue collapse of   golden mean*)
> digits=19
> M={{0,1},{1,1}}
> Det[M]
> A[n_]:=If[(Max[Eigenvalues[A[n-1]]])<12, M.A[n-1],A[Floor[(n-1)/2]]];

Use dynamic programming! That is, change this definition to

A[n_]:=A[n]=If[(Max[Eigenvalues[A[n-1]]])<12, M.A[n-1],A[Floor[(n-1)/2]]]

Cheers,
Paul

--
Paul Abbott                                   Phone: +61 8 6488 2734
School of Physics, M013                         Fax: +61 8 6488 1014
The University of Western Australia      (CRICOS Provider No 00126G)
35 Stirling Highway
Crawley WA 6009                      mailto:paul at physics.uwa.edu.au
AUSTRALIA                            http://physics.uwa.edu.au/~paul

```

• Prev by Date: Re: Export to file
• Next by Date: Re: A list element replacement.
• Previous by thread: GUIKit and GraphEdit
• Next by thread: Re: problem with very slow matrix function