Conic Sections 2

Conic Sections 2 preview image

1 collaborator

Uri_dolphin3 Uri Wilensky (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 665 times • Downloaded 98 times • Run 1 time
Download the 'Conic Sections 2' 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?

The model displays two basic conic sections: hyperbolas and parabolas. The figures are generated behaviorally as opposed to algebraically - the turtles attempt to behave like points on the specified shape. The partner to this model is called "Conic Sections 1".

A parabola is the set of all points that are the same distance from a point (focus) and a line (directrix). A hyperbola is based on the same idea as is a parabola except that it is reflected over the directrix.

The ancient Greeks discovered that each conic section can be found by taking a cross section of one or two cones with their points pointing toward each other. A circle results from taking a slice that is perpendicular to the axis, while an ellipse results from taking a slice of one cone that is not perpendicular to the axis. Similarly, a parabola results from a cross section that passes through one cone in a vertical fashion, such that the plane of the cut is parallel to one face. A hyperbola results from a vertical section that passes through both cones.

HOW IT WORKS

The turtles use feedback to make decisions about how they behave. They set out in random directions, and then they receive information as to whether or not they are getting closer to where they want to be. If they are getting closer, they continue moving forward in the direction they are going. If they are moving farther away, they set out in a new random direction. This process is akin to the children's game of "Hot and Cold", in which players are told whether they are getting "hotter" or "colder" in relation to a hidden goal.

HOW TO USE IT

Hyperbolas

-Select the number of turtles with the NUM-TURTLES slider.
-Press SETUP.
-Make sure the DIRECTRIX? switch is set to OFF.
-Press GO
-click at two points in the view to set the foci

Parabolas

-Select the number of turtles with the NUM-TURTLES slider.
-Press SETUP.
-Make sure the DIRECTRIX? switch is set to TRUE.
-Press GO
-click at two different locations in the view to set the directrix and the focus.

THINGS TO NOTICE

When forming a hyperbola, turtles adjust their positions from two user-defined foci so that the difference between their distances from the foci attains a
value of CONSTANT.

When forming a parabola, turtles move to an equal distance from the directrix to the focus.

THINGS TO TRY

Adjust the slope of the parabola's directrix or the value of CONSTANT for the hyperbola while the turtles are still moving. See how they react to the changes in their environment.

You may be able to get a better feeling for the turtles' behavior if only a few turtles are in the world at one time. Try setting num to a small value (like 16 or 1), and watching the turtles.

Both of these conic sections can be observed by shining a flashlight at a cone and looking at its shadow. Can you figure out at what angles the cone must be held?

EXTENDING THE MODEL

Look at the StarLogoT model 'emergent-circle'. Watch how the turtles react with each other- something that is missing from 'Conic Sections'. Implement this emergent behavior for one or all of the conics in this project.

NETLOGO FEATURES

Like more traditional programming languages (e.g. Java), NetLogo can have procedures that report a value to the caller. The command used is called report --- it takes one input, the value to be reported. Look at the function pos. It takes two inputs, x and y, and reports a boolean.

RELATED MODELS

Conic Sections 1

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:

  • Wilensky, U. (1998). NetLogo Conic Sections 2 model. http://ccl.northwestern.edu/netlogo/models/ConicSections2. 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 1998 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.

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.

This model was converted to NetLogo as part of the projects: PARTICIPATORY SIMULATIONS: NETWORK-BASED DESIGN FOR SYSTEMS LEARNING IN CLASSROOMS and/or INTEGRATED SIMULATION AND MODELING ENVIRONMENT. The project gratefully acknowledges the support of the National Science Foundation (REPP & ROLE programs) -- grant numbers REC #9814682 and REC-0126227. Converted from StarLogoT to NetLogo, 2001.

Comments and Questions

Click to Run Model

globals [
  f0x    ;; xcor of focus 0 (for hyperbola)
  f0y    ;; ycor of focus 0 (for hyperbola)
  f1x    ;; xcor of focus 1 (for hyperbola)
  f1y    ;; ycor of focus 1 (for hyperbola)
  state  ;; flag to alternate between different values in mouse code
]

turtles-own [
  dist     ;; distance from 'goal' in current state
  diff     ;; modified distance to x and y intercepts in current state
]

to setup
  clear-all
  set f0x 0
  set f0y 0
  set f1x 0
  set f1y 0
  set state 0
  create-turtles num-turtles [
    set color green
    setxy random-xcor random-ycor
  ]
  move-focus-directrix 0 0
  reset-ticks
end 

to go
   ifelse mouse-down?
   [ move-focus-directrix round mouse-xcor round mouse-ycor  ]
   [
     ask turtles [ move-turtles ]
     set state (state + 1) mod 2
   ]
  tick
end 

to move-turtles
  ifelse directrix?
    [ parab ]
    [ hyperb ]
end 

to hyperb  ;;turtle procedure
  let old-dist dist
  ;;distance between two foci at const
  set dist abs ((distancexy f0x f0y) - (distancexy f1x f1y))

  ;;find location to stop
  if round dist = const [ stop ]
  ifelse (dist < old-dist) and (dist > const)
  [ fd 1 ]
  [
    ifelse (dist > old-dist) and (dist < const)
    [ fd 1 ]
    [
      rt random-float 360
      fd 1
    ]
  ]
end 

to parab   ;; turtle procedure
  let old-diff diff
  set dist distancexy f0x f0y
  let intx xcor
  let inty f1y
  ;;distance from directrix
  set diff (distancexy intx inty) - dist

  ;; locate position to stop
  if (abs diff) < 1 [ stop ]
  if (abs diff) > (abs old-diff)
    [ rt random-float 360 ]
  if not can-move? 1
    [ rt 180 ]
  fd 1
end 

to move-focus-directrix [ x y ]
  ifelse state = 0
  [
   set f0x x
   set f0y y
  ]
  [
   set f1x x
   set f1y y
  ]
  clear-patches
  ask patch f0x f0y [ set pcolor white ]
  ifelse directrix?
    [ ask patches with [pycor = f1y] [ set pcolor white ] ]
    [ ask patch f1x f1y [ set pcolor white ] ]
end 


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

There are 11 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 Conic Sections 2 Download this version
Uri Wilensky over 14 years ago Conic Sections 2 Download this version

Attached files

File Type Description Last updated
Conic Sections 2.png preview Preview for 'Conic Sections 2' over 11 years ago, by Uri Wilensky Download

This model does not have any ancestors.

This model does not have any descendants.