WebAssign Dynamic Numeric Questions

Since we are only using WebAssign for one more semester I was resisting learning to code WebAssign questions. Since one of my classes has a rich WhatsApp community I have overcome my resistance. As usual my primary audience is me a couple months in the future when I want to do this and have forgotten how.

Code for a mortgage problem
This shows code for a monthly payment loan question

Basically you need an equation section defined by tags that look like HTML tags. Define variables with a $. End lines of code with a semi-colon. I am not sure what the two quotes do by the end equation tab, but they seem to be important. Removing them broke one question. Answer blanks are denoted with <_>. Arithmetic seems to use typical symbols except exponents are denoted with ** instead of ^ or a power function like in some systems.

Some useful functions include decform which can display a desired number of decimal places in a number. It rounds rather than truncates. Another is pickone which picks from a list which can be useful if the numbers are not evenly spaced and randnum can’t be used. Randnum does not seem to be able to take a step size under 1 but that is easily fixed with another variable and division. Commas displays numbers like 8000000 as 8,000,000.

A lot of the examples of multi-mode, two-numeric-answer questions seemed to be really complicated. But it appears to work just to stack the answers over one another.

This shows a question asking about loan interest cumulatively and in the first month
A multi-mode question where both parts are numeric

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s