The Quiz was delayed and this homework was cancelled. This homework is replaced by the Exercieses after Class 8.
The next week we will have a graded quiz. It will be like an exam and it will allow you to practice for the real exam.
To prepare for that, please take the code of the function
simulate
that we developed in classes, put it in a
.Rmd
file, and modify it as follows:
- use the average of old and new
speed
to update the position - use the average of old and new
accel
to update the speed - replace the
speed
variable by a vector, similar topos
, so we can see how the speed changes with time. The output of this version should be only the speed
Your Rmarkdown document should have three parts, one for each question. At the beginning you should declare these functions:
<- function(pos, K=20, L=1, mass=0.1) {
gravity return(-9.8 * mass)
}
<- function(pos, K=20, L=1, mass=0.1) {
coil return( K*(L-pos) )
}
On each question use your code to simulate and make a graphic of hese two cases:
<- simulate(N=90, y_init=1.2, s_init=0, mass=0.1, force=gravity, delta=0.1)
y1 <- simulate(N=90, y_init=1.2, s_init=0, mass=0.1, force=coil, delta=0.1) y2
Send your answer to the my accout at
istanbul.edu.tr
.