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

LOGO-L> another plate



Hi George Mills
;You wrote :- 

;>This is great contrast to MSWLogo's PLATE.LGO example
;>which is purely a brute force approach.

;>I don't quite understand the significance of the color though.
;My Example was Just an attempt to use the 3rd dimension to
;represent the temperature rise.You are right; in the posted
;example there was no significance to colour.
;Now I repost the code so that both colour and hight will have
;significance.
;The technique used to solve Laplass second order in your Plate.lgo
;and in this code is from mathematical point of view isessentialy 
;the same. In this respect there is no contrast. 
;Thank you for your comment.
;Best Regards
;Mhelhefny

;----------------------
to col
ifelse :pp <1 [setpc 1][ifelse :pp<10 [setpc 6][ifelse :pp<30[setpc 12][setpc
4]]]
end

to go
initialize cs ht mesh :a
mean :a
pu setxy -360 170 setpc 7 label (se [convergence reached after] repcount
[iterations])
legend type [press any key] setpensize [2 2] make "kk rc cs mesh :a legend
make "kk rc cs mesh1 :a legend
end

to grid1 :a
for [i 1 :m][for [j 2 :m][
make "pp mditem se :i :j :a col
mysetxyz :i*30 100+ :pp*2 :j*30 pd]pu]
end

to grid12 :a
for [i 1 :m][for [j 1 :m][make "pp mditem se :i :j :a col 
setxy -150+ :i*30 -150+ :j*30 pd]pu]
end

to grid2 :a
for [j 2 :m][for [i 1 :m][
make "pp mditem se :i :j :a col 
mysetxyz :i*30 100+ :pp*2 :j*30 pd]pu]
end

to grid22 :a
for [j 1 :m][for [i 1 :m][make "pp mditem se :i :j :a col 
setxy -150+ :i*30 -150+ :j*30 pd]pu]
end

to initialize
make "m 9
make "a mdarray se 9 9
for [i 1 9][for [j 1 9][ifelse :j=1[mdsetitem se :i :j :a 100][
mdsetitem se :i :j :a 0]]]
end

to legend
setpensize [10 10]
setpc 4 pu setxy -360 150 rt 90 pd fd 30 pu setxy -320 145 
label [temperature 30 --> 100] 
setpc 12 setxy -360 130 pd fd 30 pu setxy -320 125 
label [temperature 10 --> 30]
setpc 3 setxy -360 110 pd fd 30 pu setxy -320 105 
label [temperature 1 --> 1 ]
setpc 1 setxy -360 90 pd fd 30 pu setxy -320 85 
label [temperature --> 1]
setpensize [2 2]
end

to mean :a
make "w 0
repeat 50[make "w :w+1 for [i 2 :m-1][for [j 2 :m-1][
make "left mditem se :i-1 :j :a  make "right mditem se :i+1 :j :a
make "up mditem se :i :j-1 :a    make "down mditem se :i :j+1 :a 
make "t1 mditem se :i :j :a      make "t2 (:left+ :right+ :up+ :down)/4 
make "e abs :t2- :t1 if :e<.0005 [stop] mdsetitem se :i :j :a :t2]] mesh :a]
end

to mesh :a
pu grid1 :a grid2 :a
end

to mesh1 :a
pu grid12 :a grid22 :a
end

to mysetxyz :a :b :c
;library procedure
setxy (:a- :c)*cos 30 :b- (:a+ :c)*sin 30
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