# Random Numbers in Quiz Table

Question asked by Brian Baugh on Nov 10, 2016
Latest reply on Nov 14, 2016 by Brian Baugh

I want to generate a table that looks something like this, which has a different starting spot price [s] for each version of the quiz and a different strike price [k]. I'd then ask the students to infer the strike price by looking at the table. Preferably I'd plot this in Canvas but I don't think that functionality exists yet. If I'm wrong, please let me know.

Here's what I want Canvas to produce after randomly generating a starting spot price for the table [s] and a random strike price [k].

What is the strike price of the following call option?

 Spot Price (\$) Call option Payoff (\$) 2 0 3 0 4 0 5 0 6 0 7 1 8 2 9 3 10 4

What I coded into the Canvas table:

What is the strike price of the following option?

 Spot Price (\$) Call option Payoff (\$) [s] max(0,[s]-[k]) [s]+1 max(0,[s]+1-[k]) [s]+2 max(0,[s]+2-[k]) [s]+3 max(0,[s]+3-[k]) [s]+4 max(0,[s]+4-[k]) [s]+5 max(0,[s]+5-[k]) [s]+6 max(0,[s]+6-[k]) [s]+7 max(0,[s]+7-[k]) [s]+8 max(0,[s]+8-[k])

What canvas produces

What is the strike price of the following option?

 Spot Price (\$) Call option Payoff (\$) 2 max(0,2-6) 2+1 max(0,2+1-6) 2+2 max(0,2+2-6) 2+3 max(0,2+3-6) 2+4 max(0,2+4-6) 2+5 max(0,2+5-6) 2+6 max(0,2+6-6) 2+7 max(0,2+7-6) 2+8 max(0,2+8-6)

How do I get canvas to compute the formula in a table using the variables [s] and [k]? Better yet, how do I plot this function?

Thanks!

Brian