9 views

Skip to first unread message

May 2, 2021, 4:20:02 AMMay 2

to Numbas Users

This has had me pulling my hair out!

I am writing questions on the Fourier transform which uses the Dirac delta function \delta(t) and \delta(\omega).

If I use math expression and have a question something like:

Q: What is the inverse Fourier transform of the unit step function?

A: 2pi*delta(omega) - 2i/omega

The prompt and feedback that students see is nicely formatted as

latex("2\pi\delta(\omega) - \frac{2i}{\omega}")

But the marking algorithm complains that delta looks like a multi character function but is not defined. Even if I change this to d(omega) I get a complaint about the function d(...) not being defined.

Is there a way to incorporate arbitrarily named functions in mathematical expressions?

Thanks

Chris Jobling

Swansea University

May 2, 2021, 10:30:32 AMMay 2

to numbas...@googlegroups.com

Hi Chris,

The standard marking algorithm for mathematical expression parts establishes whether the student's answer is equivalent to the expected answer by evaluating them both on a randomly selected set of values for the free variables. If there are any undefined functions in either expression, this can't be done.

Occasionally it makes sense to just not do this check, for expressions where you want the answer in a very specific format, but the other way to get round it is to define the function. You could define delta(x) as a custom function in the question, and then the marking would work.

Here's an example: https://numbas.mathcentre.ac.uk/question/share/view/caabb63e-25c8-4f1c-919c-4955acc1e438

--

You received this message because you are subscribed to the Google Groups "Numbas Users" group.

To unsubscribe from this group and stop receiving emails from it, send an email to numbas-users...@googlegroups.com.

To view this discussion on the web, visit https://groups.google.com/d/msgid/numbas-users/58b37599-b5e9-43f5-a5ee-53c995fa1adcn%40googlegroups.com.

May 3, 2021, 7:58:06 AMMay 3

to Numbas Users

Thanks Christian. That's great and clarifies the workings of mathematical expressions for me. I was sure that there must be a way to define new functions, but completely overlooked Extensions -> functions.

Another quick off-topic question, can j be used for the imaginary number i? And does I have to be in the numerator of an imaginary fraction? I've tried to enter 1/(iomega) [or 1/(jomega as we electrical engineers usually write it] but couldn't get the marker to mark it properly.

May 4, 2021, 6:06:45 AMMay 4

to numbas...@googlegroups.com

You can't use j as the imaginary unit at the moment. I have an open issue about this at https://github.com/numbas/Numbas/issues/691.

You're missing a multiplication symbol in your example. 1/(i*omega) would work. If you want to allow students to omit the multiplication symbol, or even a space, you could tick the box "Force single-letter variable names?" in the Restrictions tab - see https://docs.numbas.org.uk/en/latest/question/parts/mathematical-expression.html#term-force-single-letter-variable-names

To view this discussion on the web, visit https://groups.google.com/d/msgid/numbas-users/53729af2-ac3a-4c6a-8db4-ab00afdf2d87n%40googlegroups.com.

Reply all

Reply to author

Forward

0 new messages

Search

Clear search

Close search

Google apps

Main menu