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

List of function available for use in Formula Questions

Jump to solution

The blog post Looking Up Values in Formula Questions mentions the functions reverse, sort, and at that can be used when creating formula questions. This is the only reference to the use of functions in Formula Questions that I can find anywhere.

Is there a list of other functions that are available? I know from experimentation that ln, e^x, max, min, and various trig functions are available. What about statistical functions such as the normal cdf or inverse normal cdf?

Thanks,

Robbie Beane

Tags (1)
1 Solution
James
Community Champion

The statistical functions you mention are not available. That was kind of the whole point of that blog post.

About that same time, I started to write another blog post about all of the functions that were available and what they did. It evolved into the blog post that I did publish.

The list of the available functions is available within Canvas. When you are creating a formula question, there is an example right above the toolbar. "What is 5 plus [x]?"

That is followed by a link that says "Need Help?"

Click on the Need Help? link and then switch to the Functions tab.

There is a pull down list (starting with Absolute Value) that provides a list of the functions that are available and a brief explanation of what they do.

184649_pastedImage_3.png

Here are the functions that are in that list:

abs acos asin at atan ceil comb cos count deg_to_rad e fact first floor if last length ln log max mean median min perm pi rad_to_deg rand range reverse round sin sort sqrt sum tan

View solution in original post

19 Replies
kona
Community Coach
Community Coach

 @rbeane ​, I'm not sure, but I'm going to tag  @James ​, the author of the blog you cited, to see if he has any insight into this.

Stef_retired
Community Team
Community Team

 @rbeane ​, I believe  @James ​ can give you a definitive answer on this, given his familiarity of how the math editor works in Canvas--but if I'm not mistaken, this guide links out to PDF resources that show what functions are supported by the LaTex editor that is built into the RCE: How do I use the Math Editor in the Rich Content Editor?

James
Community Champion

The statistical functions you mention are not available. That was kind of the whole point of that blog post.

About that same time, I started to write another blog post about all of the functions that were available and what they did. It evolved into the blog post that I did publish.

The list of the available functions is available within Canvas. When you are creating a formula question, there is an example right above the toolbar. "What is 5 plus [x]?"

That is followed by a link that says "Need Help?"

Click on the Need Help? link and then switch to the Functions tab.

There is a pull down list (starting with Absolute Value) that provides a list of the functions that are available and a brief explanation of what they do.

184649_pastedImage_3.png

Here are the functions that are in that list:

abs acos asin at atan ceil comb cos count deg_to_rad e fact first floor if last length ln log max mean median min perm pi rad_to_deg rand range reverse round sin sort sqrt sum tan

Thanks a lot!

lic
Community Participant

I can't find the "Need help" button! Help! Has the help been updated out of the system?

The list of the available functions is available within Canvas. When you are creating a formula question, there is an example right above the toolbar. "What is 5 plus [x]?"

 

That is followed by a link that says "Need Help?"

I am trying to guess how to write inverse trig functions. So far arcsin, asin, invsin don't seem to work and I am running out of ideas.

Lisa

0 Kudos
James
Community Champion

 @lic ,

Are you using Legacy Quizzes or New Quizzes?

In the legacy quizzes, it's above the editor. I just pulled this up while writing this response, so it's still there for me.

326812_pastedImage_1.png

I don't have new quizzes enabled to check.

Thankfully, you don't have to get a list from within Canvas itself, it's available in the documentation. I believe that the functions in new quizzes is the same, but have not verified this is.

In the Canvas Instructors Guide, there is a lesson called https://community.canvaslms.com/docs/DOC-26355 

At the top of that, in the blue notes section, is a link to the Canvas Formula Quiz Question Helper Functions PDF. It contains a list of all of the functions that are available so that you don't have to access them online.

In particular, Canvas uses the asin, acos, atan notation to get at arcsine, arccosine, and arctangent functions.

I'm not sure how you used asin(), but it should have worked if called with proper arguments. Realize that the result is given in radians, not degrees, but it can be nested inside a rad_to_deg() function to get it in degrees. For example, 

rad_to_deg(asin(1/2)) should return 30, while asin(1/2) would return the decimal form of π/6.

