Programming Guide



Hello,

Thank you all for your help. It is much appreciated. My program now runs
as it should but for one thing. This code is used to create a
bifurcation diagram and therefore I need to be able to write to the same
plot multiple times.

> A couple of notes. (1) My advice is to return the computed
> points instead of plotting them within diagram. Then you
> have more flexibility about what to do with them.
Right. Good call. This is the relevant portion;

getpoints(m) :=
	block ( [lambda, alpha, N:30],
	lambda:float(m^2*%pi^2),
	points:([[lambda, 0]]),
	for i thru N-1 do (
		alpha:float(i/N*%pi),
		lambda:newton(lambda, alpha, m),
		points: cons([lambda, alpha], points) ),
	points ) $

diagram(m) :=
	block ( [p],
	for i thru m do (
		p[i]:getpoints(i) ),	
	plot2d ([discrete,p])
	) $

Just calling on p doesn't work but I can call on each p, (p[1], p[2]) in
the plot command and it produces the expected output. I am looking for
something like

plot2d ([discrete, p[i],[i, 1, m]])

or a for loop where I can pass the hold option to gnuplot. 

for j thru m do (
	plot2d ([discrete, p[j], [hold on]]) )

Suggestions?

Thanks,

Zoho