Saturday, October 20, 2007

Week 8: Introduction to Function HW Due 10/29

1. Review Introduction to Function Unit and practice the examples there.

2. The following program draws a graph function
local x y
t=0
loop 10000 [t=t+0.0001 x=150*t y=70*Sin(4*360*t) jt x 0
FD y]

A. What is the period of the graph?

B. How would you slow the program by a factor of 10? What will you change? This means the program will run 10 times slower.

C. Why do we need the commands x=150*t jt x 0 in the program?

D. What does the number 150 control in the program?

E. What will you change in the program so that it will not fill in the area but just draw the graph of the function itself? Hint: Instead of FD y try GOFD y or JT x y

F. What will you change in the program to make it draw a circle of diameter 100 with random colors ranging from 0 to 511

G. What will you change in the program to make it draw a spiral with random colors

H. Create a suprize piece of Mathematical Art and paste to code in your answer.

14 comments:

Anonymous said...

A. 35
B. I would change it to loop 100000 and t=t+0.00001.
C. They are there to adjust the poisition of the turtle for every FD y.
D. It determines the final position of the turtle on the x axis.
E. I would change FD y to GOFD y and add fd 1 in the brackets.
F. The final command reads loop 10000 [t=t+0.0001 x=50*cos(360*t) y=50*sin(360*t) jt x y color rnd 512 [circle 4]]
G. I don't have an answer, sorry.
H. local x y
t=0
spin 8 [loop 10000 [t=t+0.0001 x=30*cos(360*t) y=50*Sin(360*t) jt x y
color rnd 512 [circle 4]]
loop 10000 [t=t+0.0001 x=50*cos(360*t) y=30*Sin(360*t) jt x y
color rnd 512 [circle 4]]]
jschult3@ithaca.ed

Anonymous said...

A. The period of the graph is 37.5 to be exact. (150/4)
B. Well, i thought that to slow the program you would use the WAIT command but that slowed it too much. Then i saw what Josh wrote and now i see why that works. So i would also change the 10,000 to 100,000 and the 0.0001 to 0.00001.
C. By changing these commands i came up with these answers: The X=150*t determines the length of the graph or how wide it would be. In other words, it determines how far across the x axis the graph will span. I'm still not completely sure what the jt x 0 does but i know that if you did not have it the graph would just repeat ontop of itself. So it obviously tells the graph to move over "x" spaces after finishing on cycle.
D. The 150 controls the period of the graph.
E. To do this i changed the JT x y and my code came out to be this:
local x y
t=0
loop 10000[t=t+0.0001 x=300*t y=70*Sin(2*360*t) jt x y fd 0]
jt 0 0
F. To draw a cirle:
local x y
t=0
loop 100000 [t=t+0.00001
x=50*Cos(360*t)
y=50*Sin(360*t)
jt x y color rnd 511 [circle 5]]
G. I started this one and i came up with something. I know its not exactly a spiral but i think i might be on the right track!
growgby 30% 20 [
local x y
t=0
loop 1000 [t=t+0.001
x=30*Cos(360*t)
y=30*Sin(360*t)
jt x y color rnd 511 [circle 5]]jt 0 0
]
H. I would like to keep working on this some more and come up with something really neat!

c_muldow1@ithaca.ed

Anonymous said...

Wrong email sorry:
cmuldow1@ithaca.edu

Unknown said...

a.) the period is 4
b.) loop 100,000[t=t+0.00001..
c.) it determines the position of the turtle with fd y
d.) determines where the curves of the loops meet the axis
e.) fd y should be changed to gofdy
f.) local x y
t=0
loop 100000 [t=t+0.00001
x=100*Cos(360*t)
y=100*Sin(360*t)
jt x y color rnd 512 [circle 100]]
g.)
this is as close as i could get:
growby 10% 12 [ local x y]
x=180*Cos(360*t)
y=180*Sin(360*t)
jt x y color rnd 512 [circle 100]
im not sure what im doing wrong
h.)
NEW g1:
growby 10% 12 [ local x y]
x=180*Cos(360*t)
y=180*Sin(360*t)
jt x y color rnd 512 [circle 100]
NEW h1:
spin 100 [
g1
jt 0 0]
spin 100[ size 1/2 g1 jt 0 0 ]

mmcalin1@ithaca.edu

Anonymous said...

a. the period is 150/4
b. loop 100,000 and t=t+.00001
c. it determines the position of the turtle in relation to x.
d. i think it controls the period?
e. change fd y to gofd y
f. local x y t=0 loop 100000 [t=t+0.00001 x=50*Cos(360*t) y=50*Sin(360*t) jt x y color rnd 511 [circle 5]]
g. couldn't get it
jwerner1@ithaca.ed

