[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

LOGO-L> without multi-turtles demo



;Hello
;Many of this list members know the classical method of multi-turtle
;simulation even with "lady bug logo". Sometimes it is even easier to 
;do the job without multiple turtles.
;Here is a simple demo code to draw different curves simultaneously 
;without multiple turtles. To run the demo just type go
;Best regards.
;Mhelhefni
;---------------------------------------------------------------
to axis
setpc 5 pu setxy -360 260 pd label [y] sety -200 sety 80 
setx 360 label [x] setpc 2 pu sety -80 pd label [x] setx -360 pu
end

to dotplot
pd fd 2 pu
end

to draw 
for [xx -360 360 .5][
       setxy :xx (80+ 50* run fun) setpc 3 dotplot 
       setxy :xx (-80+ 50* run fun1) setpc 4 dotplot  
       setxy (run fun3)- 100 (run fun4)- 150 setpc 6 dotplot
if :xx > 240 [
       setxy (run fun3)+ 220 (run fun5)- 160 setpc 7 dotplot]]
end

to fun
op [(exp -:xx*.004)*(sin :xx*2)]
end

to fun1
op [sin :xx*cos :xx*2]
end

to fun3
op [ 70*cos :xx*9]
end

to fun4
op [50*sin :xx*12]
end

to fun5
op [35*sin :xx*9]
end

to go 
cs ht axis draw putlabels
end

to putlabels 
pu setxy 0 150 setpc 3 pd label [(exp -.004*x)*(sinx)]
pu setxy 0 -150 setpc 4 pd label [sin(x*cos (x*2))]
pu setxy -180 220 setpc 5 pd label [DEMO: plotting curves  
   simultaneously without multi-turtle]
pu setxy -125 -155 setpc 6 label [lissajo]
pu setxy 200 -160 setpc 7 label [ellipse]
end
;-------------------------------------------------------------------
---------------------------------------------------------------
Please post messages to the Logo forum to logo-l@gsn.org.  Mail
questions about the list administration to logofdn@gsn.org.  To
unsubscribe send    unsubscribe logo-l    to majordomo@gsn.org.



Global SchoolNet Foundation - Linking Kids Around the World!
Copyright GSN - All Rights Reserved - Comments & Questions
Visit GSN's Global Schoolhouse for more exciting learning resources!
Search our Site - Home