CODE IN R ( Cubic splines) I am dealing with the syntax error \" Error in xy.coo
ID: 3664581 • Letter: C
Question
CODE IN R ( Cubic splines)
I am dealing with the syntax error
" Error in xy.coords(x, y, xlabel, ylabel, log) :
'x' and 'y' lengths differ "
When I input this into my R console:
{ R code..........
}
dy = CubicSpline(0:10, sin(0:10), cos(0), cos(10))
x = c()
y = c()
for (i in 0:100) {
x = c(x, i*0.1)
y = c(y, CubicSplineValue(i*0.1, 0:10, sin(0:10), dy))
}
plot(sin,from = 0, to = 10)
plot(x,y) # trying to plot cubic spline values but I get an error about lengths x and y differing
What am I doing wrong?
Explanation / Answer
from random import randrange random_number = randrange(1, 10) count = 0 while count < 3: guess=int(raw_input('Enter a guess:') if guess==random_number: print "you win!" break count+=1 else: print'you lose.'Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.