Anonymous said...

I was messing around with SeeLogo some more and while I was peeking around in the lesson section I found something on the Spiral of Life that used cos and sin. I tested it out and came up with this really neat looking spiral.

t=0
growby 10% 100000 [
spin 60 [
JT 350 277 COLOR rgb (155 + 100*sin(t)) 0 0 [MT -2 -10]
JT -349 276 COLOR rgb 0 (155 + 100*sin(t)) 0 [MT 4 -13]
JT -346 -274 COLOR rgb (155 + 100*sin(2*t)) 0 (155 + 100*sin(t)) [MT -3 1]
]
rt 89 - t/100
t=t+0.1
]

I could watch this for hours. It never seems to end. :)

Unknown said...

2. A. The period of the graph is 150/4. 150 because x=150*t, and /4 because 360 is multiplied by 4.

B. You can slow the program by a factor of 10 by increasing the number of loops to 100,000, and by decreasing the increment of change in t to .00001.

C. x=150*t jt x 0 causes the movement forward of the turtle by a factor of x=150*t over time.

D. 150 controls the "length" of the graph. The best interpretation of "length" is as "period", but it could also be seen as "zoom" (viewing window of graph).

E. Changing fd y to gofd y eliminates the filled in paraboloas, but also does not draw in any line at all. Add fd 0.0001 for a very good approximation of the path the turtle travels.

F. After a bit of difficulty working with the syntax I came up with

loop 10000 [t=t+0.0001 x=50*cos(360*t) y=50*Sin(360*t) jt x y
color rnd 511 [circle 5]]


Having x and y both equal 50 makes it a circle with diameter 100 (because x and y each account for half of the diameter, so 2 50's make 100), as opposed to an ellipse. Multiplying x by cos and y by sin over time causes it to go around the circle. Color rnd 511 causes the color, and circle 5 is the shape the computer uses to draw with. (Personally I think it looks a little cooler - kind of like a mobius strip, maybe - if you use box 10 10).

G. I would like to work on this more later, but for right now I'm stuck. Maybe if we look at it again in class tomorrow I'll be fresher and have more ideas.

H.spin 12 [
local x
local y
local t
t=0
loop 1000 [t=t+0.001 x=50*cos(360*t) y=50*Sin(360*t) jt x y
color rnd 511 [box 10 10]]
]

I enjoyed seeing what other people came up with on this one!

Unknown said...

Whoops. My email is kpinnis1@ithaca.ed

Unknown said...

Colleen - the spiral you came up with is amazing! I'm totally hypnotized. Can you explain how you came up with it in class tomorrow?

Anonymous said...

Jahna said....

I also did the spiral of life when i got frustrated with the homework and it was really really awesome. I used purple, blue and green and the green was always at its center. i really enjoyed this.

A) 150/4
B) loop 1000 (t=t + .0001 x=150*t y=70*sin(4*360*t) jt x o fdy

C) position of the turtle fd y

D) this shows where the curves of the loops meet the axis.

E) FDY should be GOFDY

F) local x y t=0
100[ 10000 (t=t=.00001
x=100*cos(360*t)
y=100*sin(360*t)
jt x y color rnd j11 circle 5



jorzano1@ithaca.edu

Unknown said...

A. 4
B. For this one you would change loop to 100000 and I would change the t to equal t+0.00001
C. All you need to do for this one is change the postion of the turtle.
D. 150 determines the shape of the curve and where the axis is
E. I liked this one you change FD y to GOFD Y.
F. I was a little confused by this one. I couldn't figure it out so I put in some of the other examples from other people in the class. It was cool to see what everyone came up with.
G. I got really frustrated with this one I hope we can go over it in class.

Unknown said...

oh my email is cdelval1@ithaca.ed

Anonymous said...

A. 150 divided by 4 which is 37.5
B. You would add a 0 to loop to make it look like loop 100,000
C.
D. After playing with 150 a little bit...increasing and decreasing...it seems as though the 150 tells where the turtle will end up. I'm not sure what this means, but that's what it looks like on seelogo.
E. I do not understand what you are asking. Did we do this in class?
F. Im not quite sure how to do this one...I know I have to use the rnd color command, but it's not working when I add it to the other commands. I'm sure I am doing something wrong. We tried to do this at the end of class today, but we ran out of time. Can we start tomorrow's class with this please?

I'll send you the rest soon...sorry it's late...it's been a long night!

Anonymous said...

...my roommate's computer is not working properly...it won't pull up seelogo for some reason. I am sorry I can't finish the questions tonight, but I will stay after class and finish or do it on my own time in the computer labs.
I'm really sorry about this.
See you in class

Contributors