Let' say, you are having the following code in R programming:
tt <- seq(1,10,length.out=100)
y <- seq(1,10,length.out=100)
Beta0 = 55
Beta1 = 0
Beta2s <- seq(-10,0,len=100)
RSS <- sapply(Beta2s, rss, Beta0=55, Beta1=0)
head(RSS)
[1] 19223571 18806870 18394761 17987243 17584318 17185985
And the following in python:
Beta2s = np.linspace(-10, 0, num = 100)
Beta0 = 55
Beta1 = 0
y = np.linspace(1,10,100)
t = np.linspace(1,10,100)
If you want to plot then just use a list comprehension like the following:
plt.plot(Beta2s,[rss(Beta0,Beta1,i) for i in Beta2s])
Or you can also vectorize the function:
RSS = np.vectorize(rss)(Beta0,Beta1,Beta2s)
RSS[:5]
array([19223570.88655147, 18806869.74602632, 18394760.55678168,
17987243.31881757, 17584318.03213398])