Sunday, August 20, 2006

Logistic map - some undestanding

Some time back, I had put forth my view that a depiction of successive iterations of the logistic map will impart a better understanding of the (continuous :-) ) emergence of chaotic behaviour rather than a usual web diagram.

The map considered continues to be the logistic map something like:
x(n+1) = r * x(n) * {1 - x(n))

So I went ahead and modified my toolset a little - and captured last five iteration in a iteration run of 30 iterations. I also sampled at a much smaller interval on the parameter (x). This did throw some light on the behaviour.

Ignore the depiction at the extreme ends of the graphs - I think its an artifact of the cspline fitting as there is an unstable fixed point at x=0.

In stable zone (r<3):

You can see that the at most of the x's there is no change in x and things settle down to the stable fixed point equal to
1 - 1/r

Even at r=3

you can see the oscillatory behaviour between two values (the bifurcation). Basically the successive iterator values stay at one value for some time, then jump to the other value and stay there for some more time and eventually jump back. The fixed point is no longer stable (note that the fixed point continues to be at (1 - 1/r) : only things stay there in an unstable way. And succcessive iterations keep oscillating around it. One value abve and one value below the stable point.

At some x values the behaviour of oscillation reverses - in the sense that at any given iteration, some disjoint ranges of x values are above the fixed point and the others its below the fixed point and then a few iterations later the rols have reversed. Those that were above have switched to the values stayed at by those that were below!

Now at successive r values upto r = 3.5 (Actually its not such a rational number : more actual irrational representation can be found at the math-world page)), there is a narrowing of the gap between the x ranges where the switchings of values I described above occur.

Two samples:

Now at r=3.5 similar behavior to the above happens but at a recursive level. Ther eis a finer split yielding four values but there is a "lower frequency wave" of switching between the values above the fixed point to the values below the fixed point. This recursion is also clearly visible in the standard bifurcation diagrams for the logistic map (one is up at the math word page).

Now there is a critical r value at 3.5699.... and my tool skps to 3.6 but the rest of the stages are displayed below to impart of sense of the chaotic unsettling behaviour at each x with small zones where there is some settling into cycles and gradual weakening of that behaviour.

Tuesday, August 15, 2006

logistic maps 1(toolset)

I am studying a book by Prof N Kumar of RRI on deterministic chaos (University press, India ).

The chapter on logistic maps made me somewhat confused - so started an internet search. The booke deals with the web representation for discussing the works - bifurcations , etc.

Found an interestinng representation (non-web) at See the graphs on the top. I dont have Mathematica - so what do I do to get the maps? I spent an hour and created the follwoing perl script which in turn lanuches gnuplot to make plots simialr to the ones at the web site - slightly deeper. (Ugh - I am on windows - linux did not work that great on my laptop).

Some images:

At r = 3.4

Perl Script :


my $r_inc = 0.2;
my $x_inc = 0.001; #Change this to smaller values to get better pictures

for(my $r = 2;$r <= 4;$r += $r_inc)
my %data = ();

for(my $x0 = 0; $x0 <= 1; $x0 += $x_inc)
my $x = $x0;

for(my $i = 0; $i <= 10; $i++)
if(not defined $data{$i})
$data{$i} = [];

push @{$data{$i}},[$x0,$x];

$x = f($r,$x);


open SCR,">script_$r.scr";
print SCR "set xrange [0:1]\nset yrange [0:1]\n";
print SCR "set term png\nset output \"$r.png\"\nset title \"r=$r\"\nplot ";

my $first = 1;
foreach my $i (sort {$a <=> $b} (keys(%data)))
my $data_file = "data_".$r."_".$i.".dat";
open OUT,">".$data_file;
foreach my $x (@{$data{$i}})
print OUT "${$x}[0]\t${$x}[1]\n";

print SCR ", ";
print SCR "\"$data_file\" title \"$i\" smooth csplines";
$first = 0;

print SCR "\n";
close SCR;

system("./ script_$r.scr");

sub f
my $r = shift;
my $x = shift;

return ($r * $x * (1-$x));

Shell script