The normal restrictions on domain and range apply. asin(x) has a domain of [-1,1] and a range of [-π/2,π/2]. If you try asin(2), you should get an error. I'm not sure which one, but NaN (not a number) seems likely.

Finally, and you probably already know this, but while I'm typing I thought I'd throw it out there. Canvas does not have functions for asec(), acsc(), or acot(). They can be obtained using the reciprocal functions and identities like asec(x) = acos(1/x). That is asec(2) = acos(1/2).

Edited 2020-05-15. Had rad_to_degrees instead of rad_to_deg.

lic
Community Participant

Thank you so much!

I don't know what I did yesterday, but I just couldn't make it work with asin or acos, but today it worked. I must have made som sort of typo to make it impossible.

The list of functions is not i the new quizzes that I can find, but right now I am a bit confused, because I alternate between starting a legacy and a new quiz depending on where I am in the system.

I think I might be getting the hang of it, but what I really need is something, that can do algebra and calculus.

Thanks again

Lisa

0 Kudos
James
Community Champion

 @lic ,

You really need an external system if you want to do algebra and calculus the way that people want to do math.

Formula questions are numeric only and do not support algebraic manipulations or exact answers. Fill in the blank questions support symbols to an extent, but there are too many ways to enter a correct answer to use them reliably. You can use essay questions, but then they won't auto-grade.

0 Kudos
CraigOgden
Community Participant

This "Needs help" link needs to be put into the Quizzes.next formula editor as well.  I can never member what all the available functions are.

In the New Quizzes, this is no longer an option. I can't figure out how to do a different base in the new quizzes either.

0 Kudos
James
Community Champion

Although I addressed the list of functions that are available within Canvas, I thought I would mention the statistical functions you asked about.

Back in October, 2015, jomullen​ offered a formula for finding the normal CDF in this discussion Rounding problems in formula questions.  He got his formula from John Cook  who wrote a blog called Simple approximation to normal probability distribution and the approximation contained there has a maximum error of 0.00014 on the domain (-π,π).

There are approximations for other functions out there. John Cook had another blog for the Normal distribution inverse that has a maximum error of 0.0004.

Cook provides links to the books where he got the formulas from if you want to do additional research. There may be more accurate formulas. The limitation is that if you want to use the approximations from within Canvas, you can only use the built-in functions.

Thanks for this. I will take a look at those approximations. I imagine that they will be very useful.

smykke
New Member

I'm having trouble getting the following equation to enter into the formula question.

I need   sin^-1(W/L) (This is a angle of impact calculation for blood spatter).

Since Canvas only does trig functions in radians I added the rad_to_degrees in front so I had:

rad_to_degrees(asin(W/L)) but it returns the error:

"unrecognized method rad_to_degrees"

I set up the numbers so that the L would always be greater than W to avoid a decimal >1.

Any suggestions except making it a MC or essay, which I don't want to do.

TIA.

 

0 Kudos
James
Community Champion

 @smykke  

rad_to_degrees is not the name of the function, it's rad_to_deg


See Canvas Formula Quiz Question Helper Functions for the list.

That said, there was a bug within the last month or so that had rad_to_deg and deg_to_rad switched. I haven't tested it recently, but I would double check your questions if you use it.

You can always force rad_to_deg by multiplying by 180 and dividing by pi. That will work whether the function is broken or not.

0 Kudos
I can't get the log(a, [base] to work for base 3 in the new quizzes. It keeps saying invalid formula. I have tried multiple combinations of spaces between the log and parentheses and around the comma, but nothing is working in the new quizzes.
0 Kudos
smykke
New Member

Thank you that worked.

I just went off the example above:

rad_to_degrees(asin(1/2)) should return 30, while asin(1/2) would return the decimal form of π/6.

It did work correctly now.

Thank you!!!

James
Community Champion

 @smykke  

Thanks. I didn't realize I had typed that (I was probably typing what I was pronouncing instead of what was written). I went through and edited it to fix it to the proper function name.

0 Kudos
CraigOgden
Community Participant

The list of functions link is not working.  Is there an updated one?

0 Kudos
CraigOgden
Community Participant

If you have log base 3 of 8.  You could always use the change of base and do log 8 / log 3 or ln 8/ ln 3.

 

for example:

image018

0 Kudos