Complex numbers and Finite Field arithmetic (Moodle Formulas)

Complex numbers and Finite Field arithmetic (Moodle Formulas)

by Ton Boerkoel -
Number of replies: 12

Are there functions related to complex numbers?

e.g.  Re( 3 + 4 i ) = 3  and  Im( 3 + 4 i) = 4

or    norm( 3 - 4 i ) = 5 

or  x = 3 + 4 i  and  y = 2 - i   where   x^2*y^3   gets computed as  250 + 125 i

I know I can write little formulas for these individually ... but ultimately I am working my way up to having Moodle formulas doing arithmetic over finite fields and complex numbers, like row reduction of a 3x4 matrix with complex entries, or multiplication of a 2x5 matrix with a 5x3 matrix with entries over a finite field like F_9. 

I have built for my students programs for these in my upper level linear algebra class (on the TI-Nspire), and I would like to create Moodle questions and tests for that class. But right now I have to find a way to have Moodle do more complicated arithmetic than just working with real numbers.

Average of ratings: -
In reply to Ton Boerkoel

Re: Complex numbers and Finite Field arithmetic (Moodle Formulas)

by Dominique Bauer -
Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Plugin developers
No, not at the moment.
In reply to Dominique Bauer

Re: Complex numbers and Finite Field arithmetic (Moodle Formulas)

by Ton Boerkoel -

Is it possible to use the libraries  math.js or complex.js  in Moodle's java scripting world, or just java's built in math library?

In reply to Ton Boerkoel

Re: Complex numbers and Finite Field arithmetic (Moodle Formulas)

by Dominique Bauer -
Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Plugin developers
You can do whatever you want in JavaScript, but on the client side it is not a good workaround for getting secure quizzes. On the server side, you would most likely define your own functions in PHP or use PHP libraries.
In reply to Dominique Bauer

Re: Complex numbers and Finite Field arithmetic (Moodle Formulas)

by Ton Boerkoel -

I see, a security issue, I guess because of the "inspect element" feature. I will talk to our IT and see what can be done on the server side with PHP libraries. Thanks. 

In reply to Ton Boerkoel

Re: Complex numbers and Finite Field arithmetic (Moodle Formulas)

by Ton Boerkoel -

I managed to get Moodle to compute an inverse of a 2x2 matrix over the finite field

F_4 = { 0, 1, a, b }


and grade it using algebraic formulas


But it it takes a lot of work.  (I didn't use javascript, just built-in functions)

btw here is the arithmetic of F_4


Average of ratings: Useful (1)
In reply to Ton Boerkoel

Re: Complex numbers and Finite Field arithmetic (Moodle Formulas)

by Tim Hunt -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers
If you are getting that far into Pure maths, it might be worth looking at the STACK question type: https://moodle.org/plugins/qtype_stack

That is harder to install than the Formulas question type, but has a Computer Algebra System behind it. Note, most of the forum discussion about STACK here tends to happen in the mathematics tools forum, not this one.
In reply to Tim Hunt

Re: Complex numbers and Finite Field arithmetic (Moodle Formulas)

by Ton Boerkoel -

Unfortunately our IT is slowly working it's way up to newer versions of Moodle and hasn't been willing to install STACK.  So I am just working with the cards I have been dealt. It is actually fun to see what you can do with only a limited set of tools. I am building templates of functions to create more complicated problems. I am working my way up: I am doing 3x3 matrices over F_4 now. 


Next up is 3x3 inverses, and row reduction of 3x4 matrices etc.  Hopefully by January I have a complete set of functions for my class. I will also build functions over F_7 and the complex numbers. F_7 will be easier, because of the mod(  ) function. Complex numbers will be another big task. I'll see how far I can get. I wish I could interphase my TI-Nspire calculator with Moodle (it has a CAS like STACK uses)


In reply to Ton Boerkoel

Re: Complex numbers and Finite Field arithmetic (Moodle Formulas)

by Ton Boerkoel -
I'll make this my last update.  Here is a row reduction over F4 


graded by moodle  (using algebraic formulas) gives



I don't know how to give partial credit in the case of algebraic formulas yet.



In reply to Ton Boerkoel

Re: Complex numbers and Finite Field arithmetic (Moodle Formulas)

by Ton Boerkoel -

Alright one more update: complex numbers


and


 graded with partial credit:



Real parts and imaginary parts are selected randomly for each number, and e.g. complex multiplication
has to be defined. Then all complex numbers have to be displayed nicely. The routine I wrote displays complex 
numbers  7 - 4 i  instead of  7 + -4 i ,   3 - i  instead of 3 + -1 i  and  -2 i  instead of  0 + -2 i  etc.

It would be really nice if Moodle had complex arithmetic as a built-in feature. Doing everything from scratch is
exhausting (making templates helps though).





In reply to Ton Boerkoel

Re: Complex numbers and Finite Field arithmetic (Moodle Formulas)

by Carl Stensfer -

I recommend that you and your students use plainmath.net to find detailed solutions to problems that you find difficult. This training resource contains all the basic topics of mathematics, so there is a good chance that you will find what you are looking for.

In reply to Carl Stensfer

Re: Complex numbers and Finite Field arithmetic (Moodle Formulas)

by Marcus Green -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers
It looks very interesting, are you involved with Plainmath Carl?
here is a link and summary

https://plainmath.net/about-us

"Plainmath is a free math encyclopedia. We collect and put together all unsolved math problems and show solutions to them so that students can learn and understand them. Our primary goal is to enrich the education process with clear and accessible examples."