Re: Problems in plotting Lyapunov Exponents:
- To: mathgroup at smc.vnet.net
- Subject: [mg98715] Re: Problems in plotting Lyapunov Exponents:
- From: dh <dh at metrohm.com>
- Date: Thu, 16 Apr 2009 04:20:20 -0400 (EDT)
- References: <gs47mm$7q5$1@smc.vnet.net>
Hi, you should read the manual about "Compile". n and ndrop should be integer not complex numbers. Further you need to declare the complex list xlist. Here is a corrected version: =============================== LypHS = Compile[{l, xinit, {n, _Integer}, {ndrop, _Integer}}, xlist = Drop[ NestList[-30000 l + (1 - l) # + l*(2858.16/(# - 500)^0.82) &, xinit, n] , ndrop + 1]; Apply[Plus, Log[Abs[(1 - l) - l (2343.71/(xlist - 500)^1.82)]]]/ Length[xlist] , {{xlist, _Complex, 1}}]; Plot[LypHS[l, 10, 5000, 100], {l, 0.0, 1.0}] ================================================ Daniel CreativeSolutionsNZ at gmail.com wrote: > Hi > I have been trying to debug the following piece of code > to plot Lyapunov Exponents, but getting several errors. > ----------------------------------------------------------------------------------------------- > In[1]:=LypHS=Compile[{l, xinit, {n, _Complex}, {ndrop, _Complex}}, > xlist=Drop[ > NestList[-30000l+(1-l)#+l*(2858.16/(#-500)^0.82)&, xinit, > n], > ndrop+1]; > Apply[Plus, Log[Abs[(1-l)-l(2343.71/(xlist-500)^1.82)]]]/ > Length[xlist]]; > > Plot[LypHS[l, 10, 5000, 100], {l, 0.0, 1.0}] > ----------------------------------------------------------------------------------------------- > Can anyone try to run it and help me to fix these errors ? > Or is any better code is possible for this problem ? > Best regards. > ----------------------------------------------------------------------------------------------- >