c:/Program\ Files/gnuplot/bin/wgnuplot.exe $*

What do I learn from all this? Not much - nothing yet. I am tired for the day. Actul study postponed to another day.

Thursday, August 03, 2006

Maven2, compiling with jdk 1.5

Struggled for time with some 1.5 stuff: actually google search with the error message from the compiler (obviously ;-) )would have fixed it .... and eventually google search did the trick.

Found this which says

Although if you want to tinker with the source and target settings
just do this:

link is at

So why am posting this?

Because that misses the "build" tag outside of the plugin. Without taht the project xml (pom.xml) is invalid.

Make it look like


Words of wisdom

In thread , Nathan Baum says
I think this is, to some extent, because Lisp doesn't need to learn from
other languages. Lisp *programmers* can learn from other languages and
augment Lisp to fit their fancy.

Wednesday, August 02, 2006

Maven2 mysteries

I am at a phase where I can actually experiment with a non-ant build system for a java with other tools (including a lisp based code generator) project.

One of the key requirements is to do very modular development with modules depending on other modules only in a binary way: that is the build system must build the dependency modules if necessary and place the binary deliverables of those modules into classpath or some such thing for any module.

I thougt maven is a good idea and it still seems so ...

Downloaded maven2 (version 2.0.4) based on advice at their web site. Also downloaded "maven 2.0.4 tasks for ant" thinking I might need them and placed it into the lib folder of maven installation. I still think I need them, but read on ...

Then I launched something like:

/cygdrive/d/projects >mvn archetype:create -DartifactId=foo -DarchetypeArtifactId=maven-archetype-quickstart

And duly received the following exception:

[INFO] ------------------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] org.apache.maven.profiles.ProfileManager.loadSettingsProfiles(Lorg/apache
[INFO] ------------------------------------------------------------------------
[INFO] Trace
java.lang.NoSuchMethodError: org.apache.maven.profiles.ProfileManager.loadSettingsProfiles(Lorg/apache/maven/settings/Settings;)V
at org.apache.maven.DefaultMaven.doExecute(
at org.apache.maven.DefaultMaven.execute(
at org.apache.maven.cli.MavenCli.main(
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(
at sun.reflect.DelegatingMethodAccessorImpl.invoke(
at java.lang.reflect.Method.invoke(
at org.codehaus.classworlds.Launcher.launchEnhanced(
at org.codehaus.classworlds.Launcher.launch(
at org.codehaus.classworlds.Launcher.mainWithExitCode(

at org.codehaus.classworlds.Launcher.main(
[INFO] ------------------------------------------------------------------------

I must say I was not expecting this behaviour. I wasted like 3-4 hours doing google search, nopes no help (and hence this blog - in case you happen to search for it).

After some frustration and contemplation on whether I should give up etc, I noticed the error carefully. It struck me (obviously based on past experience) that may be there is a problem with the class in that the class does not precisely look like it was supposed to. that is the loading class expects the loaded class to look different.

Then I launched a small handy tool which I use to locate classes : the tool is a shell script that looks like this


if [ -z "$substring" ]

if [ -z "$substring" ]
cat <<EOS
Usage $0 [root-to-search-from] search-string.
root-to-search-from is optional - defaults to .
The search-string can even hold parts of the package structure
exit 1

substring=`echo $substring|tr '.' '/'`

cd "$root_dir"
for j in `find . -name '*.jar' -print`
echo "--- $j -------"
jar tvf $j | grep $substring | sed -e 's/^.* //'
echo "++++++++++++++"
cd "$old_pwd"

The launch results looked like

.../maven-2.0.4 >find-class ProfileManager
--- ./core/boot/classworlds-1.1.jar -------

--- ./lib/maven-artifact-ant-2.0.4-dep.jar -------
--- ./lib/maven-artifact-manager-2.0.4.jar -------

--- ./lib/maven-project-2.0.4.jar -------

.../maven-2.0.4 >

Ah! There are two implementations of ProfileManager.

I nuked maven-artifact-ant-2.0.4-dep.jar from the lib directory and then the project got created peacefully.

Now, is that jar required? May be, who knows?