📄 ---decay.nlogo
字号:
globals [ clock ;; this is the number of ticks elapsed decays ;; # of decays during this clock tick last-count ;; this is the number of nuclei at the beginning -- ] ;; reset each time a red line is drawn on the plotto setup ca set-default-shape turtles "circle" cct number-nuclei [ setxy (random screen-size-x) (random screen-size-y) set color cyan ] set last-count number-nuclei ;; remember the starting number of nuclei set clock 0 set decays 0 setup-plots update-plotsendto go ;; if all the nuclei have decayed then stop the model if not any turtles with [color = cyan] [ stop ] set decays 0 ask turtles with [color = cyan] [ if (random 100.0 < decay-chance) [ decay set decays decays + 1] ] set clock clock + 1 update-plots end;; this displays the decaying particleto decay set color yellow wait 0.1 ;; leave yellow on screen long enough for user to see it set color blueendto setup-plots set-current-plot "Radioactive Nuclei" set-plot-y-range 0 number-nuclei set-current-plot "Decay Rate" set-plot-y-range 0 ceiling (number-nuclei / 100)endto update-plots locals [undecayed] set undecayed count turtles with [color = cyan] ;; when half of the original nuclei have decayed draw a line to mark the half-life set-current-plot "Radioactive Nuclei" if (last-count / 2) > undecayed [ set-current-plot-pen "lines" draw-vertical-line clock draw-horizontal-line undecayed set last-count undecayed ] set-current-plot-pen "default" plot undecayed if clock > 0 [ set-current-plot "Decay Rate" plot decays ]end;; this draws a line at the given x-coordinateto draw-vertical-line [x-val] set-plot-pen-color red plot-pen-up plotxy x-val 0 plot-pen-down plotxy x-val number-nucleiend;; this draws a line at the given y-coordinateto draw-horizontal-line [y-val] set-plot-pen-color green plot-pen-up plotxy 0 y-val plot-pen-down plotxy clock y-valend; *** NetLogo Model Copyright Notice ***;; This model was created as part of the project: CONNECTED MATHEMATICS:; MAKING SENSE OF COMPLEX PHENOMENA THROUGH BUILDING OBJECT-BASED PARALLEL; MODELS (OBPML). The project gratefully acknowledges the support of the; National Science Foundation (Applications of Advanced Technologies; Program) -- grant numbers RED #9552950 and REC #9632612.;; Copyright 1999 by Uri Wilensky. All rights reserved.;; Permission to use, modify or redistribute this model is hereby granted,; provided that both of the following requirements are followed:; a) this copyright notice is included.; b) this model will not be redistributed for profit without permission; from Uri Wilensky.; Contact Uri Wilensky for appropriate licenses for redistribution for; profit.;; This model was converted to NetLogo as part of the project:; PARTICIPATORY SIMULATIONS: NETWORK-BASED DESIGN FOR SYSTEMS LEARNING IN; CLASSROOMS. The project gratefully acknowledges the support of the; National Science Foundation (REPP program) -- grant number REC #9814682.; Converted from StarLogoT to NetLogo, 2001. Updated 2003.;; To refer to this model in academic publications, please use:; Wilensky, U. (1999). NetLogo Decay model.; http://ccl.northwestern.edu/netlogo/models/Decay.; Center for Connected Learning and Computer-Based Modeling,; Northwestern University, Evanston, IL.;; *** End of NetLogo Model Copyright Notice ***@#$#@#$#@GRAPHICS-WINDOW2481057233440404.011000CC-WINDOW248337573496Command CenterMONITOR615178200clockclock01MONITOR172151246200decaysdecays01MONITOR89151160200nucleicount turtles with\n[color = cyan]01SLIDER598245131decay-chancedecay-chance0.0100.03.00.051%SLIDER56424597number-nucleinumber-nuclei14000150011NILBUTTON551612449setupsetupNIL1TOBSERVERBUTTON1351620049gogoT1TOBSERVERPLOT5203246353Radioactive Nucleitimenumber0.020.00.01000.0truefalsePENS"default" 1.0 0 -16776961 true"lines" 1.0 0 -65536 truePLOT5354246496Decay Ratetimenumber0.020.00.010.0truefalsePENS"default" 1.0 0 -65536 true@#$#@#$#@WHAT IS IT?------------This model simulates the spontaneous decay of a collection of radioactive nuclei. As they decay and become stable, the plot of the number that are still radioactive demonstrates the notion of "half-life".HOW IT WORKS------------At each time tick, each undecayed (light blue) nucleus has a certain chance of decaying. When a nucleus decays, it briefly flashes bright yellow (as if giving off radiation), then turns dark blue. Eventually, if you wait long enough, all of the nuclei will have decayed and the model will stop.HOW TO USE IT-------------Set the initial number of nuclei (NUMBER-NUCLEI slider) and the likelihood of decay during each time interval (DECAY-CHANCE slider). Then push the SETUP button. Push the GO button to run the model. The number of radioactive nuclei that remain is shown in the "Radioactive Nuclei" plot. Each time the number of nuclei is reduced by half, red and green lines appear on the plot to mark the place where each halfway mark was reached. The "Decay Rate" plot shows the number of decays that occur during each clock tick. THINGS TO NOTICE ----------------What is the shape of the decay curve (Radioactive Nuclei)? How is this affected by the initial conditions?Why is the decay curve this shape? Is it the same as the decay curve shown in books? The time between red lines is called the half-life. What is its physical meaning? Is it constant as the number of nuclei decreases? Is it affected by the initial number of nuclei or the decay-chance? Do you think it's a useful way to characterize a radioactive material? How long does it take for all the nuclei to decay? Watch one nucleus carefully. When will it decay? Radioactivity depends on the number of decays per unit time (Decay Rate), because each decay event gives off radiation. What happens to the radioactivity of this sample over time? What is the shape of the decay rate curve? How is it related to the shape of the decay curve? Examine the standard equation for nuclear decay:| N = No (e exp -(T/tau))No is the initial number of nuclei, N is the number at a later time T, and tau is the "mean lifetime". Compare its behavior to what you see in this model. The corresponding equation for radiation is:| R = Ro (e exp -(T/tau))Why are these two equations so similar? THINGS TO TRY-------------Try the extremes of the initial conditions: many or few nuclei, high or low decay-chance. How does this affect the "jaggedness" of the decay rate plot? What does the plot do when very few nuclei are left? What instructions would you give each turtle be to make it behave like an unstable nucleus? Check the code in the Procedures tab and see if it's what you thought it should be. Carbon-14 dating involves comparing the ratio of a stable (C-12) to an unstable (C-14) nucleus. Explain that method in terms of this model.EXTENDING THE MODEL-------------------It is often the case in nature that two nuclei with different decay rates are present in the same sample. Modify this model to have two or more types of nuclei. What happens to the radiation curve?In this model, the nuclei don't affect their neighbors when they decay -- they just disappear. Get them to emit particles that in turn cause reactions in other nuclei. See if you can model a chain reaction. (See the Reactor Top Down and Reactor X-Section models.)RELATED MODELS--------------Reactor Top-Down, Reactor X-SectionCREDITS AND REFERENCES----------------------To refer to this model in academic publications, please use: Wilensky, U. (1999). NetLogo Decay model. http://ccl.northwestern.edu/netlogo/models/Decay. Center for Connected Learning and Computer-Based Modeling, Northwestern University, Evanston, IL.@#$#@#$#@defaulttrue0Polygon -7566196 true true 150 5 40 250 150 205 260 250circlefalse0Circle -7566196 true true 35 35 230@#$#@#$#@NetLogo 1.2.1@#$#@#$#@@#$#@#$#@@#$#@#$#@
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -