Community

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
bbaugh21
New Member

Random Numbers in Quiz Table

Jump to solution

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 ($)
20
30
40
50
60
71
82
93
104

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]+1max(0,[s]+1-[k])
[s]+2max(0,[s]+2-[k])
[s]+3max(0,[s]+3-[k])
[s]+4max(0,[s]+4-[k])
[s]+5max(0,[s]+5-[k])
[s]+6max(0,[s]+6-[k])
[s]+7max(0,[s]+7-[k])
[s]+8max(0,[s]+8-[k])

What canvas produces

What is the strike price of the following option?

  

Spot Price ($)Call option Payoff ($)
2max(0,2-6)
2+1max(0,2+1-6)
2+2max(0,2+2-6)
2+3max(0,2+3-6)
2+4max(0,2+4-6)
2+5max(0,2+5-6)
2+6max(0,2+6-6)
2+7max(0,2+7-6)
2+8max(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

Tags (4)
1 Solution
James
Community Champion

 @bbaugh21 ​,

That capability does not currently exist in Canvas. There have been several feature requests regarding better random number generation and the ability to use generated values within the question text. Currently, neither exists. Neither does plotting values like you've asked for.

The best you can achieve with native Canvas technology is to make multiple versions of the question, put them into a question group (or a question bank) and have Canvas randomly pick one of them.

When I've needed similar functionality (except for the graph), I've used Excel to generate questions and then used Respondus to import them into Canvas. I've also written PHP code to generate multiple varieties of a question and directly import them into Canvas, but it was very case specific and not intended to be used as a framework. That generated 150 versions of 9 questions -- Canvas still bogs down every time I try to open that quiz.

View solution in original post

6 Replies
James
Community Champion

 @bbaugh21 ​,

That capability does not currently exist in Canvas. There have been several feature requests regarding better random number generation and the ability to use generated values within the question text. Currently, neither exists. Neither does plotting values like you've asked for.

The best you can achieve with native Canvas technology is to make multiple versions of the question, put them into a question group (or a question bank) and have Canvas randomly pick one of them.

When I've needed similar functionality (except for the graph), I've used Excel to generate questions and then used Respondus to import them into Canvas. I've also written PHP code to generate multiple varieties of a question and directly import them into Canvas, but it was very case specific and not intended to be used as a framework. That generated 150 versions of 9 questions -- Canvas still bogs down every time I try to open that quiz.

Thanks for the quick response James! Too bad the functionality doesn't

exist yet, but I'll stay tuned for future updates. Thanks again!

4 years later... I have created a chrome extension that will enable you to do that. Download it from: https://chrome.google.com/webstore/detail/canvas-quiz%20/jbpanaoeongimfdcfbnhfaagblakgpca?hl=en&auth...

In your question:

[s1] [m1]

[s2] [m2]

[s3] [m3]

...

in the formula sections add these:

s1 = range(2,10)

k = range(1,5)

s2= s1+1

s3 = s1+2

...

m1 = Math.max(0,s1-k)

m2 = Math.max(0,s2-k)

...

James
Community Champion

I haven't tested it, but that looks easier than editing the values. Is there documentation in the extension?

The best I've come up with so far is manipulating the web page is explained in https://community.canvaslms.com/people/james 

0 Kudos

Very basic instruction here: https://sites.google.com/view/canvasquiz/home

Stef_retired
Community Team
Community Team

 @bbaugh21 , Canvas is currently in the midst of a comprehensive quiz refactor project, and you can learn more about it by viewing the InstructureCon 2016 presentation ​. If this specialized question type is of interest to you (and I'm a former stockbroker and registered options principal, so it's certainly of interest to me!), please add your feedback to Canvas Studio: Modern Quizzing Engine​.