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
speedto update the position - use the average of old and new
accelto update the speed - replace the
speedvariable 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:
gravity <- function(pos, K=20, L=1, mass=0.1) {
return(-9.8 * mass)
}
coil <- function(pos, K=20, L=1, mass=0.1) {
return( K*(L-pos) )
}On each question use your code to simulate and make a graphic of hese two cases:
y1 <- simulate(N=90, y_init=1.2, s_init=0, mass=0.1, force=gravity, delta=0.1)
y2 <- simulate(N=90, y_init=1.2, s_init=0, mass=0.1, force=coil, delta=0.1)Send your answer to the my accout at
istanbul.edu.tr.