PANDA BEAR Solo

PANDA BEAR Solo preview image

2 collaborators

Uri_dolphin3 Uri Wilensky (Author)
Josh3 Josh Unterman (Author)

Tags

mathematics 

Tagged by Reuven M. Lerner over 11 years ago

Model group CCL | Visible to everyone | Changeable by group members (CCL)
Model was written in NetLogo 5.0.4 • Viewed 406 times • Downloaded 66 times • Run 1 time
Download the 'PANDA BEAR Solo' modelDownload this modelEmbed this model

Do you have questions or comments about this model? Ask them here! (You'll first need to log in.)


WHAT IS IT?

This is a Solo version of the HubNet activity called Perimeters and Areas by Embodied Agent Reasoning, or PANDA BEAR. PANDA BEAR Solo can be used as a standalone activity or as an introduction to PANDA BEAR.

PANDA BEAR is a microworld for mathematics learning that lies at the intersection of dynamic geometry environments and participatory simulation activities. Whereas PANDA BEAR involves many people controlling individual vertices of a shared, group-polygon, in PANDA BEAR Solo, an individual user controls all of the vertices of a polygon. The measures of perimeter and area of the polygon are foregrounded in the environment. The model user can be given challenges regarding the polygon's perimeter and area as suggested in the THINGS TO TRY section.

HOW TO USE IT

SETUP initializes the model to create a polygon containing NUMBER-VERTICES vertices. GO allows the user to move the vertices around with the mouse. The PERIMETER and AREA monitors update automatically as the vertices move around. The PANDA plot shows both of those measures over time as a record of the user's actions as they work towards a goal. SETUP-PLOT resets the plot to start a new challenge with the same polygon. The MOVE-FD, MOVE-BK, TURN-RIGHT, and TURN-RIGHT buttons change the red vertex's location and heading. The STEP-SIZE and TURN-AMOUNT input boxes control the amount of movement of the MOVE-FD, MOVE-BK, TURN-RIGHT, and TURN-RIGHT buttons.

THINGS TO NOTICE

In a triangle, for an individual vertex, moving "between" the other two vertices minimizes the perimeter for a given area.

In a triangle, when all three vertices attempt to form an isosceles triangle, and equilateral triangle is formed.

Strategies that work for challenges at the triangle level often work at the square level as well.

As the number of vertices is increased, the polygon that maximizes the area given a perimeter and minimizes the perimeter given an area gets closer and closer to a circle.

THINGS TO TRY

With three vertices, make the area as big as possible while keeping the perimeter at or below 25.

With three vertices, make the perimeter as small as possible while keeping the area at or above 25.

Increase the number of vertices in the polygon from three to four (and beyond - approaching a circle) and do the above.

Modify the challenges in a patterned way. For example, with four vertices, doubling the allowed perimeter should quadruple the maximum area.

EXTENDING THE MODEL

Add different methods of movement. For example, instead of turning and going forward and backward, the user could be allowed to move the red vertex in the 4 cardinal directions.

Allow the user to give the vertices movement rules to follow over and over so that the group-polygon "dances".

NETLOGO FEATURES

This model uses links to form the sides of the polygon, each vertex is linked to exactly two other vertices. The sum of the lengths of all the links is the perimeter of the polygon.

The area calculation is based on information found here: http://mathworld.wolfram.com/PolygonArea.html

RELATED MODELS

PANDA BEAR

CREDITS AND REFERENCES

Thanks to Josh Unterman for his work on this model.

HOW TO CITE

If you mention this model in a publication, we ask that you include these citations for the model itself and for the NetLogo software:

  • Unterman, J. and Wilensky, U. (2007). NetLogo PANDA BEAR Solo model. http://ccl.northwestern.edu/netlogo/models/PANDABEARSolo. Center for Connected Learning and Computer-Based Modeling, Northwestern Institute on Complex Systems, Northwestern University, Evanston, IL.
  • Wilensky, U. (1999). NetLogo. http://ccl.northwestern.edu/netlogo/. Center for Connected Learning and Computer-Based Modeling, Northwestern Institute on Complex Systems, Northwestern University, Evanston, IL.

COPYRIGHT AND LICENSE

Copyright 2007 Uri Wilensky.

CC BY-NC-SA 3.0

This work is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 3.0 License. To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-sa/3.0/ or send a letter to Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA.

Commercial licenses are also available. To inquire about commercial licenses, please contact Uri Wilensky at uri@northwestern.edu.

Comments and Questions

Please start the discussion about this model! (You'll first need to log in.)

Click to Run Model

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Variable and Breed declarations ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

globals [
  red-vertex          ;; the red vertex
]

breed [ vertices vertex ]

;; vertices keep track of who is next in line
;; because the area calculation requires it.
vertices-own [ next-vertex ]

;;
;; Setup Procedures
;;

;; Initializes the display, and creates a list that contains the names of the shapes
;; used by turtles in this activity.  Also initializes the data lists.

to setup
  clear-all
  set-default-shape vertices "circle"
  create-vertices number-vertices [
    setup-vertex-vars
  ]
  ;; one of the vertices is specially controlled by the
  ;; controls in the interface, designate it here.
  ask one-of vertices [
    set color red
    set shape "monster"
    set red-vertex self
  ]
  ;; make the polygon
  ask one-of vertices [ edgify ]
  ;; update the data in the display
  update
end 

;; sets the turtle variables to appropriate initial values

to setup-vertex-vars  ;; vertex procedure
  set color brown
  setxy random-xcor random-ycor
  set heading 0
  set label-color white
  set next-vertex nobody
end 

;; recursive procedure that links all the vertices together
;; one at a time.

to edgify
  ;; each vertex is linked to once and then, in turn links to
  ;; another vertex that has not yet been linked, when we
  ;; run out of vertices we've made a line and we just need
  ;; to close the polygon by linking back to the beginning
  let candidates other vertices with [ not any? link-neighbors ]
  ifelse any? candidates
  [
    set next-vertex one-of candidates
    create-link
    ask next-vertex [ edgify ]
  ]
  [
    set next-vertex one-of other vertices with [ count link-neighbors = 1 ]
    create-link
  ]
end 

to create-link
  create-link-with next-vertex [
    set color white
    set label-color white
  ]
end 

;;
;; Runtime Procedures
;;

to go
  if mouse-down? [
    ;; clicking "picks up" the closest vertex
    ask min-one-of vertices [ distancexy mouse-xcor mouse-ycor ] [
      ;; if the mouse is more than 1 patch away from any
      ;; vertex just ignore the click.
      if distancexy mouse-xcor mouse-ycor < 1
      [
        while [mouse-down?] [
          ;; use EVERY to limit how much data we end up plotting
          every 0.05 [
            ;; don't move vertices directly on top of one another
            if all? other vertices [ xcor != mouse-xcor or ycor != mouse-ycor ] [
              setxy mouse-xcor mouse-ycor
              update
            ]
          ]
        ]
      ]
    ]
  ]
end 

to update
  ask links [
    set label less-precise link-length
  ]
  ask vertices [
    ;; make sure the angle is positive
    let my-neighbors sort link-neighbors
    let angle (subtract-headings towards first my-neighbors towards last my-neighbors) mod 360
    ;; make sure the angle is the interior angle
    if angle > 180 [ set angle 360 - angle ]
    set label less-precise angle
  ]
  display
  update-plots
end 

;;; used to keep the labels from having too much cluttering detail

to-report less-precise [ precise-num ]
  report precision precise-num 1
end 

to-report perimeter
  report sum [link-length] of links
end 

;; this area calculation is based on the formula found here:
;; http://mathworld.wolfram.com/PolygonArea.html

to-report area
  let result 0
  ask vertices [
    let addend ((xcor * [ycor] of next-vertex) -
        (ycor * [xcor] of next-vertex))
    set result result + addend
  ]
  report abs (result / 2)
end 


;; red-vertex commands

to move-fd
  ask red-vertex [
    ;; pre-check that no other vertices are on the point we're headed to
    let new-xcor (xcor + step-size * dx)
    let new-ycor (ycor + step-size * dy)
    if all? vertices [xcor != new-xcor or ycor != new-ycor] [
      fd step-size
    ]
  ]
  update
end 

to move-bk
  ask red-vertex [
    ;; pre-check that no other vertices are on the point we're headed to
    let new-xcor (xcor + step-size * (- dx))
    let new-ycor (ycor + step-size * (- dy))
    if all? vertices [xcor != new-xcor or ycor != new-ycor] [
      bk step-size
    ]
  ]
  update
end 

to turn-right
  ask red-vertex [
    rt turn-amount
  ]
end 

to turn-left
  ask red-vertex [
    lt turn-amount
  ]
end 


; Copyright 2007 Uri Wilensky.
; See Info tab for full copyright and license.

There are 10 versions of this model.

Uploaded by When Description Download
Uri Wilensky over 11 years ago Updated to NetLogo 5.0.4 Download this version
Uri Wilensky about 12 years ago Updated version tag Download this version
Uri Wilensky about 12 years ago Updated to version from NetLogo 5.0.3 distribution Download this version
Uri Wilensky almost 13 years ago Updated to NetLogo 5.0 Download this version
Uri Wilensky over 14 years ago Updated from NetLogo 4.1 Download this version
Uri Wilensky over 14 years ago Updated from NetLogo 4.1 Download this version
Uri Wilensky over 14 years ago Updated from NetLogo 4.1 Download this version
Uri Wilensky over 14 years ago Updated from NetLogo 4.1 Download this version
Uri Wilensky over 14 years ago Model from NetLogo distribution Download this version
Uri Wilensky over 14 years ago PANDA BEAR Solo Download this version

Attached files

File Type Description Last updated
PANDA BEAR Solo.png preview Preview for 'PANDA BEAR Solo' over 11 years ago, by Uri Wilensky Download

This model does not have any ancestors.

This model does not have any descendants.