Hermia, a young Athenian maid.
Lysander, her lover.
Act I: The flirting of Lysander with Hermia.
Scene I: On a balcony.
[Enter Hermia and Lysander]
Lysander: Thou art as beautiful as the sum of a lovely blossoming red rose and a sweet summer's day.
Hermia: Thou art a joy.
[Exeunt]
Act II: A recurring correspondence is established.
Scene I: In which they assess each other's identity.
[Enter Hermia and Lysander]
Hermia: Art thou thyself?
Lysander: If not, then I am a tree.
Hermia: Speak your mind!
[Exeunt]
Scene II: In which comparisons are made.
[Enter Hermia and Lysander]
Lysander: Art thou as cunning as myself?
Hermia: If so, let us proceed to scene III. Thou art as bold as the sum of thyself and a cat.
Lysander: I am the product of happiness and myself. We must return to scene I.
Scene III: The End.
[Exeunt]
Not entirely sure it works as I don't have the converter and can't compile it myself...
You only need to write '1:10' and it'll output them. Probably works in MATLAB too, though I don't have a copy.
If you want it to actually print them,
Code:
cat(1:10)
Will give you the output you want. Or, to match with the other loops,
Code:
cat(1:10,sep="\n")
Will put each on a new line.
Getting into stupider methods of doing it in R...
Code:
y <- c(1:10,0)
x <- 1:11
c <- (lm(y ~ poly(x,10,raw=TRUE)))$coefficients
f <- function(x) {
return(c[1] + c[2]*x + c[3]*x^2 + c[4]*x^3 + c[5]*x^4
+ c[6]*x^5 + c[7]*x^6 + c[8]*x^7 + c[9]*x^8
+ c[10]*x^9 + c[11]*x^10)
}
f(1:10)
Fit a degree 10 polynomial to the sequence, plus 0. Create a function that evaluates that polynomial. Then calculate the values of that function at the points 1 to 10.